Add fish shell functions and abbreviations
Add nomad-ui function, --np contextual expansion, and related abbreviations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2073876eaf
commit
7156981e57
1 changed files with 22 additions and 0 deletions
|
|
@ -20,6 +20,13 @@ in {
|
|||
'';
|
||||
|
||||
functions = {
|
||||
nomad-ui = {
|
||||
description = "Fetches the Nomad management token from alvin and opens the authenticated UI";
|
||||
body = ''
|
||||
set -gx NOMAD_TOKEN (ssh root@alvin cat /var/lib/nomad-acl/management.token)
|
||||
nomad ui -authenticate
|
||||
'';
|
||||
};
|
||||
agx = {
|
||||
wraps = "ag";
|
||||
description = "Runs ag on the given string and returns a list of selectable references of the result. The selection is then opened in the editor.";
|
||||
|
|
@ -27,6 +34,17 @@ in {
|
|||
hx (ag $search $argv[2..] | fzf | cut -d : -f 1,2)
|
||||
'';
|
||||
};
|
||||
__np_expand = {
|
||||
description = "Expands --np contextually: --pp for bat/cat, --no-pager otherwise";
|
||||
body = ''
|
||||
set -l cmd (commandline -po)[1]
|
||||
if test "$cmd" = bat -o "$cmd" = cat
|
||||
echo -- --pp
|
||||
else
|
||||
echo -- --no-pager
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
preferAbbrs = true;
|
||||
|
|
@ -52,6 +70,10 @@ in {
|
|||
position = "anywhere";
|
||||
expansion = "--color";
|
||||
};
|
||||
"--np" = {
|
||||
position = "anywhere";
|
||||
function = "__np_expand";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue