mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:24:57 +00:00
seq: Add the --terminator option
This commit is contained in:
parent
956ef0c9fd
commit
f05ec0da53
1 changed files with 5 additions and 0 deletions
|
@ -50,10 +50,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
StringView separator = "\n"sv;
|
||||
StringView terminator = ""sv;
|
||||
Vector<char const*> parameters;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(separator, "Characters to print after each number (default: \\n)", "separator", 's', "separator");
|
||||
args_parser.add_option(terminator, "Characters to print at the end of the sequence", "terminator", 't', "terminator");
|
||||
args_parser.add_positional_argument(parameters, "1 to 3 parameters, interpreted as LAST, FIRST LAST, or FIRST INCREMENT LAST", "parameters");
|
||||
args_parser.parse(arguments);
|
||||
|
||||
|
@ -105,5 +107,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
d += step;
|
||||
}
|
||||
|
||||
if (!terminator.is_empty())
|
||||
out(terminator);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue