From c50da863259c437af93841af9dca00e6e0170d3a Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Fri, 30 Oct 2009 15:47:39 +0100 Subject: [PATCH] tab-completion ok --- bacula/src/console/console.c | 18 +++++++++++------- bacula/src/dird/ua_cmds.c | 12 ++++++++---- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/bacula/src/console/console.c b/bacula/src/console/console.c index a2023d1f04..3c4e808d3b 100644 --- a/bacula/src/console/console.c +++ b/bacula/src/console/console.c @@ -467,15 +467,21 @@ static void match_kw(regex_t *preg, const char *what, int len, POOLMEM **buf) } rc = regexec(preg, what, nmatch, pmatch, 0); if (rc == 0) { - size = pmatch[0].rm_eo - pmatch[0].rm_so; - +#if 0 + Pmsg1(0, "\n\n%s\n0123456789012345678901234567890123456789\n 10 20 30\n", what); + Pmsg2(0, "%i-%i\n", pmatch[0].rm_so, pmatch[0].rm_eo); + Pmsg2(0, "%i-%i\n", pmatch[1].rm_so, pmatch[1].rm_eo); + Pmsg2(0, "%i-%i\n", pmatch[2].rm_so, pmatch[2].rm_eo); + Pmsg2(0, "%i-%i\n", pmatch[3].rm_so, pmatch[3].rm_eo); +#endif + size = pmatch[1].rm_eo - pmatch[1].rm_so; *buf = check_pool_memory_size(*buf, size + 1); - memcpy(*buf, what+pmatch[0].rm_so, size); + memcpy(*buf, what+pmatch[1].rm_so, size); (*buf)[size] = 0; items->list.append(bstrdup(*buf)); /* We search for the next keyword in the line */ - match_kw(preg, what + pmatch[0].rm_eo, len - pmatch[0].rm_eo, buf); + match_kw(preg, what + pmatch[1].rm_eo, len - pmatch[1].rm_eo, buf); } } @@ -487,9 +493,7 @@ void get_arguments(const char *what) int rc; init_items(); - rc = regcomp(&preg, - "([a-z]+=|done|select|all|listing|jobs|stats|slots)", - REG_EXTENDED); + rc = regcomp(&preg, "(([a-z]+=)|([a-z]+)( |$))", REG_EXTENDED); if (rc != 0) { return; } diff --git a/bacula/src/dird/ua_cmds.c b/bacula/src/dird/ua_cmds.c index 0d970b9741..5112843ace 100644 --- a/bacula/src/dird/ua_cmds.c +++ b/bacula/src/dird/ua_cmds.c @@ -131,7 +131,11 @@ static struct cmdstruct commands[] = { /* C { NT_("exit"), quit_cmd, _("Terminate Bconsole session"), NT_(""), false}, { NT_("gui"), gui_cmd, _("Non-interactive gui mode"), NT_("on | off"), false}, - { NT_("help"), help_cmd, _("Print this command"), NT_(""), false}, + { NT_("help"), help_cmd, _("Print help on specific command"), + NT_("add autodisplay automount cancel create delete disable enable estimate exit gui label list llist messages " + "memory mount prune purge python quit query restore relabel release reload run status setdebug setip show " + "sqlquery time trace unmount umount update use var version wait"), false}, + { NT_("label"), label_cmd, _("Label a tape"), NT_("storage= volume= pool="), false}, { NT_("list"), list_cmd, _("List objects from catalog"), NT_("pools | jobs | jobtotals | media | files jobid= | copies jobid="), true}, @@ -152,7 +156,7 @@ static struct cmdstruct commands[] = { /* C { NT_("quit"), quit_cmd, _("Terminate Bconsole session"), NT_(""), false}, { NT_("query"), querycmd, _("Query catalog"), NT_(""), false}, { NT_("restore"), restore_cmd, _("Restore files"), - NT_("where=/path client= storage= bootstrap= jobid= done select all"), false}, + NT_("where= client= storage= bootstrap= jobid= done select all"), false}, { NT_("relabel"), relabel_cmd, _("Relabel a tape"), NT_("storage= oldvolume= volume="), false}, @@ -183,13 +187,13 @@ static struct cmdstruct commands[] = { /* C NT_("storage= [ drive= ] | jobid= | job="), false}, { NT_("update"), update_cmd, _("Update volume, pool or stats"), - NT_("pool= | slots | stats | volume= volstatus= volretention= " + NT_("pool= | slots storage= scan| stats | volume= volstatus= volretention= " "pool= recycle= slot= inchanger="),true}, { NT_("use"), use_cmd, _("Use catalog xxx"), NT_(""), false}, { NT_("var"), var_cmd, _("Does variable expansion"), NT_(""), false}, { NT_("version"), version_cmd, _("Print Director version"), NT_(""), true}, { NT_("wait"), wait_cmd, _("Wait until no jobs are running"), - NT_(" | | "), false} + NT_("jobname= | jobid= | ujobid="), false} }; #define comsize ((int)(sizeof(commands)/sizeof(struct cmdstruct))) -- 2.39.5