-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
17 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 |
---|---|---|
@@ -1,29 +1,44 @@ | ||
## Autocomplete | ||
|
||
### Bash | ||
|
||
```bash | ||
# | ||
eval "$(_PM_COMPLETE=source pm)" | ||
```` | ||
|
||
### zsh | ||
|
||
```bash | ||
# .zshrc | ||
eval "$(_PM_COMPLETE=source_zsh pm)" | ||
``` | ||
## Autocomplete [WIP] | ||
|
||
### fish | ||
|
||
```bash | ||
```fish | ||
# .config/fish/completions/pm.fish | ||
function __fish_pm_projects | ||
command pm list 2>/dev/null | ||
end | ||
complete --command "pm" -n '__fish_seen_subcommand_from list' --no-files | ||
complete --command "pm" -n '__fish_seen_subcommand_from go remove' --arguments '(__fish_pm_projects)' --no-files | ||
function __fish_pm_needs_command | ||
set cmd (commandline -opc) | ||
if [ (count $cmd) -eq 1 ] | ||
return 0 | ||
end | ||
return 1 | ||
end | ||
function __fish_pm_using_command | ||
set cmd (commandline -opc) | ||
if [ (count $cmd) -gt 1 ] | ||
if [ $argv[1] = $cmd[2] ] | ||
return 0 | ||
end | ||
end | ||
return 1 | ||
end | ||
set -l pm_looking -c pm -n '__fish_pm_needs_command' | ||
# Main commands | ||
complete $pm_looking -xa list -d 'list projects' | ||
complete $pm_looking -xa go -d 'go to project' | ||
complete $pm_looking -xa remove -d 'remove project' | ||
complete $pm_looking -xa add -d 'add projects' | ||
``` | ||
|
||
TODO: Update bbash and zsh with lazy as per [this](http://click.palletsprojects.com/en/7.x/bashcomplete/#activation-script) | ||
### TODO | ||
- [ ] Remove explicit command descriptions from fish? (hidden docs: similar to click _complete) | ||
- [ ] Add bash | ||
- [ ] Add zsh |