Ignore:
Timestamp:
25/02/2010 23:20:27 (2 years ago)
Author:
chris
Message:

First attempt at tab completion for readline/libedit in bbackupquery,
with commands and local file names, because it's easy and will help to
find compatibility problems.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/bin/bbackupquery/BackupQueries.cpp

    r2636 r2641  
    6464#define COMMAND_RETURN_ERROR            4 
    6565 
     66// Data about commands 
     67QueryCommandSpecification commands[] =  
     68{ 
     69        { "quit", "" }, 
     70        { "exit", "" }, 
     71        { "list", "rodIFtTash", }, 
     72        { "pwd",  "" }, 
     73        { "cd",   "od" }, 
     74        { "lcd",  "" }, 
     75        { "sh",   "" }, 
     76        { "getobject", "" }, 
     77        { "get",  "i" }, 
     78        { "compare", "alcqAEQ" }, 
     79        { "restore", "drif" }, 
     80        { "help", "" }, 
     81        { "usage", "m" }, 
     82        { "undelete", "" }, 
     83        { "delete", "" }, 
     84        { NULL, NULL }  
     85}; 
     86 
     87const char *alias[] = {"ls", 0}; 
     88const int aliasIs[] = {Command_List, 0}; 
     89 
    6690// -------------------------------------------------------------------------- 
    6791// 
     
    100124{ 
    101125} 
    102  
    103 typedef struct 
    104 { 
    105         const char* name; 
    106         const char* opts; 
    107 } QueryCommandSpecification; 
    108126 
    109127// -------------------------------------------------------------------------- 
     
    207225                return; 
    208226        } 
    209          
    210         // Data about commands 
    211         static QueryCommandSpecification commands[] =  
    212         { 
    213                 { "quit", "" }, 
    214                 { "exit", "" }, 
    215                 { "list", "rodIFtTash", }, 
    216                 { "pwd",  "" }, 
    217                 { "cd",   "od" }, 
    218                 { "lcd",  "" }, 
    219                 { "sh",   "" }, 
    220                 { "getobject", "" }, 
    221                 { "get",  "i" }, 
    222                 { "compare", "alcqAEQ" }, 
    223                 { "restore", "drif" }, 
    224                 { "help", "" }, 
    225                 { "usage", "m" }, 
    226                 { "undelete", "" }, 
    227                 { "delete", "" }, 
    228                 { NULL, NULL }  
    229         }; 
    230  
    231         typedef enum 
    232         { 
    233                 Command_Quit = 0, 
    234                 Command_Exit, 
    235                 Command_List, 
    236                 Command_pwd, 
    237                 Command_cd, 
    238                 Command_lcd, 
    239                 Command_sh, 
    240                 Command_GetObject, 
    241                 Command_Get, 
    242                 Command_Compare, 
    243                 Command_Restore, 
    244                 Command_Help, 
    245                 Command_Usage, 
    246                 Command_Undelete, 
    247                 Command_Delete, 
    248         } 
    249         CommandType; 
    250  
    251         static const char *alias[] = {"ls", 0}; 
    252         static const int aliasIs[] = {Command_List, 0}; 
    253          
     227 
    254228        // Work out which command it is... 
    255229        int cmd = 0; 
Note: See TracChangeset for help on using the changeset viewer.