|
|
373a02 |
diff --git a/src/CmdExec.h b/src/CmdExec.h
|
|
|
373a02 |
index 752c4c7..b853742 100644
|
|
|
373a02 |
--- a/src/CmdExec.h
|
|
|
373a02 |
+++ b/src/CmdExec.h
|
|
|
373a02 |
@@ -253,7 +253,7 @@ public:
|
|
|
373a02 |
|
|
|
373a02 |
void ChangeSession(FileAccess *new_session);
|
|
|
373a02 |
|
|
|
373a02 |
- void print_cmd_help(const char *cmd);
|
|
|
373a02 |
+ bool print_cmd_help(const char *cmd);
|
|
|
373a02 |
void print_cmd_index();
|
|
|
373a02 |
|
|
|
373a02 |
static const char *CmdByIndex(int i);
|
|
|
373a02 |
diff --git a/src/commands.cc b/src/commands.cc
|
|
|
373a02 |
index 73de31e..e361042 100644
|
|
|
373a02 |
--- a/src/commands.cc
|
|
|
373a02 |
+++ b/src/commands.cc
|
|
|
373a02 |
@@ -2533,7 +2533,7 @@ CMD(scache)
|
|
|
373a02 |
return 0;
|
|
|
373a02 |
}
|
|
|
373a02 |
|
|
|
373a02 |
-void CmdExec::print_cmd_help(const char *cmd)
|
|
|
373a02 |
+bool CmdExec::print_cmd_help(const char *cmd)
|
|
|
373a02 |
{
|
|
|
373a02 |
const cmd_rec *c;
|
|
|
373a02 |
int part=find_cmd(cmd,&c);
|
|
|
373a02 |
@@ -2543,30 +2543,31 @@ void CmdExec::print_cmd_help(const char *cmd)
|
|
|
373a02 |
if(c->long_desc==0 && c->short_desc==0)
|
|
|
373a02 |
{
|
|
|
373a02 |
printf(_("Sorry, no help for %s\n"),cmd);
|
|
|
373a02 |
- return;
|
|
|
373a02 |
+ return true;
|
|
|
373a02 |
}
|
|
|
373a02 |
if(c->short_desc==0 && !strchr(c->long_desc,' '))
|
|
|
373a02 |
{
|
|
|
373a02 |
printf(_("%s is a built-in alias for %s\n"),cmd,c->long_desc);
|
|
|
373a02 |
print_cmd_help(c->long_desc);
|
|
|
373a02 |
- return;
|
|
|
373a02 |
+ return true;
|
|
|
373a02 |
}
|
|
|
373a02 |
if(c->short_desc)
|
|
|
373a02 |
printf(_("Usage: %s\n"),_(c->short_desc));
|
|
|
373a02 |
if(c->long_desc)
|
|
|
373a02 |
printf("%s",_(c->long_desc));
|
|
|
373a02 |
- return;
|
|
|
373a02 |
+ return true;
|
|
|
373a02 |
}
|
|
|
373a02 |
const char *a=Alias::Find(cmd);
|
|
|
373a02 |
if(a)
|
|
|
373a02 |
{
|
|
|
373a02 |
printf(_("%s is an alias to `%s'\n"),cmd,a);
|
|
|
373a02 |
- return;
|
|
|
373a02 |
+ return true;
|
|
|
373a02 |
}
|
|
|
373a02 |
if(part==0)
|
|
|
373a02 |
printf(_("No such command `%s'. Use `help' to see available commands.\n"),cmd);
|
|
|
373a02 |
else
|
|
|
373a02 |
printf(_("Ambiguous command `%s'. Use `help' to see available commands.\n"),cmd);
|
|
|
373a02 |
+ return false;
|
|
|
373a02 |
}
|
|
|
373a02 |
|
|
|
373a02 |
void CmdExec::print_cmd_index()
|
|
|
373a02 |
@@ -2610,12 +2611,14 @@ CMD(help)
|
|
|
373a02 |
{
|
|
|
373a02 |
if(args->count()>1)
|
|
|
373a02 |
{
|
|
|
373a02 |
+ exit_code=0;
|
|
|
373a02 |
for(;;)
|
|
|
373a02 |
{
|
|
|
373a02 |
const char *cmd=args->getnext();
|
|
|
373a02 |
if(cmd==0)
|
|
|
373a02 |
break;
|
|
|
373a02 |
- parent->print_cmd_help(cmd);
|
|
|
373a02 |
+ if(!parent->print_cmd_help(cmd))
|
|
|
373a02 |
+ exit_code=1;
|
|
|
373a02 |
}
|
|
|
373a02 |
return 0;
|
|
|
373a02 |
}
|
|
|
373a02 |
--
|
|
|
373a02 |
2.1.0
|
|
|
373a02 |
|