aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-12-05 19:12:26 +0100
committerAdrian Kummerlaender2015-12-05 19:12:26 +0100
commiteaa6b0b5f43738c0386e99eeba26b44250e6136d (patch)
tree3400c97d336bb59a9216e4e5400ad8f7617a5682 /src
parent428dc1d77bd843c0e7313cb28dc69f26154fdea6 (diff)
downloadMetaTerm-eaa6b0b5f43738c0386e99eeba26b44250e6136d.tar
MetaTerm-eaa6b0b5f43738c0386e99eeba26b44250e6136d.tar.gz
MetaTerm-eaa6b0b5f43738c0386e99eeba26b44250e6136d.tar.bz2
MetaTerm-eaa6b0b5f43738c0386e99eeba26b44250e6136d.tar.lz
MetaTerm-eaa6b0b5f43738c0386e99eeba26b44250e6136d.tar.xz
MetaTerm-eaa6b0b5f43738c0386e99eeba26b44250e6136d.tar.zst
MetaTerm-eaa6b0b5f43738c0386e99eeba26b44250e6136d.zip
Implement `cd` command to enable changing _MetaTerm_'s working directory
Exposing access to the working directory to QML is the first step towards enabling usage analogously to a normal terminal emulator alongside the management of multiple running appications. i.e. executing `cd` should change the global working directory so that consecutive commands work as expected.
Diffstat (limited to 'src')
-rw-r--r--src/command/commands.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/command/commands.js b/src/command/commands.js
index 732eb5b..2ec1bb6 100644
--- a/src/command/commands.js
+++ b/src/command/commands.js
@@ -114,3 +114,13 @@ function prev() {
function q() {
Qt.quit();
}
+
+function cd(output, path) {
+ if ( path.length > 0 ) {
+ if ( !workingDirectory.cd(path) ) {
+ output.error('\"' + path + '\" doesn\'t exist.');
+ }
+ } else {
+ output.log(workingDirectory.current());
+ }
+}