mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2024-12-02 22:13:47 +08:00
5829ff0f5a
- removed code that fetches completions frim gitignore.io each time fish is started -- makes logins slow! - gi.load becomes gi.fish, only contains gi function - add _update_gi_completions.fish: fetches list of completions from gitignore.io and places it into ~/.config/fish/completions - modify gi function to accept update-completions argument
22 lines
585 B
Fish
22 lines
585 B
Fish
function _update_gi_completions -d "Update completions for gitignore.io"
|
|
set compl_dir ~/.config/fish/completions
|
|
set compl_file "$compl_dir/gi.fish"
|
|
|
|
# Download list of ignore types
|
|
set -l gi_list (gi list | tr ',' ' ')
|
|
if test -z $gi_list
|
|
echo "No result returned from gitignore.io" >&2
|
|
return 1
|
|
end
|
|
|
|
# Backup existing completions
|
|
if test -e $compl_file
|
|
mv -f $compl_file {$compl_file}.bak
|
|
else if not test -d $compl_dir
|
|
mkdir -p $compl_dir
|
|
end
|
|
|
|
# Output new completions
|
|
echo complete -c gi -a \"update-completions $gi_list\" >$compl_file
|
|
end
|