refactor: function, var names & spacing

- _fisher_fishfile_load→_fisher_fishfile_read
This commit is contained in:
Jorge Bucaran 2018-10-14 01:57:44 +09:00
parent 77fc030c03
commit 24e9154688
No known key found for this signature in database
GPG key ID: E54BA3C0E646DB30

View file

@ -162,7 +162,7 @@ function _fisher_commit
end end
printf "%s\n" (_fisher_fishfile_format (echo -s $argv\;) < $fishfile) > $fishfile printf "%s\n" (_fisher_fishfile_format (echo -s $argv\;) < $fishfile) > $fishfile
set -l expected_pkgs (_fisher_fishfile_load < $fishfile) set -l expected_pkgs (_fisher_fishfile_read < $fishfile)
set -l added_pkgs (_fisher_pkg_fetch_all $expected_pkgs) set -l added_pkgs (_fisher_pkg_fetch_all $expected_pkgs)
set -l updated_pkgs ( set -l updated_pkgs (
for pkg in $removed_pkgs for pkg in $removed_pkgs
@ -257,10 +257,8 @@ function _fisher_pkg_fetch_all
for pkg in $local_pkgs for pkg in $local_pkgs
set -l path local/$USER set -l path local/$USER
set -l name (command basename $pkg) set -l name (command basename $pkg)
command mkdir -p $fisher_config/$path command mkdir -p $fisher_config/$path
command ln -sf $pkg $fisher_config/$path command ln -sf $pkg $fisher_config/$path
set actual_pkgs $actual_pkgs $path/$name set actual_pkgs $actual_pkgs $path/$name
_fisher_pkg_install $fisher_config/$path/$name _fisher_pkg_install $fisher_config/$path/$name
end end
@ -277,7 +275,7 @@ function _fisher_pkg_get_deps
if test ! -d "$path" if test ! -d "$path"
echo $pkg echo $pkg
else if test -s "$path/fishfile" else if test -s "$path/fishfile"
_fisher_pkg_get_deps (_fisher_fishfile_format < $path/fishfile | _fisher_fishfile_load) _fisher_pkg_get_deps (_fisher_fishfile_format < $path/fishfile | _fisher_fishfile_read)
end end
end end
end end
@ -343,6 +341,10 @@ function _fisher_pkg_uninstall -a pkg
end end
end end
function _fisher_fishfile_read
command awk -v FS=\# '!/^#/ && NF { print $1 }'
end
function _fisher_fishfile_format -a pkgs function _fisher_fishfile_format -a pkgs
command awk -v PWD=$PWD -v HOME=$HOME -v PKGS="$pkgs" ' command awk -v PWD=$PWD -v HOME=$HOME -v PKGS="$pkgs" '
BEGIN { BEGIN {
@ -387,10 +389,6 @@ function _fisher_fishfile_format -a pkgs
' '
end end
function _fisher_fishfile_load
command awk -v FS=\# '!/^#/ && NF { print $1 }'
end
function _fisher_status -a added updated removed elapsed function _fisher_status -a added updated removed elapsed
command awk -v ADDED=$added -v UPDATED=$updated -v REMOVED=$removed -v ELAPSED=$elapsed ' command awk -v ADDED=$added -v UPDATED=$updated -v REMOVED=$removed -v ELAPSED=$elapsed '
BEGIN { BEGIN {