]> git.sur5r.net Git - bacula/bacula/commitdiff
tab-completion ok
authorEric Bollengier <eric@eb.homelinux.org>
Fri, 30 Oct 2009 14:47:39 +0000 (15:47 +0100)
committerEric Bollengier <eric@eb.homelinux.org>
Sun, 1 Nov 2009 22:33:58 +0000 (23:33 +0100)
bacula/src/console/console.c
bacula/src/dird/ua_cmds.c

index a2023d1f046d0e2d741baac878ee38c0925a4d2a..3c4e808d3b6ec40590fa6cc40a33bdff5b38c4c2 100644 (file)
@@ -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;
    }
index 0d970b9741f6aa9d0f1bcd1818dca952b61e7aba..5112843ace115a95fe7bf30c3d8c3c27a7f8a572 100644 (file)
@@ -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=<storage> volume=<vol> pool=<pool>"), false},
  { NT_("list"),       list_cmd,      _("List objects from catalog"), 
    NT_("pools | jobs | jobtotals | media <pool=pool-name> | files jobid=<nn> | copies jobid=<nn>"), 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=<client> storage=<storage> bootstrap=<file> jobid=<jobid> done select all"), false},
+   NT_("where=</path> client=<client> storage=<storage> bootstrap=<file> jobid=<jobid> done select all"), false},
 
  { NT_("relabel"),    relabel_cmd,   _("Relabel a tape"), 
    NT_("storage=<storage-name> oldvolume=<old-volume-name>  volume=<newvolume-name>"), false},
@@ -183,13 +187,13 @@ static struct cmdstruct commands[] = {                                      /* C
    NT_("storage=<storage-name> [ drive=<num> ] | jobid=<id> | job=<job-name>"), false},
 
  { NT_("update"),     update_cmd,    _("Update volume, pool or stats"), 
-   NT_("pool=<poolname> | slots | stats | volume=<volname> volstatus=<status> volretention=<time-def> "
+   NT_("pool=<poolname> | slots storage=<storage> scan| stats | volume=<volname> volstatus=<status> volretention=<time-def> "
        "pool=<pool> recycle=<yes/no> slot=<number> inchanger=<yes/no>"),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_("<jobname=name> | <jobid=nnn> | <ujobid=complete_name>"), false}
+   NT_("jobname=<name> | jobid=<nnn> | ujobid=<complete_name>"), false}
 };
 
 #define comsize ((int)(sizeof(commands)/sizeof(struct cmdstruct)))