feat(fish): add shell shortcut registry

This commit was merged in pull request #62.
This commit is contained in:
2026-08-24 22:45:44 -04:00
parent 45c6d01b1f
commit cb59b18703
8 changed files with 136 additions and 35 deletions

View File

@@ -305,6 +305,54 @@
touch $out
'';
shell-shortcut-registry-fish-abbreviations =
let
testConfig = self.nixosConfigurations.neogaia.config;
user = testConfig.user.name;
shortcuts = testConfig.registry.shell-shortcut.${testConfig.networking.hostName};
fishConfig = testConfig.home-manager.users.${user}.programs.fish;
abbrs = fishConfig.shellAbbrs;
aliases = fishConfig.shellAliases;
expectedAliases = {
ls = "eza -alg --color=always --group-directories-first --icons=always";
la = "eza -a --color=always --group-directories-first --icons=always";
ll = "eza -lg --color=always --group-directories-first --icons=always";
lt = "eza -aT -I '.git' --color=always --group-directories-first --icons=always";
"l." = "eza -a | grep -e '^\\.'";
};
expectedAbbrs = {
".." = "cd ..";
"..." = "cd ../..";
"...." = "cd ../../..";
vi = "nvim";
vim = "nvim";
cp = "cp -v";
tmx = "tmux new-session -A -s";
hs = "herdr --session";
tarnow = "tar -acf ";
untar = "tar -zxvf ";
wget = "wget -c ";
grep = "grep --color=auto";
fgrep = "fgrep --color=auto";
egrep = "egrep --color=auto";
jctl = "journalctl -p 3 -xb";
update = "sudo nixos-rebuild switch --flake .#${testConfig.networking.hostName}";
cleanup = "sudo nix-collect-garbage -d";
};
in
pkgs.runCommand "shell-shortcut-registry-fish-abbreviations-check" { } ''
${
lib.optionalString (
!(
lib.mapAttrs (_name: shortcut: shortcut.command) shortcuts == (expectedAliases // expectedAbbrs)
&& lib.filterAttrs (name: _value: builtins.hasAttr name expectedAliases) aliases == expectedAliases
&& lib.filterAttrs (name: _value: builtins.hasAttr name expectedAbbrs) abbrs == expectedAbbrs
)
) "exit 1"
}
touch $out
'';
address-registry =
let
hostAddressConfig =