-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add play-complete script, completion from
play help
output
- Loading branch information
Showing
3 changed files
with
36 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env node | ||
var completion = require('../lib/completion'), | ||
exec = require('child_process').exec, | ||
path = require('path'), | ||
completer = path.basename(__filename); | ||
|
||
var parseTasks = completion.parseTasks, | ||
parseOut = completion.parseOut, | ||
log = completion.log; | ||
|
||
completion.complete('play', completer, function(err, o) { | ||
if(err || !o) return; | ||
|
||
exec('play help', function(err, stdout, stderr) { | ||
if(err) return; | ||
stdout = stdout.split('Core commands')[1].split(/^~$/m)[0]; | ||
var parsed = parseTasks(stdout, '~', /~\s[\w-:]+\s/gm); | ||
log(parsed, o); | ||
}); | ||
}); | ||
|
||
if(completion.isComplete()) return; | ||
|
||
console.log([ | ||
'play-complete called outside of a completion context.', | ||
'» You may want to setup the completion in your ~/.bashrc or ~/.zshrc file, if not already.', | ||
'', | ||
' play-complete completion >> ~/.bashrc', | ||
'Or', | ||
' play-complete completion >> ~/.zshrc' | ||
].join('\n')); |
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