mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:18:12 +00:00
LibCore: Replace the ArgsParser option argument setting with an enum
Replacement conditions for `requires_argument` have been chosen based on what would be most convenient for implementing an eventual optional argument mode.
This commit is contained in:
parent
810b9daa63
commit
3d51642037
15 changed files with 59 additions and 53 deletions
|
@ -55,7 +55,7 @@ int main(int argc, char** argv)
|
|||
args_parser.add_option(iterator_prototype_header_mode, "Generate the iterator prototype .h file", "iterator-prototype-header", 0);
|
||||
args_parser.add_option(iterator_prototype_implementation_mode, "Generate the iterator prototype .cpp file", "iterator-prototype-implementation", 0);
|
||||
args_parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "Add a header search path passed to the compiler",
|
||||
.long_name = "header-include-path",
|
||||
.short_name = 'i',
|
||||
|
|
|
@ -60,7 +60,7 @@ bool ArgsParser::parse(int argc, char* const* argv, FailureBehavior failure_beha
|
|||
if (opt.long_name) {
|
||||
option long_opt {
|
||||
opt.long_name,
|
||||
opt.requires_argument ? required_argument : no_argument,
|
||||
opt.argument_mode == OptionArgumentMode::Required ? required_argument : no_argument,
|
||||
&index_of_found_long_option,
|
||||
static_cast<int>(i)
|
||||
};
|
||||
|
@ -68,7 +68,7 @@ bool ArgsParser::parse(int argc, char* const* argv, FailureBehavior failure_beha
|
|||
}
|
||||
if (opt.short_name) {
|
||||
short_options_builder.append(opt.short_name);
|
||||
if (opt.requires_argument)
|
||||
if (opt.argument_mode != OptionArgumentMode::None)
|
||||
short_options_builder.append(':');
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ bool ArgsParser::parse(int argc, char* const* argv, FailureBehavior failure_beha
|
|||
}
|
||||
VERIFY(found_option);
|
||||
|
||||
char const* arg = found_option->requires_argument ? optarg : nullptr;
|
||||
char const* arg = found_option->argument_mode != OptionArgumentMode::None ? optarg : nullptr;
|
||||
if (!found_option->accept_value(arg)) {
|
||||
warnln("\033[31mInvalid value for option \033[1m{}\033[22m\033[0m", found_option->name_for_display());
|
||||
fail();
|
||||
|
@ -200,7 +200,7 @@ void ArgsParser::print_usage_terminal(FILE* file, char const* argv0)
|
|||
for (auto& opt : m_options) {
|
||||
if (opt.hide_mode != OptionHideMode::None)
|
||||
continue;
|
||||
if (opt.requires_argument)
|
||||
if (opt.argument_mode == OptionArgumentMode::Required)
|
||||
out(file, " [{} {}]", opt.name_for_display(), opt.value_name);
|
||||
else
|
||||
out(file, " [{}]", opt.name_for_display());
|
||||
|
@ -233,7 +233,7 @@ void ArgsParser::print_usage_terminal(FILE* file, char const* argv0)
|
|||
|
||||
auto print_argument = [&]() {
|
||||
if (opt.value_name) {
|
||||
if (opt.requires_argument)
|
||||
if (opt.argument_mode == OptionArgumentMode::Required)
|
||||
out(file, " {}", opt.value_name);
|
||||
}
|
||||
};
|
||||
|
@ -277,7 +277,7 @@ void ArgsParser::print_usage_markdown(FILE* file, char const* argv0)
|
|||
// FIXME: We allow opt.value_name to be empty even if the option
|
||||
// requires an argument. This should be disallowed as it will
|
||||
// currently display a blank name after the option.
|
||||
if (opt.requires_argument)
|
||||
if (opt.argument_mode == OptionArgumentMode::Required)
|
||||
out(file, " [{} {}]", opt.name_for_display(), opt.value_name ?: "");
|
||||
else
|
||||
out(file, " [{}]", opt.name_for_display());
|
||||
|
@ -320,7 +320,7 @@ void ArgsParser::print_usage_markdown(FILE* file, char const* argv0)
|
|||
|
||||
auto print_argument = [&]() {
|
||||
if (opt.value_name != nullptr) {
|
||||
if (opt.requires_argument)
|
||||
if (opt.argument_mode == OptionArgumentMode::Required)
|
||||
out(file, " {}", opt.value_name);
|
||||
}
|
||||
};
|
||||
|
@ -367,7 +367,7 @@ void ArgsParser::add_option(Option&& option)
|
|||
void ArgsParser::add_ignored(char const* long_name, char short_name, OptionHideMode hide_mode)
|
||||
{
|
||||
Option option {
|
||||
false,
|
||||
OptionArgumentMode::None,
|
||||
"Ignored",
|
||||
long_name,
|
||||
short_name,
|
||||
|
@ -383,7 +383,7 @@ void ArgsParser::add_ignored(char const* long_name, char short_name, OptionHideM
|
|||
void ArgsParser::add_option(bool& value, char const* help_string, char const* long_name, char short_name, OptionHideMode hide_mode)
|
||||
{
|
||||
Option option {
|
||||
false,
|
||||
OptionArgumentMode::None,
|
||||
help_string,
|
||||
long_name,
|
||||
short_name,
|
||||
|
@ -401,7 +401,7 @@ void ArgsParser::add_option(bool& value, char const* help_string, char const* lo
|
|||
void ArgsParser::add_option(char const*& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode)
|
||||
{
|
||||
Option option {
|
||||
true,
|
||||
OptionArgumentMode::Required,
|
||||
help_string,
|
||||
long_name,
|
||||
short_name,
|
||||
|
@ -418,7 +418,7 @@ void ArgsParser::add_option(char const*& value, char const* help_string, char co
|
|||
void ArgsParser::add_option(String& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode)
|
||||
{
|
||||
Option option {
|
||||
true,
|
||||
OptionArgumentMode::Required,
|
||||
help_string,
|
||||
long_name,
|
||||
short_name,
|
||||
|
@ -435,7 +435,7 @@ void ArgsParser::add_option(String& value, char const* help_string, char const*
|
|||
void ArgsParser::add_option(StringView& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode)
|
||||
{
|
||||
Option option {
|
||||
true,
|
||||
OptionArgumentMode::Required,
|
||||
help_string,
|
||||
long_name,
|
||||
short_name,
|
||||
|
@ -452,7 +452,7 @@ void ArgsParser::add_option(StringView& value, char const* help_string, char con
|
|||
void ArgsParser::add_option(int& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode)
|
||||
{
|
||||
Option option {
|
||||
true,
|
||||
OptionArgumentMode::Required,
|
||||
help_string,
|
||||
long_name,
|
||||
short_name,
|
||||
|
@ -470,7 +470,7 @@ void ArgsParser::add_option(int& value, char const* help_string, char const* lon
|
|||
void ArgsParser::add_option(unsigned& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode)
|
||||
{
|
||||
Option option {
|
||||
true,
|
||||
OptionArgumentMode::Required,
|
||||
help_string,
|
||||
long_name,
|
||||
short_name,
|
||||
|
@ -488,7 +488,7 @@ void ArgsParser::add_option(unsigned& value, char const* help_string, char const
|
|||
void ArgsParser::add_option(double& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode)
|
||||
{
|
||||
Option option {
|
||||
true,
|
||||
OptionArgumentMode::Required,
|
||||
help_string,
|
||||
long_name,
|
||||
short_name,
|
||||
|
@ -506,7 +506,7 @@ void ArgsParser::add_option(double& value, char const* help_string, char const*
|
|||
void ArgsParser::add_option(Optional<double>& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode)
|
||||
{
|
||||
Option option {
|
||||
true,
|
||||
OptionArgumentMode::Required,
|
||||
help_string,
|
||||
long_name,
|
||||
short_name,
|
||||
|
@ -523,7 +523,7 @@ void ArgsParser::add_option(Optional<double>& value, char const* help_string, ch
|
|||
void ArgsParser::add_option(Optional<size_t>& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode)
|
||||
{
|
||||
Option option {
|
||||
true,
|
||||
OptionArgumentMode::Required,
|
||||
help_string,
|
||||
long_name,
|
||||
short_name,
|
||||
|
@ -540,7 +540,7 @@ void ArgsParser::add_option(Optional<size_t>& value, char const* help_string, ch
|
|||
void ArgsParser::add_option(Vector<size_t>& values, char const* help_string, char const* long_name, char short_name, char const* value_name, char separator, OptionHideMode hide_mode)
|
||||
{
|
||||
Option option {
|
||||
true,
|
||||
OptionArgumentMode::Required,
|
||||
help_string,
|
||||
long_name,
|
||||
short_name,
|
||||
|
@ -754,7 +754,7 @@ void ArgsParser::autocomplete(FILE* file, StringView program_name, Span<char con
|
|||
if (it.is_end())
|
||||
continue;
|
||||
|
||||
if (it->requires_argument)
|
||||
if (it->argument_mode == OptionArgumentMode::Required)
|
||||
skip_next = true;
|
||||
continue;
|
||||
}
|
||||
|
@ -775,7 +775,7 @@ void ArgsParser::autocomplete(FILE* file, StringView program_name, Span<char con
|
|||
if (it.is_end())
|
||||
continue;
|
||||
|
||||
if (it->requires_argument)
|
||||
if (it->argument_mode == OptionArgumentMode::Required)
|
||||
skip_next = true;
|
||||
continue;
|
||||
}
|
||||
|
@ -791,7 +791,7 @@ void ArgsParser::autocomplete(FILE* file, StringView program_name, Span<char con
|
|||
object.set("static_offset", 0);
|
||||
object.set("invariant_offset", has_invariant ? option_to_complete.length() : 0u);
|
||||
object.set("display_trivia", option.help_string);
|
||||
object.set("trailing_trivia", option.requires_argument ? " " : "");
|
||||
object.set("trailing_trivia", option.argument_mode == OptionArgumentMode::Required ? " " : "");
|
||||
outln(file, "{}", object.to_string());
|
||||
};
|
||||
|
||||
|
|
|
@ -30,6 +30,11 @@ public:
|
|||
Ignore,
|
||||
};
|
||||
|
||||
enum class OptionArgumentMode {
|
||||
None,
|
||||
Required,
|
||||
};
|
||||
|
||||
/// When an option is hidden.
|
||||
/// If the hide mode is not None, then it's always hidden from the usage/synopsis.
|
||||
enum class OptionHideMode {
|
||||
|
@ -39,7 +44,7 @@ public:
|
|||
};
|
||||
|
||||
struct Option {
|
||||
bool requires_argument { true };
|
||||
OptionArgumentMode argument_mode { OptionArgumentMode::Required };
|
||||
char const* help_string { nullptr };
|
||||
char const* long_name { nullptr };
|
||||
char short_name { 0 };
|
||||
|
|
|
@ -95,7 +95,7 @@ int main(int argc, char** argv)
|
|||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(print_times, "Show duration of each test", "show-time", 't');
|
||||
args_parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "Show progress with OSC 9 (true, false)",
|
||||
.long_name = "show-progress",
|
||||
.short_name = 'p',
|
||||
|
|
|
@ -1288,7 +1288,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv)
|
|||
};
|
||||
|
||||
parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = false,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::None,
|
||||
.help_string = "Stop processing arguments after a non-argument parameter is seen",
|
||||
.long_name = "stop-on-first-non-option",
|
||||
.accept_value = [&](auto) {
|
||||
|
@ -1297,7 +1297,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv)
|
|||
},
|
||||
});
|
||||
parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "Set the general help string for the parser",
|
||||
.long_name = "general-help",
|
||||
.value_name = "string",
|
||||
|
@ -1307,7 +1307,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv)
|
|||
},
|
||||
});
|
||||
parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "Start describing an option",
|
||||
.long_name = "add-option",
|
||||
.value_name = "variable-name",
|
||||
|
@ -1326,7 +1326,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv)
|
|||
},
|
||||
});
|
||||
parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = false,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::None,
|
||||
.help_string = "Accept multiple of the current option being given",
|
||||
.long_name = "list",
|
||||
.accept_value = [&](auto) {
|
||||
|
@ -1339,7 +1339,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv)
|
|||
},
|
||||
});
|
||||
parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "Define the type of the option or argument being described",
|
||||
.long_name = "type",
|
||||
.value_name = "type",
|
||||
|
@ -1379,7 +1379,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv)
|
|||
},
|
||||
});
|
||||
parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "Set the help string of the option or argument being defined",
|
||||
.long_name = "help-string",
|
||||
.value_name = "string",
|
||||
|
@ -1396,7 +1396,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv)
|
|||
},
|
||||
});
|
||||
parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "Set the long name of the option being defined",
|
||||
.long_name = "long-name",
|
||||
.value_name = "name",
|
||||
|
@ -1415,7 +1415,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv)
|
|||
},
|
||||
});
|
||||
parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "Set the short name of the option being defined",
|
||||
.long_name = "short-name",
|
||||
.value_name = "char",
|
||||
|
@ -1438,7 +1438,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv)
|
|||
},
|
||||
});
|
||||
parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "Set the value name of the option being defined",
|
||||
.long_name = "value-name",
|
||||
.value_name = "string",
|
||||
|
@ -1473,7 +1473,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv)
|
|||
},
|
||||
});
|
||||
parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "Start describing a positional argument",
|
||||
.long_name = "add-positional-argument",
|
||||
.value_name = "variable",
|
||||
|
@ -1492,7 +1492,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv)
|
|||
},
|
||||
});
|
||||
parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "Set the minimum required number of positional arguments for the argument being described",
|
||||
.long_name = "min",
|
||||
.value_name = "n",
|
||||
|
@ -1520,7 +1520,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv)
|
|||
},
|
||||
});
|
||||
parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "Set the maximum required number of positional arguments for the argument being described",
|
||||
.long_name = "max",
|
||||
.value_name = "n",
|
||||
|
@ -1548,7 +1548,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv)
|
|||
},
|
||||
});
|
||||
parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = false,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::None,
|
||||
.help_string = "Mark the positional argument being described as required (shorthand for --min 1)",
|
||||
.long_name = "required",
|
||||
.accept_value = [&](auto) {
|
||||
|
|
|
@ -59,7 +59,7 @@ ErrorOr<void> parse_args(Main::Arguments arguments, Vector<String>& files, DuOpt
|
|||
Vector<StringView> files_to_process;
|
||||
|
||||
Core::ArgsParser::Option time_option {
|
||||
true,
|
||||
Core::ArgsParser::OptionArgumentMode::Required,
|
||||
"Show time of type time-type of any file in the directory, or any of its subdirectories. "
|
||||
"Available choices: mtime, modification, ctime, status, use, atime, access",
|
||||
"time",
|
||||
|
|
|
@ -59,7 +59,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
args_parser.add_option(recursive, "Recursively scan files", "recursive", 'r');
|
||||
args_parser.add_option(use_ere, "Extended regular expressions", "extended-regexp", 'E');
|
||||
args_parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "Pattern",
|
||||
.long_name = "regexp",
|
||||
.short_name = 'e',
|
||||
|
@ -75,7 +75,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
args_parser.add_option(quiet_mode, "Do not write anything to standard output", "quiet", 'q');
|
||||
args_parser.add_option(suppress_errors, "Suppress error messages for nonexistent or unreadable files", "no-messages", 's');
|
||||
args_parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "Action to take for binary files ([binary], text, skip)",
|
||||
.long_name = "binary-mode",
|
||||
.accept_value = [&](auto* str) {
|
||||
|
@ -91,7 +91,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
},
|
||||
});
|
||||
args_parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = false,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::None,
|
||||
.help_string = "Treat binary files as text (same as --binary-mode text)",
|
||||
.long_name = "text",
|
||||
.short_name = 'a',
|
||||
|
@ -101,7 +101,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
},
|
||||
});
|
||||
args_parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = false,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::None,
|
||||
.help_string = "Ignore binary files (same as --binary-mode skip)",
|
||||
.long_name = nullptr,
|
||||
.short_name = 'I',
|
||||
|
@ -111,7 +111,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
},
|
||||
});
|
||||
args_parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "When to use colored output for the matching text ([auto], never, always)",
|
||||
.long_name = "color",
|
||||
.short_name = 0,
|
||||
|
|
|
@ -30,7 +30,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
Core::ArgsParser args_parser;
|
||||
|
||||
Core::ArgsParser::Option number_style_option {
|
||||
true,
|
||||
Core::ArgsParser::OptionArgumentMode::Required,
|
||||
"Line numbering style: 't' for non-empty lines, 'a' for all lines, 'n' for no lines",
|
||||
"body-numbering",
|
||||
'b',
|
||||
|
|
|
@ -164,7 +164,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_option(data, "(HTTP only) Send the provided data via an HTTP POST request", "data", 'd', "data");
|
||||
args_parser.add_option(should_follow_url, "(HTTP only) Follow the Location header if a 3xx status is encountered", "follow", 'l');
|
||||
args_parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "Add a header entry to the request",
|
||||
.long_name = "header",
|
||||
.short_name = 'H',
|
||||
|
|
|
@ -35,7 +35,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_option(wait, "Enable profiling and wait for user input to disable.", nullptr, 'w');
|
||||
args_parser.add_option(cmd_argument, "Command", nullptr, 'c', "command");
|
||||
args_parser.add_option(Core::ArgsParser::Option {
|
||||
true, "Enable tracking specific event type", nullptr, 't', "event_type",
|
||||
Core::ArgsParser::OptionArgumentMode::Required,
|
||||
"Enable tracking specific event type", nullptr, 't', "event_type",
|
||||
[&](String event_type) {
|
||||
seen_event_type_arg = true;
|
||||
if (event_type == "sample")
|
||||
|
|
|
@ -322,7 +322,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "Show progress with OSC 9 (true, false)",
|
||||
.long_name = "show-progress",
|
||||
.short_name = 'p',
|
||||
|
|
|
@ -20,7 +20,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
parser.add_option(permissions, "Apply these permissions going forward", "permissions", 'p', "unveil-permissions");
|
||||
parser.add_option(should_sleep, "Sleep after processing all arguments", "sleep", 's');
|
||||
parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "Add a path to the unveil list",
|
||||
.long_name = "unveil",
|
||||
.short_name = 'u',
|
||||
|
@ -37,7 +37,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return true;
|
||||
} });
|
||||
parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = false,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::None,
|
||||
.help_string = "Lock the veil",
|
||||
.long_name = "lock",
|
||||
.short_name = 'l',
|
||||
|
|
|
@ -138,7 +138,7 @@ static struct winsize g_window_size;
|
|||
static void parse_args(Main::Arguments arguments, TopOption& top_option)
|
||||
{
|
||||
Core::ArgsParser::Option sort_by_option {
|
||||
true,
|
||||
Core::ArgsParser::OptionArgumentMode::Required,
|
||||
"Sort by field [pid, tid, pri, user, state, virt, phys, cpu, name]",
|
||||
"sort-by",
|
||||
's',
|
||||
|
|
|
@ -288,7 +288,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
parser.add_option(export_all_imports, "Export noop functions corresponding to imports", "export-noop", 0);
|
||||
parser.add_option(shell_mode, "Launch a REPL in the module's context (implies -i)", "shell", 's');
|
||||
parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "Extra modules to link with, use to resolve imports",
|
||||
.long_name = "link",
|
||||
.short_name = 'l',
|
||||
|
@ -302,7 +302,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
},
|
||||
});
|
||||
parser.add_option(Core::ArgsParser::Option {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "Supply arguments to the function (default=0) (expects u64, casts to required type)",
|
||||
.long_name = "arg",
|
||||
.short_name = 0,
|
||||
|
|
|
@ -121,7 +121,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_option(flag_noheader, "Turn off the header describing the command and interval", "no-title", 't');
|
||||
args_parser.add_option(flag_beep_on_fail, "Beep if the command has a non-zero exit code", "beep", 'b');
|
||||
Core::ArgsParser::Option file_arg {
|
||||
.requires_argument = true,
|
||||
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
|
||||
.help_string = "Run command whenever this file changes. Can be used multiple times.",
|
||||
.long_name = "file",
|
||||
.short_name = 'f',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue