Add logger function to fish config

This commit is contained in:
Nathan McCarty 2022-04-04 11:12:41 -04:00
parent 0ce999c076
commit c41b346b6f
Signed by: thatonelutenist
GPG Key ID: D70DA3DD4D1E9F96
1 changed files with 13 additions and 0 deletions

View File

@ -24,12 +24,25 @@
# Setup our aliases # Setup our aliases
shellAliases = { shellAliases = {
ls = "exa --icons"; ls = "exa --icons";
cat = "bat";
}; };
# Custom configuration # Custom configuration
interactiveShellInit = '' interactiveShellInit = ''
# Setup any-nix-shell # Setup any-nix-shell
any-nix-shell fish --info-right | source any-nix-shell fish --info-right | source
# Load logger function
source ~/.config/fish/functions/cmdlogger.fish
''; '';
functions = {
# Setup command logging to ~/.logs
cmdlogger = {
onEvent = "fish_preexec";
body = ''
mkdir -p ~/.logs
echo (date -u +"%Y-%m-%dT%H:%M:%SZ")" "(echo %self)" "(pwd)": "$argv >> ~/.logs/(hostname)-(date "+%Y-%m-%d").log
'';
};
};
}; };
# Starship, for the prompt # Starship, for the prompt
programs.starship = { programs.starship = {