-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add should support change directory (#39)
还是旧版的 CommandBin,有空得找时间重构下
- Loading branch information
Showing
11 changed files
with
84 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,6 @@ install: | |
test_script: | ||
- node --version | ||
- npm --version | ||
- npm run ci | ||
- npm run test | ||
|
||
build: off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict'; | ||
|
||
exports.generateAppleScript = dir => { | ||
const terminalCommand = `tell application "Terminal" | ||
do script "cd ${dir}" in front window | ||
end tell`.split('\n').map(line => (` -e '${line.trim()}'`)).join(''); | ||
|
||
const iTermCommand = `tell application "iTerm" | ||
tell current session of current window | ||
write text "cd ${dir}" | ||
end tell | ||
end tell`.split('\n').map(line => (` -e '${line.trim()}'`)).join(''); | ||
|
||
const currentApp = `tell application "System Events" | ||
set activeApp to name of first application process whose frontmost is true | ||
end tell`.split('\n').map(line => (` -e '${line.trim()}'`)).join(''); | ||
|
||
return `[ \`osascript ${currentApp}\` = "Terminal" ] && osascript ${terminalCommand} >/dev/null || osascript ${iTermCommand}`; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"base": "../../tmp", | ||
"change_directory": true | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
'use strict'; | ||
|
||
const mm = require('mm'); | ||
const BaseCommand = require('../../lib/base_command'); | ||
|
||
mm(process, 'platform', 'darwin'); | ||
|
||
mm(BaseCommand.prototype, 'runScript', function* (cmd) { | ||
console.log(cmd); | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters