punkfairie
60cb5740d7
Add .config/fish/functions/__ysu__check_aliases.fish Add .config/fish/functions/__ysu__check_git_aliases.fish Add .config/fish/functions/__ysu__check_hardcore.fish Add .config/fish/functions/__ysu__flush_buffer.fish Add .config/fish/functions/__ysu__get_field.fish Add .config/fish/functions/__ysu__message.fish Add .config/fish/functions/__ysu__set_default.fish Add .config/fish/functions/__ysu__set_field.fish Add .config/fish/functions/__ysu__write_buffer.fish
23 lines
875 B
Fish
23 lines
875 B
Fish
function __ysu__check_git_aliases \
|
|
--on-event fish_preexec
|
|
string match --quiet "sudo *" "$argv"; and return
|
|
|
|
if string match --quiet --regex "git *" "$argv"
|
|
set --local found false
|
|
git config --get-regexp "^alias\..+\$" | sort | while read key value
|
|
set key (string split --max 2 "." "$key")[2]
|
|
set --local escaped_key (string escape --no-quote --style=regex "$key")
|
|
|
|
string match --quiet --regex "$escaped_key" "$YSU__IGNORED_GIT_ALIASES"; and continue
|
|
|
|
set --local escaped_value (string escape --no-quote --style=regex "$value")
|
|
|
|
if string match --quiet --regex "git $escaped_value(?=\s|\$)" "$argv"
|
|
__ysu__message "git alias" "$value" "git $key"
|
|
set found true
|
|
end
|
|
end
|
|
|
|
"$found"; and __ysu__check_hardcore
|
|
end
|
|
end
|