[cmdline] Show commands in alphabetical order

Commands were originally ordered by functional group (e.g. keeping the
image management commands together), with arrays used to impose a
functionally meaningful order within the group.

As the number of commands and functional groups has expanded over the
years, this has become essentially useless as an organising principle.
Switch to sorting commands alphabetically (using the linker table
mechanism).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-08-06 16:29:32 +01:00
parent 332241238e
commit 9d4a2ee353
49 changed files with 104 additions and 423 deletions

View File

@@ -95,7 +95,4 @@ static int cpuid_exec ( int argc, char **argv ) {
}
/** x86 CPU feature detection command */
struct command cpuid_command __command = {
.name = "cpuid",
.exec = cpuid_exec,
};
COMMAND ( cpuid, cpuid_exec );

View File

@@ -105,13 +105,5 @@ static int stoppxe_exec ( int argc __unused, char **argv __unused ) {
}
/** PXE commands */
struct command pxe_commands[] __command = {
{
.name = "startpxe",
.exec = startpxe_exec,
},
{
.name = "stoppxe",
.exec = stoppxe_exec,
},
};
COMMAND ( startpxe, startpxe_exec );
COMMAND ( stoppxe, stoppxe_exec );

View File

@@ -428,10 +428,7 @@ static int echo_exec ( int argc, char **argv ) {
}
/** "echo" command */
struct command echo_command __command = {
.name = "echo",
.exec = echo_exec,
};
COMMAND ( echo, echo_exec );
/** "exit" options */
struct exit_options {};
@@ -472,10 +469,7 @@ static int exit_exec ( int argc, char **argv ) {
}
/** "exit" command */
struct command exit_command __command = {
.name = "exit",
.exec = exit_exec,
};
COMMAND ( exit, exit_exec );
/** "isset" options */
struct isset_options {};
@@ -507,10 +501,7 @@ static int isset_exec ( int argc, char **argv ) {
}
/** "isset" command */
struct command isset_command __command = {
.name = "isset",
.exec = isset_exec,
};
COMMAND ( isset, isset_exec );
/** "iseq" options */
struct iseq_options {};
@@ -544,10 +535,7 @@ static int iseq_exec ( int argc, char **argv ) {
}
/** "iseq" command */
struct command iseq_command __command = {
.name = "iseq",
.exec = iseq_exec,
};
COMMAND ( iseq, iseq_exec );
/** "sleep" options */
struct sleep_options {};
@@ -587,7 +575,4 @@ static int sleep_exec ( int argc, char **argv ) {
}
/** "sleep" command */
struct command sleep_command __command = {
.name = "sleep",
.exec = sleep_exec,
};
COMMAND ( sleep, sleep_exec );

View File

@@ -30,7 +30,4 @@ static int md4sum_exec ( int argc, char **argv ) {
return digest_exec ( argc, argv, &md4_algorithm );
}
struct command md4sum_command __command = {
.name = "md4sum",
.exec = md4sum_exec,
};
COMMAND ( md4sum, md4sum_exec );

View File

@@ -30,7 +30,4 @@ static int sha224sum_exec ( int argc, char **argv ) {
return digest_exec ( argc, argv, &sha224_algorithm );
}
struct command sha224sum_command __command = {
.name = "sha224sum",
.exec = sha224sum_exec,
};
COMMAND ( sha224sum, sha224sum_exec );

View File

@@ -30,7 +30,4 @@ static int sha256sum_exec ( int argc, char **argv ) {
return digest_exec ( argc, argv, &sha256_algorithm );
}
struct command sha256sum_command __command = {
.name = "sha256sum",
.exec = sha256sum_exec,
};
COMMAND ( sha256sum, sha256sum_exec );

View File

@@ -30,7 +30,4 @@ static int sha384sum_exec ( int argc, char **argv ) {
return digest_exec ( argc, argv, &sha384_algorithm );
}
struct command sha384sum_command __command = {
.name = "sha384sum",
.exec = sha384sum_exec,
};
COMMAND ( sha384sum, sha384sum_exec );

View File

@@ -30,7 +30,4 @@ static int sha512sum_exec ( int argc, char **argv ) {
return digest_exec ( argc, argv, &sha512_algorithm );
}
struct command sha512sum_command __command = {
.name = "sha512sum",
.exec = sha512sum_exec,
};
COMMAND ( sha512sum, sha512sum_exec );

View File

@@ -73,9 +73,4 @@ static int autoboot_exec ( int argc, char **argv ) {
}
/** Booting commands */
struct command autoboot_commands[] __command = {
{
.name = "autoboot",
.exec = autoboot_exec,
},
};
COMMAND ( autoboot, autoboot_exec );

View File

@@ -289,17 +289,6 @@ static int certfree_exec ( int argc, char **argv ) {
}
/** Certificate management commands */
struct command certmgmt_commands[] __command = {
{
.name = "certstat",
.exec = certstat_exec,
},
{
.name = "certstore",
.exec = certstore_exec,
},
{
.name = "certfree",
.exec = certfree_exec,
},
};
COMMAND ( certstat, certstat_exec );
COMMAND ( certstore, certstore_exec );
COMMAND ( certfree, certfree_exec );

View File

@@ -79,7 +79,4 @@ static int config_exec ( int argc, char **argv ) {
}
/** Configuration UI commands */
struct command config_command __command = {
.name = "config",
.exec = config_exec,
};
COMMAND ( config, config_exec );

View File

@@ -251,17 +251,6 @@ static int cpair_exec ( int argc, char **argv ) {
}
/** Console management commands */
struct command console_commands[] __command = {
{
.name = "console",
.exec = console_exec,
},
{
.name = "colour",
.exec = colour_exec,
},
{
.name = "cpair",
.exec = cpair_exec,
},
};
COMMAND ( console, console_exec );
COMMAND ( colour, colour_exec );
COMMAND ( cpair, cpair_exec );

View File

@@ -92,13 +92,5 @@ static int pxebs_exec ( int argc, char **argv ) {
}
/** DHCP management commands */
struct command dhcp_commands[] __command = {
{
.name = "dhcp",
.exec = ifconf_exec, /* synonym for "ifconf" */
},
{
.name = "pxebs",
.exec = pxebs_exec,
},
};
COMMAND ( dhcp, ifconf_exec ); /* synonym for "ifconf" */
COMMAND ( pxebs, pxebs_exec );

View File

@@ -128,15 +128,8 @@ static int sha1sum_exec ( int argc, char **argv ) {
return digest_exec ( argc, argv, &sha1_algorithm );
}
struct command md5sum_command __command = {
.name = "md5sum",
.exec = md5sum_exec,
};
struct command sha1sum_command __command = {
.name = "sha1sum",
.exec = sha1sum_exec,
};
COMMAND ( md5sum, md5sum_exec );
COMMAND ( sha1sum, sha1sum_exec );
/* Drag in commands for any other enabled algorithms */
REQUIRING_SYMBOL ( digest_exec );

View File

@@ -350,25 +350,8 @@ static int present_exec ( int argc, char **argv ) {
}
/** Dynamic user interface commands */
struct command dynui_commands[] __command = {
{
.name = "menu",
.exec = dynui_exec,
},
{
.name = "form",
.exec = dynui_exec,
},
{
.name = "item",
.exec = item_exec,
},
{
.name = "choose",
.exec = choose_exec,
},
{
.name = "present",
.exec = present_exec,
},
};
COMMAND ( menu, dynui_exec );
COMMAND ( form, dynui_exec );
COMMAND ( item, item_exec );
COMMAND ( choose, choose_exec );
COMMAND ( present, present_exec );

View File

@@ -207,13 +207,5 @@ static int fcels_exec ( int argc, char **argv ) {
}
/** Fibre Channel management commands */
struct command fcmgmt_commands[] __command = {
{
.name = "fcstat",
.exec = fcstat_exec,
},
{
.name = "fcels",
.exec = fcels_exec,
},
};
COMMAND ( fcstat, fcstat_exec );
COMMAND ( fcels, fcels_exec );

View File

@@ -88,9 +88,4 @@ static int fdt_exec ( int argc, char **argv ) {
}
/** Flattened Device Tree commands */
struct command fdt_commands[] __command = {
{
.name = "fdt",
.exec = fdt_exec,
},
};
COMMAND ( fdt, fdt_exec );

View File

@@ -107,9 +107,4 @@ static int gdbstub_exec ( int argc, char **argv ) {
}
/** GDB stub commands */
struct command gdbstub_commands[] __command = {
{
.name = "gdbstub",
.exec = gdbstub_exec,
},
};
COMMAND ( gdbstub, gdbstub_exec );

View File

@@ -71,9 +71,4 @@ static int ibstat_exec ( int argc, char **argv ) {
}
/** Infiniband commands */
struct command ibmgmt_commands[] __command = {
{
.name = "ibstat",
.exec = ibstat_exec,
},
};
COMMAND ( ibstat, ibstat_exec );

View File

@@ -303,25 +303,8 @@ static int iflinkwait_exec ( int argc, char **argv ) {
}
/** Interface management commands */
struct command ifmgmt_commands[] __command = {
{
.name = "ifopen",
.exec = ifopen_exec,
},
{
.name = "ifclose",
.exec = ifclose_exec,
},
{
.name = "ifstat",
.exec = ifstat_exec,
},
{
.name = "ifconf",
.exec = ifconf_exec,
},
{
.name = "iflinkwait",
.exec = iflinkwait_exec,
},
};
COMMAND ( ifopen, ifopen_exec );
COMMAND ( ifclose, ifclose_exec );
COMMAND ( ifstat, ifstat_exec );
COMMAND ( ifconf, ifconf_exec );
COMMAND ( iflinkwait, iflinkwait_exec );

View File

@@ -97,9 +97,4 @@ static int imgextract_exec ( int argc, char **argv ) {
}
/** Archive image commands */
struct command image_archive_commands[] __command = {
{
.name = "imgextract",
.exec = imgextract_exec,
},
};
COMMAND ( imgextract, imgextract_exec );

View File

@@ -393,54 +393,22 @@ static int imgfree_exec ( int argc, char **argv ) {
return imgmulti_exec ( argc, argv, unregister_image );
}
/** Image management commands */
struct command image_commands[] __command = {
{
.name = "imgfetch",
.exec = imgfetch_exec,
},
{
.name = "module",
.exec = imgfetch_exec, /* synonym for "imgfetch" */
},
{
.name = "initrd",
.exec = imgfetch_exec, /* synonym for "imgfetch" */
},
{
.name = "kernel",
.exec = imgselect_exec, /* synonym for "imgselect" */
},
{
.name = "chain",
.exec = imgexec_exec, /* synonym for "imgexec" */
},
{
.name = "imgselect",
.exec = imgselect_exec,
},
{
.name = "imgload",
.exec = imgselect_exec, /* synonym for "imgselect" */
},
{
.name = "imgargs",
.exec = imgargs_exec,
},
{
.name = "imgexec",
.exec = imgexec_exec,
},
{
.name = "boot", /* synonym for "imgexec" */
.exec = imgexec_exec,
},
{
.name = "imgstat",
.exec = imgstat_exec,
},
{
.name = "imgfree",
.exec = imgfree_exec,
},
};
/* "imgfetch" and synonyms */
COMMAND ( imgfetch, imgfetch_exec );
COMMAND ( module, imgfetch_exec );
COMMAND ( initrd, imgfetch_exec );
/* "imgselect" and synonyms */
COMMAND ( imgselect, imgselect_exec );
COMMAND ( imgload, imgselect_exec );
COMMAND ( kernel, imgselect_exec );
/* "imgexec" and synonyms */
COMMAND ( imgexec, imgexec_exec );
COMMAND ( chain, imgexec_exec );
COMMAND ( boot, imgexec_exec );
/* Other image management commands */
COMMAND ( imgargs, imgargs_exec );
COMMAND ( imgstat, imgstat_exec );
COMMAND ( imgfree, imgfree_exec );

View File

@@ -117,9 +117,4 @@ static int imgdecrypt_exec ( int argc, char **argv ) {
}
/** Image encryption management commands */
struct command image_crypt_commands[] __command = {
{
.name = "imgdecrypt",
.exec = imgdecrypt_exec,
},
};
COMMAND ( imgdecrypt, imgdecrypt_exec );

View File

@@ -89,9 +89,4 @@ static int imgmem_exec ( int argc, char **argv ) {
}
/** Read memory command */
struct command imgmem_commands[] __command = {
{
.name = "imgmem",
.exec = imgmem_exec,
},
};
COMMAND ( imgmem, imgmem_exec );

View File

@@ -163,13 +163,5 @@ static int imgverify_exec ( int argc, char **argv ) {
}
/** Image trust management commands */
struct command image_trust_commands[] __command = {
{
.name = "imgtrust",
.exec = imgtrust_exec,
},
{
.name = "imgverify",
.exec = imgverify_exec,
},
};
COMMAND ( imgtrust, imgtrust_exec );
COMMAND ( imgverify, imgverify_exec );

View File

@@ -66,9 +66,4 @@ static int ipstat_exec ( int argc, char **argv ) {
}
/** Routing table management commands */
struct command ipstat_commands[] __command = {
{
.name = "ipstat",
.exec = ipstat_exec,
},
};
COMMAND ( ipstat, ipstat_exec );

View File

@@ -113,13 +113,5 @@ static int iwlist_exec ( int argc, char **argv ) {
}
/** Wireless interface management commands */
struct command iwmgmt_commands[] __command = {
{
.name = "iwstat",
.exec = iwstat_exec,
},
{
.name = "iwlist",
.exec = iwlist_exec,
},
};
COMMAND ( iwstat, iwstat_exec );
COMMAND ( iwlist, iwlist_exec );

View File

@@ -71,7 +71,4 @@ static int login_exec ( int argc, char **argv ) {
}
/** Login commands */
struct command login_command __command = {
.name = "login",
.exec = login_exec,
};
COMMAND ( login, login_exec );

View File

@@ -100,7 +100,4 @@ static int lotest_exec ( int argc, char **argv ) {
}
/** Loopback testing commands */
struct command lotest_command __command = {
.name = "lotest",
.exec = lotest_exec,
};
COMMAND ( lotest, lotest_exec );

View File

@@ -65,9 +65,4 @@ static int nstat_exec ( int argc, char **argv ) {
}
/** Neighbour management commands */
struct command neighbour_commands[] __command = {
{
.name = "nstat",
.exec = nstat_exec,
},
};
COMMAND ( nstat, nstat_exec );

View File

@@ -73,7 +73,4 @@ static int nslookup_exec ( int argc, char **argv ) {
}
/** The "nslookup" command */
struct command nslookup_command __command = {
.name = "nslookup",
.exec = nslookup_exec,
};
COMMAND ( nslookup, nslookup_exec );

View File

@@ -75,7 +75,4 @@ static int ntp_exec ( int argc, char **argv ) {
}
/** NTP command */
struct command ntp_command __command = {
.name = "ntp",
.exec = ntp_exec,
};
COMMAND ( ntp, ntp_exec );

View File

@@ -356,25 +356,8 @@ static int inc_exec ( int argc, char **argv ) {
}
/** Non-volatile option commands */
struct command nvo_commands[] __command = {
{
.name = "show",
.exec = show_exec,
},
{
.name = "set",
.exec = set_exec,
},
{
.name = "clear",
.exec = clear_exec,
},
{
.name = "read",
.exec = read_exec,
},
{
.name = "inc",
.exec = inc_exec,
},
};
COMMAND ( show, show_exec );
COMMAND ( set, set_exec );
COMMAND ( clear, clear_exec );
COMMAND ( read, read_exec );
COMMAND ( inc, inc_exec );

View File

@@ -163,13 +163,5 @@ static int param_exec ( int argc, char **argv ) {
}
/** Request parameter commands */
struct command param_commands[] __command = {
{
.name = "params",
.exec = params_exec,
},
{
.name = "param",
.exec = param_exec,
},
};
COMMAND ( params, params_exec );
COMMAND ( param, param_exec );

View File

@@ -115,9 +115,4 @@ static int pciscan_exec ( int argc, char **argv ) {
}
/** PCI commands */
struct command pci_commands[] __command = {
{
.name = "pciscan",
.exec = pciscan_exec,
},
};
COMMAND ( pciscan, pciscan_exec );

View File

@@ -107,7 +107,4 @@ static int ping_exec ( int argc, char **argv ) {
}
/** Ping command */
struct command ping_command __command = {
.name = "ping",
.exec = ping_exec,
};
COMMAND ( ping, ping_exec );

View File

@@ -70,7 +70,4 @@ static int poweroff_exec ( int argc, char **argv ) {
}
/** "poweroff" command */
struct command poweroff_command __command = {
.name = "poweroff",
.exec = poweroff_exec,
};
COMMAND ( poweroff, poweroff_exec );

View File

@@ -66,9 +66,4 @@ static int profstat_exec ( int argc, char **argv ) {
}
/** Profiling commands */
struct command profstat_commands[] __command = {
{
.name = "profstat",
.exec = profstat_exec,
},
};
COMMAND ( profstat, profstat_exec );

View File

@@ -81,7 +81,4 @@ static int reboot_exec ( int argc, char **argv ) {
}
/** "reboot" command */
struct command reboot_command __command = {
.name = "reboot",
.exec = reboot_exec,
};
COMMAND ( reboot, reboot_exec );

View File

@@ -66,9 +66,4 @@ static int route_exec ( int argc, char **argv ) {
}
/** Routing table management commands */
struct command route_commands[] __command = {
{
.name = "route",
.exec = route_exec,
},
};
COMMAND ( route, route_exec );

View File

@@ -204,17 +204,6 @@ static int sanunhook_exec ( int argc, char **argv ) {
}
/** SAN commands */
struct command sanboot_commands[] __command = {
{
.name = "sanhook",
.exec = sanhook_exec,
},
{
.name = "sanboot",
.exec = sanboot_exec,
},
{
.name = "sanunhook",
.exec = sanunhook_exec,
},
};
COMMAND ( sanhook, sanhook_exec );
COMMAND ( sanboot, sanboot_exec );
COMMAND ( sanunhook, sanunhook_exec );

View File

@@ -123,9 +123,4 @@ static int shim_exec ( int argc, char **argv ) {
}
/** Shim commands */
struct command shim_commands[] __command = {
{
.name = "shim",
.exec = shim_exec,
},
};
COMMAND ( shim, shim_exec );

View File

@@ -77,7 +77,4 @@ static int sync_exec ( int argc, char **argv ) {
}
/** Sync commands */
struct command sync_command __command = {
.name = "sync",
.exec = sync_exec,
};
COMMAND ( sync, sync_exec );

View File

@@ -77,7 +77,4 @@ static int time_exec ( int argc, char **argv ) {
}
/** "time" command */
struct command time_command __command = {
.name = "time",
.exec = time_exec,
};
COMMAND ( time, time_exec );

View File

@@ -115,9 +115,4 @@ static int usbscan_exec ( int argc, char **argv ) {
}
/** USB commands */
struct command usb_commands[] __command = {
{
.name = "usbscan",
.exec = usbscan_exec,
},
};
COMMAND ( usbscan, usbscan_exec );

View File

@@ -131,13 +131,5 @@ static int vdestroy_exec ( int argc, char **argv ) {
}
/** VLAN commands */
struct command vlan_commands[] __command = {
{
.name = "vcreate",
.exec = vcreate_exec,
},
{
.name = "vdestroy",
.exec = vdestroy_exec,
},
};
COMMAND ( vcreate, vcreate_exec );
COMMAND ( vdestroy, vdestroy_exec );

View File

@@ -72,10 +72,7 @@ static int help_exec ( int argc __unused, char **argv __unused ) {
}
/** "help" command */
struct command help_command __command = {
.name = "help",
.exec = help_exec,
};
COMMAND ( help, help_exec );
/**
* Start command shell
@@ -137,7 +134,4 @@ static int shell_exec ( int argc, char **argv ) {
}
/** "shell" command */
struct command shell_command __command = {
.name = "shell",
.exec = shell_exec,
};
COMMAND ( shell, shell_exec );

View File

@@ -352,10 +352,7 @@ static int goto_exec ( int argc, char **argv ) {
}
/** "goto" command */
struct command goto_command __command = {
.name = "goto",
.exec = goto_exec,
};
COMMAND ( goto, goto_exec );
/** "prompt" options */
struct prompt_options {
@@ -418,7 +415,4 @@ static int prompt_exec ( int argc, char **argv ) {
}
/** "prompt" command */
struct command prompt_command __command = {
.name = "prompt",
.exec = prompt_exec,
};
COMMAND ( prompt, prompt_exec );

View File

@@ -21,7 +21,12 @@ struct command {
#define COMMANDS __table ( struct command, "commands" )
#define __command __table_entry ( COMMANDS, 01 )
#define __command( name ) __table_entry ( COMMANDS, _C2 ( 01., name ) )
#define COMMAND( name, exec ) \
struct command name ## _command __command ( name ) = { \
#name, exec \
}
extern char * concat_args ( char **args );