Skip to content

Commit 67f6b4b

Browse files
committed
plugin: translate -h into commands
As the help short option parsed -h by argconfig so follow plugin also. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent a6ead8d commit 67f6b4b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

plugin.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ int handle_plugin(int argc, char **argv, struct plugin *plugin)
156156
sprintf(use, "%s %s %s <device> [OPTIONS]", prog->name, plugin->name, str);
157157
argconfig_append_usage(use);
158158

159-
/* translate --help and --version into commands */
159+
/* translate --help, -h and --version into commands */
160160
while (*str == '-')
161161
str++;
162162

163-
if (!strcmp(str, "help"))
163+
if (!strcmp(str, "help") || (str == argv[0] + 1 && !strcmp(str, "h")))
164164
return help(argc, argv, plugin);
165165
if (!strcmp(str, "version"))
166166
return version_cmd(plugin);

0 commit comments

Comments
 (0)