mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-31 03:51:14 -03:00
completions/git: Shorten alias descriptions
I have an alias called "lg" for log --color --graph --pretty=format:\'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\' --abbrev-commit --first-parent Having that in my completions ensures that git commands essentially always use one column at most. That's not great, so we now shorten it to 35 chars (plus an annoying 2 for ".." because I can't be bothered to check for unicode support - an argument for a "string ellipsize", I guess?)
This commit is contained in:
@@ -732,8 +732,9 @@ function __fish_git_aliases
|
||||
begin
|
||||
set -l name (string replace -r '^.*\.' '' -- $key)
|
||||
# Only use the first line of the value as the description.
|
||||
set -l val (printf '%s\n' $value)[1]
|
||||
printf "%s\t%s\n" $name "Alias for $val"
|
||||
# Also shorten it to 35 chars.
|
||||
set -l val (printf '%s\n' $value | string replace -r '^(.{0,35}).+' '$1..')[1]
|
||||
printf "%s\t%s\n" $name "Alias: $val"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user