File: clicommandcd.cpp

package info (click to toggle)
sqlitestudio 3.4.21%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 54,880 kB
  • sloc: ansic: 406,208; cpp: 123,872; yacc: 2,692; tcl: 497; sh: 462; xml: 426; makefile: 19
file content (34 lines) | stat: -rw-r--r-- 1,145 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "clicommandcd.h"
#include <QCoreApplication>
#include <QDir>

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 working directory");
}

QString CliCommandCd::fullHelp() const
{
    return tr(
                "Very similar command to 'cd' known from Unix systems and Windows. "
                "It requires a <path> 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."
               ).arg(cmdName("cd"), cmdName("pwd"), cmdName("ls"));
}

void CliCommandCd::defineSyntax()
{
    syntax.setName("cd");
    syntax.addArgument(DIR_PATH, tr("path", "CLI command syntax"));
}