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/clicommandcd.cpp | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 SQLiteStudio3/sqlitestudiocli/commands/clicommandcd.cpp (limited to 'SQLiteStudio3/sqlitestudiocli/commands/clicommandcd.cpp') diff --git a/SQLiteStudio3/sqlitestudiocli/commands/clicommandcd.cpp b/SQLiteStudio3/sqlitestudiocli/commands/clicommandcd.cpp new file mode 100644 index 0000000..0ca6cb6 --- /dev/null +++ b/SQLiteStudio3/sqlitestudiocli/commands/clicommandcd.cpp @@ -0,0 +1,34 @@ +#include "clicommandcd.h" +#include +#include + +void CliCommandCd::execute() +{ + QDir dir; + dir.cd(syntax.getArgument(DIR_PATH)); + if (QDir::setCurrent(dir.absolutePath())) + println(tr("Changed directory to: %1").arg(QDir::currentPath())); + else + println(tr("Could not change directory to: %1").arg(QDir::currentPath())); +} + +QString CliCommandCd::shortHelp() const +{ + return tr("changes current workind directory"); +} + +QString CliCommandCd::fullHelp() const +{ + return tr( + "Very similar command to 'cd' known from Unix systems and Windows. " + "It requires a argument to be passed, therefore calling %1 will always cause a change of the directory. " + "To learn what's the current working directory use %2 command and to list contents of the current working directory " + "use %3 command." + ); +} + +void CliCommandCd::defineSyntax() +{ + syntax.setName("cd"); + syntax.addArgument(DIR_PATH, tr("path", "CLI command syntax")); +} -- cgit v1.2.3