diff options
author | Richard Jones <rjones@redhat.com> | 2010-06-01 16:27:33 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2010-06-02 13:38:00 +0100 |
commit | f2b7a8e15c49ebc70c7ea56aefb340362aae5a99 (patch) | |
tree | 48f68fcd73ac06175b6fff61ffbb9084e99979ff /src | |
parent | 9733d4746988b3a072d8bb1daac4b9795b8f4134 (diff) | |
download | libguestfs-f2b7a8e15c49ebc70c7ea56aefb340362aae5a99.tar.gz libguestfs-f2b7a8e15c49ebc70c7ea56aefb340362aae5a99.tar.xz libguestfs-f2b7a8e15c49ebc70c7ea56aefb340362aae5a99.zip |
fish: help command return error for non-existent commands (RHBZ#597145).
With this change, the exit status indicates error for non-existent
commands.
$ guestfish -h foo
foo: command not known, use -h to list all commands
$ echo $?
1
$ guestfish help foo
foo: command not known, use -h to list all commands
$ echo $?
1
Diffstat (limited to 'src')
-rwxr-xr-x | src/generator.ml | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/generator.ml b/src/generator.ml index 2c33049d..571ea3a0 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -7575,7 +7575,7 @@ and generate_fish_cmds () = pr "\n"; (* display_command function, which implements guestfish -h cmd *) - pr "void display_command (const char *cmd)\n"; + pr "int display_command (const char *cmd)\n"; pr "{\n"; List.iter ( fun (name, style, _, flags, _, shortdesc, longdesc) -> @@ -7623,15 +7623,17 @@ and generate_fish_cmds () = pr " || STRCASEEQ (cmd, \"%s\")" name2; if name <> alias then pr " || STRCASEEQ (cmd, \"%s\")" alias; - pr ")\n"; + pr ") {\n"; pr " pod2text (\"%s\", _(\"%s\"), %S);\n" name2 shortdesc ("=head1 SYNOPSIS\n\n " ^ synopsis ^ "\n\n" ^ "=head1 DESCRIPTION\n\n" ^ longdesc ^ warnings ^ describe_alias); + pr " return 0;\n"; + pr " }\n"; pr " else\n" ) all_functions; - pr " display_builtin_command (cmd);\n"; + pr " return display_builtin_command (cmd);\n"; pr "}\n"; pr "\n"; |