1
Fork 0
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:
Eli Youngs 2022-10-24 22:51:28 -07:00 committed by Sam Atkins
parent 956ef0c9fd
commit f05ec0da53

View file

@ -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;
}