summaryrefslogtreecommitdiff
path: root/bin/bbackupquery/BackupQueries.cpp
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2010-02-25 23:20:27 +0000
committerChris Wilson <chris+github@qwirx.com>2010-02-25 23:20:27 +0000
commit27ab8a2537deaff65a9bb68b2a03bb267361e91f (patch)
tree2225f568915e1d1dac8e9fb1cb0f51d127a88f9b /bin/bbackupquery/BackupQueries.cpp
parent25203d94333f492a928278b1abb8642302242502 (diff)
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.
Diffstat (limited to 'bin/bbackupquery/BackupQueries.cpp')
-rw-r--r--bin/bbackupquery/BackupQueries.cpp76
1 files changed, 25 insertions, 51 deletions
diff --git a/bin/bbackupquery/BackupQueries.cpp b/bin/bbackupquery/BackupQueries.cpp
index f799ab43..2a99c077 100644
--- a/bin/bbackupquery/BackupQueries.cpp
+++ b/bin/bbackupquery/BackupQueries.cpp
@@ -63,6 +63,30 @@
#define COMPARE_RETURN_ERROR 3
#define COMMAND_RETURN_ERROR 4
+// Data about commands
+QueryCommandSpecification commands[] =
+{
+ { "quit", "" },
+ { "exit", "" },
+ { "list", "rodIFtTash", },
+ { "pwd", "" },
+ { "cd", "od" },
+ { "lcd", "" },
+ { "sh", "" },
+ { "getobject", "" },
+ { "get", "i" },
+ { "compare", "alcqAEQ" },
+ { "restore", "drif" },
+ { "help", "" },
+ { "usage", "m" },
+ { "undelete", "" },
+ { "delete", "" },
+ { NULL, NULL }
+};
+
+const char *alias[] = {"ls", 0};
+const int aliasIs[] = {Command_List, 0};
+
// --------------------------------------------------------------------------
//
// Function
@@ -100,12 +124,6 @@ BackupQueries::~BackupQueries()
{
}
-typedef struct
-{
- const char* name;
- const char* opts;
-} QueryCommandSpecification;
-
// --------------------------------------------------------------------------
//
// Function
@@ -206,51 +224,7 @@ void BackupQueries::DoCommand(const char *Command, bool isFromCommandLine)
// blank command
return;
}
-
- // Data about commands
- static QueryCommandSpecification commands[] =
- {
- { "quit", "" },
- { "exit", "" },
- { "list", "rodIFtTash", },
- { "pwd", "" },
- { "cd", "od" },
- { "lcd", "" },
- { "sh", "" },
- { "getobject", "" },
- { "get", "i" },
- { "compare", "alcqAEQ" },
- { "restore", "drif" },
- { "help", "" },
- { "usage", "m" },
- { "undelete", "" },
- { "delete", "" },
- { NULL, NULL }
- };
-
- typedef enum
- {
- Command_Quit = 0,
- Command_Exit,
- Command_List,
- Command_pwd,
- Command_cd,
- Command_lcd,
- Command_sh,
- Command_GetObject,
- Command_Get,
- Command_Compare,
- Command_Restore,
- Command_Help,
- Command_Usage,
- Command_Undelete,
- Command_Delete,
- }
- CommandType;
-
- static const char *alias[] = {"ls", 0};
- static const int aliasIs[] = {Command_List, 0};
-
+
// Work out which command it is...
int cmd = 0;
while(commands[cmd].name != 0 && ::strcmp(cmdElements[0].c_str(), commands[cmd].name) != 0)