diff --git a/README.md b/README.md index 2cc664b..9b1e386 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Following is a description of each attribute: **label:** Label that show in menus and quick search. -**cmd:** Command that will be executed. You can use $0, $1, ... $n to specify custom arguments, that will be propted for user. +**cmd:** Command that will be executed. You can use $0, $1, ... $n to specify custom arguments, that will be prompted for user. **args:** Array that contains default arguments, in case user supply anything. @@ -52,7 +52,7 @@ Following is a description of each attribute: **splitChar:** Specify the char that will separate arguments of command. Default value is ':'. -**opts:** Optional attributes that configure some options of execution enviroment. +**opts:** Optional attributes that configure some options of execution environment. **opts.defaultPath:** Directory path where command will executed. @@ -60,6 +60,16 @@ Following is a description of each attribute: **opts.killCmd:** Command that will be triggered by 'Kill Commands' menu option. + + +System Parameters: Reserved variables that can be used to compose commands. + +**$selectedFile** Path to selected file. + +**$dirOfSelectedFile** Path to directory of selected file. + +**$projectDir** Path directory of project. + Screenshots ----------- diff --git a/cmdrunner.json b/cmdrunner.json index dfa8ae3..d61adff 100644 --- a/cmdrunner.json +++ b/cmdrunner.json @@ -5,7 +5,7 @@ "key" : "Ctrl-Alt-Shift-S" },{ "label": "Curl ", - "cmd": "curl $0 $1", + "cmd": "curl '$projectDir'", "args" : [], "splitChar": "|", "key" : "" diff --git a/main.js b/main.js index 7fd3956..2f92b3f 100644 --- a/main.js +++ b/main.js @@ -58,6 +58,12 @@ define(function (require, exports, module) { var doc = DocumentManager.getCurrentDocument(); return !doc ? opts.defaultPath : doc.file.parentPath; + }, + + projectDir: function(opts) { + var dir = ProjectManager.getProjectRoot(); + + return dir ? dir.fullPath : '.'; } }; diff --git a/package.json b/package.json index eaf42c4..7676630 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "title": "Command Runner", "description": "Add hotkeys for running command line tools.", "homepage": "https://github.com/tarcisiojr/brackets-command-runner", - "version": "0.0.15", + "version": "0.0.16", "author": "Tarcísio Abadio de Magalhães Júnior ", "license": "MIT", "engines": {