strings: Add -o option as an alias for -t o

This commit is contained in:
Tim Ledbetter 2023-06-20 18:06:46 +01:00 committed by Andreas Kling
parent a2fb0768ff
commit c723101728
2 changed files with 11 additions and 1 deletions

View file

@ -5,7 +5,7 @@ strings - find printable strings in files
## Synopsis
```**sh
$ strings [--bytes NUMBER] [--print-file-name] [--radix FORMAT] [PATHS...]
$ strings [--bytes NUMBER] [--print-file-name] [-o] [--radix FORMAT] [PATHS...]
```
## Description
@ -16,6 +16,7 @@ $ strings [--bytes NUMBER] [--print-file-name] [--radix FORMAT] [PATHS...]
* `-n NUMBER`, `--bytes NUMBER`: Specify the minimum string length (4 is default).
* `-f`, `--print-file-name`: Print the name of the file before each string.
* `-o`: Equivalent to specifying `-t o`.
* `-t FORMAT`, `--radix FORMAT`: Write each string preceded by its byte offset from the start of the file in the specified `FORMAT`, where `FORMAT` matches one of the following: `d` (decimal), `o` (octal), or `x` (hexidecimal).
## Examples

View file

@ -118,6 +118,15 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
return true;
} });
args_parser.add_option({ Core::ArgsParser::OptionArgumentMode::None,
"Equivalent to specifying -t o.",
nullptr,
'o',
nullptr,
[&string_offset_format](auto) {
string_offset_format = StringOffsetFormat::Octal;
return true;
} });
args_parser.set_general_help("Write the sequences of printable characters in files or pipes to stdout.");
args_parser.add_positional_argument(paths, "File path", "path", Core::ArgsParser::Required::No);
args_parser.parse(arguments);