]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[parseopt] Refer to online documentation for command help
authorMichael Brown <mcb30@ipxe.org>
Fri, 4 Mar 2011 12:14:51 +0000 (12:14 +0000)
committerMichael Brown <mcb30@ipxe.org>
Fri, 4 Mar 2011 12:18:51 +0000 (12:18 +0000)
The online documentation (e.g. http://ipxe.org/cmd/ifopen), though not
yet complete, is far more comprehensive than could be provided within
the iPXE binary.  Save around 200 bytes (compressed) by removing the
command descriptions from the interactive help, and instead referring
users directly to the web page describing the relevant command.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
23 files changed:
src/arch/i386/hci/commands/pxe_cmd.c
src/arch/i386/hci/commands/reboot_cmd.c
src/core/exec.c
src/core/parseopt.c
src/hci/commands/autoboot_cmd.c
src/hci/commands/config_cmd.c
src/hci/commands/dhcp_cmd.c
src/hci/commands/digest_cmd.c
src/hci/commands/fcmgmt_cmd.c
src/hci/commands/gdbstub_cmd.c
src/hci/commands/ifmgmt_cmd.c
src/hci/commands/image_cmd.c
src/hci/commands/iwmgmt_cmd.c
src/hci/commands/login_cmd.c
src/hci/commands/lotest_cmd.c
src/hci/commands/nvo_cmd.c
src/hci/commands/route_cmd.c
src/hci/commands/sanboot_cmd.c
src/hci/commands/time_cmd.c
src/hci/commands/vlan_cmd.c
src/hci/shell.c
src/image/script.c
src/include/ipxe/parseopt.h

index 8d572117b20a6a510bb2adc44ccb09dedb94a8be..79585cde82307773c951a26b7788d483d0beeb68 100644 (file)
@@ -33,7 +33,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 /** "startpxe" command descriptor */
 static struct command_descriptor startpxe_cmd =
        COMMAND_DESC ( struct ifcommon_options, ifcommon_opts, 0, MAX_ARGUMENTS,
-                      "[<interface>]", "" );
+                      "[<interface>]" );
 
 /**
  * "startpxe" payload
@@ -68,8 +68,7 @@ static struct option_descriptor stoppxe_opts[] = {};
 
 /** "stoppxe" command descriptor */
 static struct command_descriptor stoppxe_cmd =
-       COMMAND_DESC ( struct stoppxe_options, stoppxe_opts, 0, 0,
-                      "", "" );
+       COMMAND_DESC ( struct stoppxe_options, stoppxe_opts, 0, 0, "" );
 
 /**
  * The "stoppxe" command
index 39e05af54bde007ecb79d3b6d7460a0301376a42..d6a1d9a36fb00d5d0afd9947e39444286b72c2ea 100644 (file)
@@ -36,7 +36,7 @@ static struct option_descriptor reboot_opts[] = {};
 
 /** "reboot" command descriptor */
 static struct command_descriptor reboot_cmd =
-       COMMAND_DESC ( struct reboot_options, reboot_opts, 0, 0, "", "" );
+       COMMAND_DESC ( struct reboot_options, reboot_opts, 0, 0, "" );
 
 /**
  * The "reboot" command
index 57b2df581f722cb6d5254076e72042e54da53bb8..e6f204879b5c9aa42850b8780514bd9eb03043d1 100644 (file)
@@ -298,8 +298,7 @@ static struct option_descriptor exit_opts[] = {};
 
 /** "exit" command descriptor */
 static struct command_descriptor exit_cmd =
-       COMMAND_DESC ( struct exit_options, exit_opts, 0, 1,
-                      "[<status>]", "" );
+       COMMAND_DESC ( struct exit_options, exit_opts, 0, 1, "[<status>]" );
 
 /**
  * "exit" command
@@ -344,7 +343,7 @@ static struct option_descriptor isset_opts[] = {};
 /** "isset" command descriptor */
 static struct command_descriptor isset_cmd =
        COMMAND_DESC ( struct isset_options, isset_opts, 0, MAX_ARGUMENTS,
-                      "[...]", "" );
+                      "[...]" );
 
 /**
  * "isset" command
index f0a3e70087b3c8fea82bccfa3a1b904520c00037..451ebaf5401f10443fdaf83c3f43dd0212821d24 100644 (file)
@@ -132,7 +132,8 @@ int parse_image ( const char *text, struct image **image ) {
  * @v argv             Argument list
  */
 void print_usage ( struct command_descriptor *cmd, char **argv ) {
-       printf ( "Usage:\n\n  %s %s\n", argv[0], cmd->usage_description );
+       printf ( "Usage:\n\n  %s %s\n\nSee http://ipxe.org/cmd/%s for further "
+                "information\n", argv[0], cmd->usage, argv[0] );
 }
 
 /**
index 6fd34b3a54336dee3b9ae2b811a698d3cade38c4..0917f6fa1a398021f033606c0b0e0fb3e061b03d 100644 (file)
@@ -35,7 +35,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 /** "autoboot" command descriptor */
 static struct command_descriptor autoboot_cmd =
        COMMAND_DESC ( struct ifcommon_options, ifcommon_opts, 0, MAX_ARGUMENTS,
-                      "[<interface>...]", "Attempt to boot the system" );
+                      "[<interface>...]" );
 
 /**
  * "autoboot" command
index 84c2e32adfae1a3f8a057f0f52e83c7487a1596a..e447d6af3b8a21c656c873e4b56ac30d0b279e05 100644 (file)
@@ -41,9 +41,7 @@ static struct option_descriptor config_opts[] = {};
 
 /** "config" command descriptor */
 static struct command_descriptor config_cmd =
-       COMMAND_DESC ( struct config_options, config_opts, 0, 1,
-                      "[<scope>]",
-                      "Open the option configuration console" );
+       COMMAND_DESC ( struct config_options, config_opts, 0, 1, "[<scope>]" );
 
 /**
  * Parse settings scope name
index fba89772c0fa8debcb3b875bf5ede77c152ca50b..acf3cfdaad655426ed0536282c388341a7e272ef 100644 (file)
@@ -43,8 +43,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 /** "dhcp" command descriptor */
 static struct command_descriptor dhcp_cmd =
        COMMAND_DESC ( struct ifcommon_options, ifcommon_opts, 0, MAX_ARGUMENTS,
-                      "[<interface>] [<interface>...]",
-                      "Configure network interface(s) using DHCP" );
+                      "[<interface>...]" );
 
 /**
  * Execute "dhcp" command for a network device
@@ -88,8 +87,7 @@ static struct option_descriptor pxebs_opts[] = {};
 /** "pxebs" command descriptor */
 static struct command_descriptor pxebs_cmd =
        COMMAND_DESC ( struct pxebs_options, pxebs_opts, 2, 2,
-                      "<interface> <server_type>",
-                      "Perform PXE Boot Server discovery" );
+                      "<interface> <server type>" );
 
 /**
  * The "pxebs" command
index d40e8e7d937e4ef3eb6044a49a5886a7f7bf6837..6ca12eff16e2908a9306268be5f3c94eaac0f50c 100644 (file)
@@ -44,8 +44,7 @@ static struct option_descriptor digest_opts[] = {};
 /** "digest" command descriptor */
 static struct command_descriptor digest_cmd =
        COMMAND_DESC ( struct digest_options, digest_opts, 1, MAX_ARGUMENTS,
-                      "<image> [<image>...]",
-                      "Calculate the digest of an image" );
+                      "<image> [<image>...]" );
 
 /**
  * The "digest" command
index c76554f68c14f4800948e77b89b92f40b4541185..a2b818ec336cee490a3aca1904f861505aa0c4f4 100644 (file)
@@ -106,8 +106,7 @@ static struct option_descriptor fcstat_opts[] = {};
 
 /** "fcstat" command descriptor */
 static struct command_descriptor fcstat_cmd =
-       COMMAND_DESC ( struct fcstat_options, fcstat_opts, 0, 0,
-                      "", "" );
+       COMMAND_DESC ( struct fcstat_options, fcstat_opts, 0, 0, "" );
 
 /**
  * The "fcstat" command
@@ -153,7 +152,7 @@ static struct option_descriptor fcels_opts[] = {
 /** "fcels" command descriptor */
 static struct command_descriptor fcels_cmd =
        COMMAND_DESC ( struct fcels_options, fcels_opts, 1, 1,
-                      "[--port <port>] [--id <peer_port_id>] <command>", "" );
+                      "[--port <port>] [--id <peer port id>] <request>" );
 
 /**
  * The "fcels" command
index b0e3ade81fd593c868b2483e24feec56b7641c94..f35f0140b6252c4d4c9acd7a768a5d6332956797 100644 (file)
@@ -65,12 +65,7 @@ static struct option_descriptor gdbstub_opts[] = {};
 /** "gdbstub" command descriptor */
 static struct command_descriptor gdbstub_cmd =
        COMMAND_DESC ( struct gdbstub_options, gdbstub_opts, 1, MAX_ARGUMENTS,
-                      "<transport> [<options>...]",
-                      "Start remote debugging using one of the following "
-                      "transports:\n"
-                      "  serial           use serial port (if compiled in)\n"
-                      "  udp <interface>  use UDP over network interface "
-                      "(if compiled in)" );
+                      "<transport> [<options>...]" );
 
 /**
  * The "gdbstub" command
index 9724f7902d4734cb88d8ae6227ae214b7ab1352e..29691d4efa050efb8f5e35330932a7de4be67add 100644 (file)
@@ -87,8 +87,7 @@ int ifcommon_exec ( int argc, char **argv,
 /** "ifopen" command descriptor */
 static struct command_descriptor ifopen_cmd =
        COMMAND_DESC ( struct ifcommon_options, ifcommon_opts, 0, MAX_ARGUMENTS,
-                      "[<interface>...]",
-                      "Open network interface(s)" );
+                      "[<interface>...]" );
 
 /**
  * "ifopen" payload
@@ -114,8 +113,7 @@ static int ifopen_exec ( int argc, char **argv ) {
 /** "ifclose" command descriptor */
 static struct command_descriptor ifclose_cmd =
        COMMAND_DESC ( struct ifcommon_options, ifcommon_opts, 0, MAX_ARGUMENTS,
-                      "[<interface>...]",
-                      "Close network interface(s)" );
+                      "[<interface>...]" );
 
 /**
  * "ifclose" payload
@@ -142,8 +140,7 @@ static int ifclose_exec ( int argc, char **argv ) {
 /** "ifstat" command descriptor */
 static struct command_descriptor ifstat_cmd =
        COMMAND_DESC ( struct ifcommon_options, ifcommon_opts, 0, MAX_ARGUMENTS,
-                      "[<interface>...]",
-                      "Show network interface(s)" );
+                      "[<interface>...]" );
 
 /**
  * "ifstat" payload
index 66002226f112d8b44118ca264cd35befcc81457c..a008baa66cd89c453d3731a81d4c0c8ffadba99d 100644 (file)
@@ -84,20 +84,17 @@ static struct option_descriptor imgfetch_opts[] = {
 /** "imgfetch" command descriptor */
 static struct command_descriptor imgfetch_cmd =
        COMMAND_DESC ( struct imgfetch_options, imgfetch_opts, 1, MAX_ARGUMENTS,
-                      "[--name <name>] <image_url> [<arguments>...]",
-                      "Fetch image" );
+                      "[--name <name>] <uri> [<arguments>...]" );
 
 /** "kernel" command descriptor */
 static struct command_descriptor kernel_cmd =
        COMMAND_DESC ( struct imgfetch_options, imgfetch_opts, 1, MAX_ARGUMENTS,
-                      "[--name <name>] <image_url> [<arguments>...]",
-                      "Fetch and load image" );
+                      "[--name <name>] <uri> [<arguments>...]" );
 
 /** "chain" command descriptor */
 static struct command_descriptor chain_cmd =
        COMMAND_DESC ( struct imgfetch_options, imgfetch_opts, 1, MAX_ARGUMENTS,
-                      "[--name <name>] <image_url> [<arguments>...]",
-                      "Fetch and execute image" );
+                      "[--name <name>] <uri> [<arguments>...]" );
 
 /**
  * The "imgfetch" and friends command body
@@ -200,8 +197,7 @@ static struct option_descriptor imgload_opts[] = {};
 
 /** "imgload" command descriptor */
 static struct command_descriptor imgload_cmd =
-       COMMAND_DESC ( struct imgload_options, imgload_opts, 1, 1,
-                      "<image>", "Load image" );
+       COMMAND_DESC ( struct imgload_options, imgload_opts, 1, 1, "<image>" );
 
 /**
  * The "imgload" command
@@ -242,8 +238,7 @@ static struct option_descriptor imgargs_opts[] = {};
 /** "imgargs" command descriptor */
 static struct command_descriptor imgargs_cmd =
        COMMAND_DESC ( struct imgargs_options, imgargs_opts, 1, MAX_ARGUMENTS,
-                      "<image> [<arguments>...]",
-                      "Set arguments for image" );
+                      "<image> [<arguments>...]" );
 
 /**
  * The "imgargs" command body
@@ -282,7 +277,7 @@ static struct option_descriptor imgexec_opts[] = {};
 /** "imgexec" command descriptor */
 static struct command_descriptor imgexec_cmd =
        COMMAND_DESC ( struct imgexec_options, imgexec_opts, 0, 1,
-                      "[<image>]", "Execute image" );
+                      "[<image>]" );
 
 /**
  * The "imgexec" command
@@ -330,8 +325,7 @@ static struct option_descriptor imgstat_opts[] = {};
 
 /** "imgstat" command descriptor */
 static struct command_descriptor imgstat_cmd =
-       COMMAND_DESC ( struct imgstat_options, imgstat_opts, 0, 0,
-                      "", "List images" );
+       COMMAND_DESC ( struct imgstat_options, imgstat_opts, 0, 0, "" );
 
 /**
  * The "imgstat" command
@@ -366,7 +360,7 @@ static struct option_descriptor imgfree_opts[] = {};
 /** "imgfree" command descriptor */
 static struct command_descriptor imgfree_cmd =
        COMMAND_DESC ( struct imgfree_options, imgfree_opts, 0, 1,
-                      "[<image>]", "Free image(s)" );
+                      "[<image>]" );
 
 /**
  * The "imgfree" command
index 3922141b4cda40d60f73e77433703ad087c4c5d6..00a8360db9c0a83b3ad119cb8fa694f2045942aa 100644 (file)
@@ -34,8 +34,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 /** "iwstat" command descriptor */
 static struct command_descriptor iwstat_cmd =
        COMMAND_DESC ( struct ifcommon_options, ifcommon_opts, 0, MAX_ARGUMENTS,
-                      "[<interface>...]",
-                      "Show wireless interface(s)" );
+                      "[<interface>...]" );
 
 /**
  * "iwstat" payload
@@ -66,8 +65,7 @@ static int iwstat_exec ( int argc, char **argv ) {
 /** "iwlist" command descriptor */
 static struct command_descriptor iwlist_cmd =
        COMMAND_DESC ( struct ifcommon_options, ifcommon_opts, 0, MAX_ARGUMENTS,
-                      "[<interface>...]",
-                      "List wireless networks" );
+                      "[<interface>...]" );
 
 /**
  * "iwlist" payload
index ab1739371b27962accef1c62c13ad79251c100a9..3286932d00e57f9d5d15ea1f9fe81ed58ce81ceb 100644 (file)
@@ -38,8 +38,7 @@ static struct option_descriptor login_opts[] = {};
 
 /** "login" command descriptor */
 static struct command_descriptor login_cmd =
-       COMMAND_DESC ( struct login_options, login_opts, 0, 0,
-                      "", "Prompt for login credentials" );
+       COMMAND_DESC ( struct login_options, login_opts, 0, 0, "" );
 
 /**
  * "login" command
index 73cefcaa097bcd0eef20d34a380fa6fec07d8436..172be2d8ce77d1906dd76d42c3b62a67c6b41d3a 100644 (file)
@@ -49,8 +49,8 @@ static struct option_descriptor lotest_opts[] = {
 /** "lotest" command descriptor */
 static struct command_descriptor lotest_cmd =
        COMMAND_DESC ( struct lotest_options, lotest_opts, 2, 2,
-                      "[--mtu <mtu>] <sending_interface> "
-                      "<receiving_interface>", "" );
+                      "[--mtu <mtu>] <sending interface> "
+                      "<receiving interface>" );
 
 /**
  * "lotest" command
index 3513c8debedce5f78fe6f55f90956d26b9c1233f..d8621abc607d2f02f5916241b3ca1cee603dbccd 100644 (file)
@@ -42,8 +42,7 @@ static struct option_descriptor show_opts[] = {};
 
 /** "show" command descriptor */
 static struct command_descriptor show_cmd =
-       COMMAND_DESC ( struct show_options, show_opts, 1, 1,
-                      "<setting>", "" );
+       COMMAND_DESC ( struct show_options, show_opts, 1, 1, "<setting>" );
 
 /**
  * "show" command
@@ -88,7 +87,7 @@ static struct option_descriptor set_opts[] = {};
 /** "set" command descriptor */
 static struct command_descriptor set_cmd =
        COMMAND_DESC ( struct set_options, set_opts, 1, MAX_ARGUMENTS,
-                      "<setting> <value>", "" );
+                      "<setting> <value>" );
 
 /**
  * "set" command
@@ -146,8 +145,7 @@ static struct option_descriptor clear_opts[] = {};
 
 /** "clear" command descriptor */
 static struct command_descriptor clear_cmd =
-       COMMAND_DESC ( struct clear_options, clear_opts, 1, 1,
-                      "<setting>", "" );
+       COMMAND_DESC ( struct clear_options, clear_opts, 1, 1, "<setting>" );
 
 /**
  * "clear" command
index a4f5f91d3c7e7d9ed775d6f3dd2f82b0eed3cad6..f839d53f438e566cabf525a5b9087c3fdef3f335 100644 (file)
@@ -38,8 +38,7 @@ static struct option_descriptor route_opts[] = {};
 
 /** "route" command descriptor */
 static struct command_descriptor route_cmd =
-       COMMAND_DESC ( struct route_options, route_opts, 0, 0,
-                      "", "Display the routing table" );
+       COMMAND_DESC ( struct route_options, route_opts, 0, 0, "" );
 
 /**
  * The "route" command
index 61bc5463eeb7d39270bf83c6e37f32964fc1ff18..198a7322d78d21c2c83aadbc55979131cb38c094 100644 (file)
@@ -42,7 +42,7 @@ static struct option_descriptor sanboot_opts[] = {};
 /** "sanboot" command descriptor */
 static struct command_descriptor sanboot_cmd =
        COMMAND_DESC ( struct sanboot_options, sanboot_opts, 1, 1,
-                      "<root-path>", "Boot from SAN target" );
+                      "<root-path>" );
 
 /**
  * The "sanboot" command
index b8af15ff58294a2ddfbc2801febac0b25a9188f4..1dd175783c05f52309209c05785f6830c469dd96 100644 (file)
@@ -45,7 +45,7 @@ static struct option_descriptor time_opts[] = {};
 /** "time" command descriptor */
 static struct command_descriptor time_cmd =
        COMMAND_DESC ( struct time_options, time_opts, 1, MAX_ARGUMENTS,
-                      "<command>", "Time a command" );
+                      "<command>" );
 
 /**
  * "time" command
@@ -87,8 +87,7 @@ static struct option_descriptor sleep_opts[] = {};
 
 /** "sleep" command descriptor */
 static struct command_descriptor sleep_cmd =
-       COMMAND_DESC ( struct sleep_options, sleep_opts, 1, 1,
-                      "<seconds>", "Sleep for <seconds> seconds" );
+       COMMAND_DESC ( struct sleep_options, sleep_opts, 1, 1, "<seconds>" );
 
 /**
  * "sleep" command
index 38a6bab7a007778c41fa2788e5624bdf4b78acfd..28638ae6a3b7c747ef7918c6dc74ca9c642234cc 100644 (file)
@@ -53,8 +53,7 @@ static struct option_descriptor vcreate_opts[] = {
 static struct command_descriptor vcreate_cmd =
        COMMAND_DESC ( struct vcreate_options, vcreate_opts, 1, 1,
                       "--tag <tag> [--priority <priority>] "
-                      "<trunk interface>",
-                      "Create a VLAN interface" );
+                      "<trunk interface>" );
 
 /**
  * "vcreate" command
@@ -95,8 +94,7 @@ static struct option_descriptor vdestroy_opts[] = {};
 /** "vdestroy" command descriptor */
 static struct command_descriptor vdestroy_cmd =
        COMMAND_DESC ( struct vdestroy_options, vdestroy_opts, 1, 1,
-                      "<VLAN interface>",
-                      "Destroy a VLAN interface" );
+                      "<VLAN interface>" );
 
 /**
  * "vdestroy" command
index 3860b2e406bdbbae88b100fa134766def4cbf296..f8b1ec278c0db3f4d871f8b029782acb81dbbcc8 100644 (file)
@@ -97,8 +97,7 @@ static struct option_descriptor shell_opts[] = {};
 
 /** "shell" command descriptor */
 static struct command_descriptor shell_cmd =
-       COMMAND_DESC ( struct shell_options, shell_opts, 0, 0,
-                      "", "" );
+       COMMAND_DESC ( struct shell_options, shell_opts, 0, 0, "" );
 
 /**
  * "shell" command
index 044bb0161cc48d51cc7432343157ebf5e65c9e86..b05abf942da37113775c46c4974e306239f13ce9 100644 (file)
@@ -218,8 +218,7 @@ static struct option_descriptor goto_opts[] = {};
 
 /** "goto" command descriptor */
 static struct command_descriptor goto_cmd =
-       COMMAND_DESC ( struct goto_options, goto_opts, 1, 1,
-                      "<label>", "" );
+       COMMAND_DESC ( struct goto_options, goto_opts, 1, 1, "<label>" );
 
 /**
  * Current "goto" label
index f949b4cc7c67dce263874295ba47e6ee58cffa95..4cad3cca62a200d6bfa40b70c66f2b6c685f5afd 100644 (file)
@@ -81,12 +81,12 @@ struct command_descriptor {
        uint8_t min_args;
        /** Maximum number of non-option arguments */
        uint8_t max_args;
-       /** Command usage and description
+       /** Command usage
         *
         * This excludes the literal "Usage:" and the command name,
         * which will be prepended automatically.
         */
-       const char *usage_description;
+       const char *usage;
 };
 
 /** No maximum number of arguments */
@@ -99,11 +99,9 @@ struct command_descriptor {
  * @v _options         Option descriptor array
  * @v _check_args      Remaining argument checker
  * @v _usage           Command usage
- * @v _description     Command description
  * @ret _command       Command descriptor
  */
-#define COMMAND_DESC( _struct, _options, _min_args, _max_args, _usage,       \
-                     _description )                                          \
+#define COMMAND_DESC( _struct, _options, _min_args, _max_args, _usage )              \
        {                                                                     \
                .options = ( ( ( ( typeof ( _options[0] ) * ) NULL ) ==       \
                               ( ( struct option_descriptor * ) NULL ) ) ?    \
@@ -113,7 +111,7 @@ struct command_descriptor {
                .len = sizeof ( _struct ),                                    \
                .min_args = _min_args,                                        \
                .max_args = _max_args,                                        \
-               .usage_description = _usage "\n\n" _description,              \
+               .usage = _usage,                                              \
         }
 
 extern int parse_string ( const char *text, const char **value );