]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[settings] Add "--quiet" option to "show" command
authorMichael Brown <mcb30@ipxe.org>
Thu, 16 Jul 2026 14:46:57 +0000 (15:46 +0100)
committerMichael Brown <mcb30@ipxe.org>
Thu, 16 Jul 2026 14:47:49 +0000 (15:47 +0100)
Allow the "show -q" command to be used to display a setting's value
without also showing its origin and type metadata.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/hci/commands/nvo_cmd.c

index 70086afcebe1364ea5f33ab28eb90dbc932b6752..8ac7f58c5fd1c0f1282700593b016724eae403dc 100644 (file)
@@ -43,10 +43,16 @@ FILE_SECBOOT ( PERMITTED );
  */
 
 /** "show" options */
-struct show_options {};
+struct show_options {
+       /** Do not display setting type, only value */
+       int quiet;
+};
 
 /** "show" option list */
-static struct option_descriptor show_opts[] = {};
+static struct option_descriptor show_opts[] = {
+       OPTION_DESC ( "quiet", 'q', no_argument,
+                     struct show_options, quiet, parse_flag ),
+};
 
 /** "show" command descriptor */
 static struct command_descriptor show_cmd =
@@ -88,7 +94,9 @@ static int show_exec ( int argc, char **argv ) {
 
        /* Print setting value */
        setting_name ( origin, &fetched, name_buf, sizeof ( name_buf ) );
-       printf ( "%s = %s\n", name_buf, value );
+       if ( ! opts.quiet )
+               printf ( "%s = ", name_buf );
+       printf ( "%s\n", value );
 
        /* Success */
        rc = 0;