-
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.
Add shell completions for bash, zsh and fish (#50)
This PR aims to introduce basic shell completions for bash, zsh and fish for the zaman command.
- Loading branch information
Showing
4 changed files
with
37 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
_zaman() { | ||
local arg="${2}" | ||
local -a opts | ||
opts=('-m --menu | ||
-o --output | ||
-O --save | ||
-h --help | ||
-V --version') | ||
|
||
COMPREPLY=( $(compgen -W "${opts[*]}" -- "${arg}") ) | ||
} | ||
|
||
complete -F _zaman zaman |
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,7 @@ | ||
complete -c zaman -f | ||
|
||
complete -c zaman -s m -l menu -d 'Print a menu via rofi or dmenu that lists every man pages to choose from (default operation)' | ||
complete -c zaman -s o -l output -d '(Args <man page> <file>) Save <man page> into the <file> PDF file' | ||
complete -c zaman -s O -l save -d '(Arg <man page>) Save <man page> into the "man_<man page>.pdf" file in the current directory' | ||
complete -c zaman -s h -l help -d 'Display the help message' | ||
complete -c zaman -s V -l version -d 'Display version information' |
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,12 @@ | ||
#compdef zaman | ||
|
||
local -a opts | ||
opts=( | ||
{-m,--menu}'[Print a menu via rofi or dmenu that lists every man pages to choose from (default operation)]' | ||
{-o,--output}'[(Args <man page> <file>) Save <man page> into the <file> PDF file]' | ||
{-O,--save}'[(Arg <man page>) Save <man page> into the "man_<man page>.pdf" file in the current directory]' | ||
{-h,--help}'[Display the help message]' | ||
{-V,--version}'[Display version information]' | ||
) | ||
|
||
_arguments $opts |