zsh: add just completion
This commit is contained in:
parent
9bfeb193df
commit
e3b6e5f60f
1 changed files with 38 additions and 0 deletions
|
@ -7,6 +7,40 @@ let
|
||||||
channelSources = (import ../../default.nix {
|
channelSources = (import ../../default.nix {
|
||||||
versionsPath = ../../variables/versions.nix;
|
versionsPath = ../../variables/versions.nix;
|
||||||
}).channelSources;
|
}).channelSources;
|
||||||
|
|
||||||
|
just-plugin =
|
||||||
|
let
|
||||||
|
plugin_file = pkgs.writeText "_just" ''
|
||||||
|
#compdef just
|
||||||
|
#autload
|
||||||
|
|
||||||
|
alias justl="\just --list"
|
||||||
|
alias juste="\just --evaluate"
|
||||||
|
|
||||||
|
local subcmds=()
|
||||||
|
|
||||||
|
while read -r line ; do
|
||||||
|
if [[ ! $line == Available* ]] ;
|
||||||
|
then
|
||||||
|
subcmds+=(''${line/[[:space:]]*\#/:})
|
||||||
|
fi
|
||||||
|
done < <(just --list)
|
||||||
|
|
||||||
|
_describe 'command' subcmds
|
||||||
|
'';
|
||||||
|
|
||||||
|
in pkgs.stdenv.mkDerivation {
|
||||||
|
name = "just-completions";
|
||||||
|
version = "0.1.0";
|
||||||
|
phases = "installPhase";
|
||||||
|
installPhase = ''
|
||||||
|
PLUGIN_PATH=$out/share/oh-my-zsh/plugins/just
|
||||||
|
mkdir -p $PLUGIN_PATH
|
||||||
|
cp ${plugin_file} $PLUGIN_PATH/_just
|
||||||
|
chmod --recursive a-w $out
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
in {
|
in {
|
||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -78,6 +112,10 @@ in {
|
||||||
name = "minikube";
|
name = "minikube";
|
||||||
src = "${pkgs.oh-my-zsh}/share/oh-my-zsh/plugins/minikube";
|
src = "${pkgs.oh-my-zsh}/share/oh-my-zsh/plugins/minikube";
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
name = "just";
|
||||||
|
src = "${just-plugin}/share/oh-my-zsh/plugins/just";
|
||||||
|
}
|
||||||
];
|
];
|
||||||
oh-my-zsh = {
|
oh-my-zsh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue