Skip to content

Commit 5dae614

Browse files
committed
Impl. projectDir variable.
1 parent cb84314 commit 5dae614

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,32 @@ Following is a description of each attribute:
4444

4545
**label:** Label that show in menus and quick search.
4646

47-
**cmd:** Command that will be executed. You can use $0, $1, ... $n to specify custom arguments, that will be propted for user.
47+
**cmd:** Command that will be executed. You can use $0, $1, ... $n to specify custom arguments, that will be prompted for user.
4848

4949
**args:** Array that contains default arguments, in case user supply anything.
5050

5151
**key:** Hotkey that will perform a quick access to command.
5252

5353
**splitChar:** Specify the char that will separate arguments of command. Default value is ':'.
5454

55-
**opts:** Optional attributes that configure some options of execution enviroment.
55+
**opts:** Optional attributes that configure some options of execution environment.
5656

5757
**opts.defaultPath:** Directory path where command will executed.
5858

5959
**opts.hiddenConsole:** True indicates that output panel will not open after command execution.
6060

6161
**opts.killCmd:** Command that will be triggered by 'Kill Commands' menu option.
6262

63+
64+
65+
System Parameters: Reserved variables that can be used to compose commands.
66+
67+
**$selectedFile** Path to selected file.
68+
69+
**$dirOfSelectedFile** Path to directory of selected file.
70+
71+
**$projectDir** Path directory of project.
72+
6373
Screenshots
6474
-----------
6575

cmdrunner.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"key" : "Ctrl-Alt-Shift-S"
66
},{
77
"label": "Curl ",
8-
"cmd": "curl $0 $1",
8+
"cmd": "curl '$projectDir'",
99
"args" : [],
1010
"splitChar": "|",
1111
"key" : ""

main.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ define(function (require, exports, module) {
5858
var doc = DocumentManager.getCurrentDocument();
5959

6060
return !doc ? opts.defaultPath : doc.file.parentPath;
61+
},
62+
63+
projectDir: function(opts) {
64+
var dir = ProjectManager.getProjectRoot();
65+
66+
return dir ? dir.fullPath : '.';
6167
}
6268
};
6369

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"title": "Command Runner",
44
"description": "Add hotkeys for running command line tools.",
55
"homepage": "https://github.com/tarcisiojr/brackets-command-runner",
6-
"version": "0.0.15",
6+
"version": "0.0.16",
77
"author": "Tarcísio Abadio de Magalhães Júnior <[email protected]>",
88
"license": "MIT",
99
"engines": {

0 commit comments

Comments
 (0)