From 7167ce41b61d2ba2cdb526777a4233eb84a3b66a Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Sat, 6 Dec 2014 17:33:25 -0500 Subject: Imported Upstream version 2.99.6 --- .../sqlitestudiocli/commands/clicommandadd.cpp | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 SQLiteStudio3/sqlitestudiocli/commands/clicommandadd.cpp (limited to 'SQLiteStudio3/sqlitestudiocli/commands/clicommandadd.cpp') diff --git a/SQLiteStudio3/sqlitestudiocli/commands/clicommandadd.cpp b/SQLiteStudio3/sqlitestudiocli/commands/clicommandadd.cpp new file mode 100644 index 0000000..e3c14bb --- /dev/null +++ b/SQLiteStudio3/sqlitestudiocli/commands/clicommandadd.cpp @@ -0,0 +1,36 @@ +#include "clicommandadd.h" +#include "cli.h" +#include "services/dbmanager.h" + +void CliCommandAdd::execute() +{ + if (!DBLIST->addDb(syntax.getArgument(DB_NAME), syntax.getArgument(FILE_PATH))) + { + println(tr("Could not add database %1 to list.").arg(syntax.getArgument(FILE_PATH))); + return; + } + + cli->setCurrentDb(DBLIST->getByName(syntax.getArgument(DB_NAME))); + println(tr("Database added: %1").arg(cli->getCurrentDb()->getName())); +} + +QString CliCommandAdd::shortHelp() const +{ + return tr("adds new database to the list"); +} + +QString CliCommandAdd::fullHelp() const +{ + return tr( + "Adds given database pointed by with given to list the databases list. " + "The is just a symbolic name that you can later refer to. Just pick any unique name. " + "For list of databases already on the list use %1 command." + ).arg(cmdName("dblist")); +} + +void CliCommandAdd::defineSyntax() +{ + syntax.setName("add"); + syntax.addArgument(DB_NAME, tr("name", "CLI command syntax")); + syntax.addArgument(FILE_PATH, tr("path", "CLI command syntax")); +} -- cgit v1.2.3