Modify command options to use the new arguments mechanism. Now all command option
arguments are specified in a standardized way, will have a standardized name, and
have functioning help.
The next step is to start writing useful help for all the argument types.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115335 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Interpreter/Options.cpp b/source/Interpreter/Options.cpp
index 0ab6bdf..fcf048b 100644
--- a/source/Interpreter/Options.cpp
+++ b/source/Interpreter/Options.cpp
@@ -484,20 +484,21 @@
if (full_options_table[i].usage_mask & opt_set_mask)
{
// Add current option to the end of out_stream.
-
+ CommandArgumentType arg_type = full_options_table[i].argument_type;
+
if (full_options_table[i].required)
{
if (full_options_table[i].option_has_arg == required_argument)
{
- strm.Printf (" -%c %s",
- full_options_table[i].short_option,
- full_options_table[i].argument_name);
+ strm.Printf (" -%c <%s>",
+ full_options_table[i].short_option,
+ CommandObject::GetArgumentName (arg_type));
}
else if (full_options_table[i].option_has_arg == optional_argument)
{
- strm.Printf (" -%c [%s]",
+ strm.Printf (" -%c [<%s>]",
full_options_table[i].short_option,
- full_options_table[i].argument_name);
+ CommandObject::GetArgumentName (arg_type));
}
}
}
@@ -511,14 +512,16 @@
{
// Add current option to the end of out_stream.
+ CommandArgumentType arg_type = full_options_table[i].argument_type;
+
if (! full_options_table[i].required)
{
if (full_options_table[i].option_has_arg == required_argument)
- strm.Printf (" [-%c %s]", full_options_table[i].short_option,
- full_options_table[i].argument_name);
+ strm.Printf (" [-%c <%s>]", full_options_table[i].short_option,
+ CommandObject::GetArgumentName (arg_type));
else if (full_options_table[i].option_has_arg == optional_argument)
- strm.Printf (" [-%c [%s]]", full_options_table[i].short_option,
- full_options_table[i].argument_name);
+ strm.Printf (" [-%c [<%s>]]", full_options_table[i].short_option,
+ CommandObject::GetArgumentName (arg_type));
}
}
}
@@ -578,13 +581,18 @@
else
strm.EOL();
+ CommandArgumentType arg_type = full_options_table[i].argument_type;
+
+ StreamString arg_name_str;
+ arg_name_str.Printf ("<%s>", CommandObject::GetArgumentName (arg_type));
+
strm.Indent ();
strm.Printf ("-%c", full_options_table[i].short_option);
- if (full_options_table[i].argument_name != NULL)
- strm.Printf (" %s", full_options_table[i].argument_name);
+ if (arg_type != eArgTypeNone)
+ strm.Printf (" <%s>", CommandObject::GetArgumentName (arg_type));
strm.Printf (" ( --%s", full_options_table[i].long_option);
- if (full_options_table[i].argument_name != NULL)
- strm.Printf (" %s", full_options_table[i].argument_name);
+ if (arg_type != eArgTypeNone)
+ strm.Printf (" <%s>", CommandObject::GetArgumentName (arg_type));
strm.PutCString(" )\n");
strm.IndentMore (5);