-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Convert
--generate-completion
flag to subcommand and add docs/tests (…
…#22) - Add documention - Add tests - Fix github action
- Loading branch information
1 parent
9f9346f
commit 8df5a2e
Showing
14 changed files
with
454 additions
and
38 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
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,12 @@ | ||
# Shell Completions | ||
|
||
Run `tinty generate-completion <bash|elvish|fish|powershell|zsh>` to | ||
generate a shell completion script for your shell of choice. Make sure | ||
to source the generated script in your shell startup file (`*rc`). | ||
|
||
The files in this directory are custom completion scripts which has been | ||
optimised further than the standard completions `tinty` generates. These | ||
scripts complete dynamic values (scheme names) as well as the standard | ||
subcommands and flags. Currently `bash` is the completion which has been | ||
optimised this way, the rest are the default completions generated by | ||
`tinty generate-completion <shell_name>`. |
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,134 @@ | ||
|
||
use builtin; | ||
use str; | ||
|
||
set edit:completion:arg-completer[tinty] = {|@words| | ||
fn spaces {|n| | ||
builtin:repeat $n ' ' | str:join '' | ||
} | ||
fn cand {|text desc| | ||
edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc | ||
} | ||
var command = 'tinty' | ||
for word $words[1..-1] { | ||
if (str:has-prefix $word '-') { | ||
break | ||
} | ||
set command = $command';'$word | ||
} | ||
var completions = [ | ||
&'tinty'= { | ||
cand -c 'Optional path to the tinty config.toml file' | ||
cand --config 'Optional path to the tinty config.toml file' | ||
cand -d 'Optional path to the tinty data directory' | ||
cand --data-dir 'Optional path to the tinty data directory' | ||
cand -h 'Print help' | ||
cand --help 'Print help' | ||
cand -V 'Print version' | ||
cand --version 'Print version' | ||
cand current 'Prints the last scheme name applied' | ||
cand generate-completion 'Generates a shell completion script' | ||
cand info 'Shows scheme colors for all schemes matching <scheme_system>-<scheme_name> (Eg: tinty info base16-mocha)' | ||
cand init 'Initializes with the exising config. Used to Initialize exising theme for when your shell starts up' | ||
cand list 'Lists available schemes' | ||
cand apply 'Applies a theme based on the chosen scheme' | ||
cand install 'Install the environment needed for tinty' | ||
cand update 'Update to the latest themes' | ||
cand help 'Print this message or the help of the given subcommand(s)' | ||
} | ||
&'tinty;current'= { | ||
cand -c 'Optional path to the tinty config.toml file' | ||
cand --config 'Optional path to the tinty config.toml file' | ||
cand -d 'Optional path to the tinty data directory' | ||
cand --data-dir 'Optional path to the tinty data directory' | ||
cand -h 'Print help' | ||
cand --help 'Print help' | ||
} | ||
&'tinty;generate-completion'= { | ||
cand -c 'Optional path to the tinty config.toml file' | ||
cand --config 'Optional path to the tinty config.toml file' | ||
cand -d 'Optional path to the tinty data directory' | ||
cand --data-dir 'Optional path to the tinty data directory' | ||
cand -h 'Print help' | ||
cand --help 'Print help' | ||
} | ||
&'tinty;info'= { | ||
cand -c 'Optional path to the tinty config.toml file' | ||
cand --config 'Optional path to the tinty config.toml file' | ||
cand -d 'Optional path to the tinty data directory' | ||
cand --data-dir 'Optional path to the tinty data directory' | ||
cand -h 'Print help' | ||
cand --help 'Print help' | ||
} | ||
&'tinty;init'= { | ||
cand -c 'Optional path to the tinty config.toml file' | ||
cand --config 'Optional path to the tinty config.toml file' | ||
cand -d 'Optional path to the tinty data directory' | ||
cand --data-dir 'Optional path to the tinty data directory' | ||
cand -h 'Print help' | ||
cand --help 'Print help' | ||
} | ||
&'tinty;list'= { | ||
cand -c 'Optional path to the tinty config.toml file' | ||
cand --config 'Optional path to the tinty config.toml file' | ||
cand -d 'Optional path to the tinty data directory' | ||
cand --data-dir 'Optional path to the tinty data directory' | ||
cand -h 'Print help' | ||
cand --help 'Print help' | ||
} | ||
&'tinty;apply'= { | ||
cand -c 'Optional path to the tinty config.toml file' | ||
cand --config 'Optional path to the tinty config.toml file' | ||
cand -d 'Optional path to the tinty data directory' | ||
cand --data-dir 'Optional path to the tinty data directory' | ||
cand -h 'Print help' | ||
cand --help 'Print help' | ||
} | ||
&'tinty;install'= { | ||
cand -c 'Optional path to the tinty config.toml file' | ||
cand --config 'Optional path to the tinty config.toml file' | ||
cand -d 'Optional path to the tinty data directory' | ||
cand --data-dir 'Optional path to the tinty data directory' | ||
cand -h 'Print help' | ||
cand --help 'Print help' | ||
} | ||
&'tinty;update'= { | ||
cand -c 'Optional path to the tinty config.toml file' | ||
cand --config 'Optional path to the tinty config.toml file' | ||
cand -d 'Optional path to the tinty data directory' | ||
cand --data-dir 'Optional path to the tinty data directory' | ||
cand -h 'Print help' | ||
cand --help 'Print help' | ||
} | ||
&'tinty;help'= { | ||
cand current 'Prints the last scheme name applied' | ||
cand generate-completion 'Generates a shell completion script' | ||
cand info 'Shows scheme colors for all schemes matching <scheme_system>-<scheme_name> (Eg: tinty info base16-mocha)' | ||
cand init 'Initializes with the exising config. Used to Initialize exising theme for when your shell starts up' | ||
cand list 'Lists available schemes' | ||
cand apply 'Applies a theme based on the chosen scheme' | ||
cand install 'Install the environment needed for tinty' | ||
cand update 'Update to the latest themes' | ||
cand help 'Print this message or the help of the given subcommand(s)' | ||
} | ||
&'tinty;help;current'= { | ||
} | ||
&'tinty;help;generate-completion'= { | ||
} | ||
&'tinty;help;info'= { | ||
} | ||
&'tinty;help;init'= { | ||
} | ||
&'tinty;help;list'= { | ||
} | ||
&'tinty;help;apply'= { | ||
} | ||
&'tinty;help;install'= { | ||
} | ||
&'tinty;help;update'= { | ||
} | ||
&'tinty;help;help'= { | ||
} | ||
] | ||
$completions[$command] | ||
} |
Oops, something went wrong.