mirror of
https://github.com/jorgebucaran/fisher
synced 2024-10-09 09:36:53 +02:00
One more push before 0.8.0, fixed bugs, paved the way for DEBUG mode.
* Add Mizuki to THANKS for help with Japanese translation of the QuickStart Guide. * fisher --list should return 1 (fail) if no plugins are installed. Closes #101. * More consistent style 'Usage' instead of 'usage'. * Silence index check in case $fisher_cache/.index does not exist. * Add more descriptive message if plugin is not found. * Silence search failure in case $fisher_cache/.index does not exist.
This commit is contained in:
parent
4b15cf374f
commit
e0ed629777
18 changed files with 47 additions and 42 deletions
17
THANKS.md
17
THANKS.md
|
@ -1,12 +1,11 @@
|
||||||
# Thank You
|
# Thank You
|
||||||
|
|
||||||
The following individuals have contributed to Fisherman.
|
The following individuals have contributed to Fisherman. :heart:
|
||||||
|
|
||||||
* Daniel Perez @tuvistavie
|
* [Daniel Perez](https://github.com/tuvistavie)
|
||||||
* Daniele Sluijters @daenney
|
* [Daniele Sluijters](https://github.com/daenney)
|
||||||
* Hyeon Kim @simnalamburt
|
* [Hyeon Kim](https://github.com/simnalamburt)
|
||||||
* Ian @ViViDboarder
|
* [Ian](https://github.com/ViViDboarder)
|
||||||
* Jorge Bucaran @bucaran
|
* [Jorge Bucaran](https://github.com/bucaran)
|
||||||
* Kevin Ballard @kballard
|
* [Kevin Ballard](https://github.com/kballard)
|
||||||
|
* [Mizuki Fujiwara](https://github.com/zukif)
|
||||||
:heart:
|
|
||||||
|
|
|
@ -27,10 +27,6 @@ for option in commands guides
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if test ! -e $fisher_cache/.index
|
|
||||||
exit
|
|
||||||
end
|
|
||||||
|
|
||||||
set -l plugins (
|
set -l plugins (
|
||||||
if test -s $fisher_file
|
if test -s $fisher_file
|
||||||
__fisher_file < $fisher_file | __fisher_name
|
__fisher_file < $fisher_file | __fisher_name
|
||||||
|
@ -38,7 +34,12 @@ set -l plugins (
|
||||||
)
|
)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
awk -F '\n' -v RS='' -v OFS=';' '/^ *#/ { next } { print $1, $3 }' $fisher_cache/.index
|
awk -F '\n' -v RS='' -v OFS=';' '
|
||||||
|
|
||||||
|
/^ *#/ { next } { print $1, $3 }
|
||||||
|
|
||||||
|
' $fisher_cache/.index ^ /dev/null
|
||||||
|
|
||||||
__fisher_cache_list
|
__fisher_cache_list
|
||||||
|
|
||||||
end | sort -ut ';' -k1,1 | while read -l name info
|
end | sort -ut ';' -k1,1 | while read -l name info
|
||||||
|
@ -48,4 +49,5 @@ end | sort -ut ';' -k1,1 | while read -l name info
|
||||||
else
|
else
|
||||||
complete -c fisher -n "__fish_seen_subcommand_from i install" -a "$name" -d "$info"
|
complete -c fisher -n "__fish_seen_subcommand_from i install" -a "$name" -d "$info"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,13 +10,19 @@ function __fisher_list -a source
|
||||||
|
|
||||||
case "" all cache
|
case "" all cache
|
||||||
set -l enabled (__fisher_list $fisher_file)
|
set -l enabled (__fisher_list $fisher_file)
|
||||||
|
set -l cache (__fisher_cache_list)
|
||||||
|
|
||||||
|
if test -z "$cache"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
set -l legend " "
|
set -l legend " "
|
||||||
|
|
||||||
if test -z "$enabled"
|
if test -z "$enabled"
|
||||||
set legend ""
|
set legend ""
|
||||||
end
|
end
|
||||||
|
|
||||||
for i in (__fisher_cache_list)
|
for i in $cache
|
||||||
if contains -- $i $enabled
|
if contains -- $i $enabled
|
||||||
if test $i = "$fisher_prompt"
|
if test $i = "$fisher_prompt"
|
||||||
printf "%s%s\n" ">" $i
|
printf "%s%s\n" ">" $i
|
||||||
|
|
|
@ -59,9 +59,7 @@ function fisher -d "Fish Plugin Manager"
|
||||||
eval "fisher_$value" (printf "%s\n" "'"$argv"'")
|
eval "fisher_$value" (printf "%s\n" "'"$argv"'")
|
||||||
|
|
||||||
case list
|
case list
|
||||||
if not __fisher_list $value
|
__fisher_list $value
|
||||||
return 1
|
|
||||||
end
|
|
||||||
|
|
||||||
case version
|
case version
|
||||||
sed 's/^/fisher version /;q' $fisher_home/VERSION
|
sed 's/^/fisher version /;q' $fisher_home/VERSION
|
||||||
|
@ -71,7 +69,7 @@ function fisher -d "Fish Plugin Manager"
|
||||||
set value commands
|
set value commands
|
||||||
end
|
end
|
||||||
|
|
||||||
printf "usage: fisher <command> [<args>] [--list] [--version] [--help]\n\n"
|
printf "Usage: fisher <command> [<args>] [--list] [--version] [--help]\n\n"
|
||||||
|
|
||||||
switch commands
|
switch commands
|
||||||
case $value
|
case $value
|
||||||
|
|
|
@ -33,7 +33,7 @@ function fisher_help -d "Show Help"
|
||||||
set option help
|
set option help
|
||||||
|
|
||||||
case h
|
case h
|
||||||
printf "usage: fisher help [<keyword>] [--all] [--guides] [--help]\n\n"
|
printf "Usage: fisher help [<keyword>] [--all] [--guides] [--help]\n\n"
|
||||||
|
|
||||||
printf " -a --all List available documentation\n"
|
printf " -a --all List available documentation\n"
|
||||||
printf " -g --guides List available guides\n"
|
printf " -g --guides List available guides\n"
|
||||||
|
|
|
@ -17,7 +17,7 @@ function fisher_install -d "Install Plugins"
|
||||||
set stderr /dev/null
|
set stderr /dev/null
|
||||||
|
|
||||||
case h
|
case h
|
||||||
printf "usage: fisher install [<plugins>] [--force] [--quiet] [--help]\n\n"
|
printf "Usage: fisher install [<plugins>] [--force] [--quiet] [--help]\n\n"
|
||||||
|
|
||||||
printf " -f --force Reinstall given plugin/s\n"
|
printf " -f --force Reinstall given plugin/s\n"
|
||||||
printf " -q --quiet Enable quiet mode\n"
|
printf " -q --quiet Enable quiet mode\n"
|
||||||
|
@ -72,7 +72,7 @@ function fisher_install -d "Install Plugins"
|
||||||
|
|
||||||
else
|
else
|
||||||
set total (math $total - 1)
|
set total (math $total - 1)
|
||||||
printf "fisher: '%s' not found.\n" $item > $stderr
|
printf "fisher: '%s' not found or index out of date.\n" $item > $stderr
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ function fisher_search -d "Search Plugins"
|
||||||
set quiet 1
|
set quiet 1
|
||||||
|
|
||||||
case h
|
case h
|
||||||
printf "usage: fisher search [<plugins>] [--and|--or] [--quiet] [--help]\n\n"
|
printf "Usage: fisher search [<plugins>] [--and|--or] [--quiet] [--help]\n\n"
|
||||||
|
|
||||||
printf " *--<field> Filter by url, name, info, author or tags\n"
|
printf " *--<field> Filter by url, name, info, author or tags\n"
|
||||||
printf " -o --or Join query with OR operator\n"
|
printf " -o --or Join query with OR operator\n"
|
||||||
|
@ -135,7 +135,7 @@ function fisher_search -d "Search Plugins"
|
||||||
author = \$5
|
author = \$5
|
||||||
}
|
}
|
||||||
|
|
||||||
$query { print $fields } " $index | awk -v quiet=$quiet '
|
$query { print $fields } " $index ^ /dev/null | awk -v quiet=$quiet '
|
||||||
|
|
||||||
!/^ *$/ { hasRecords = 1 } {
|
!/^ *$/ { hasRecords = 1 } {
|
||||||
if (quiet) {
|
if (quiet) {
|
||||||
|
|
|
@ -17,7 +17,7 @@ function fisher_uninstall -d "Uninstall Plugins"
|
||||||
set stderr /dev/null
|
set stderr /dev/null
|
||||||
|
|
||||||
case h
|
case h
|
||||||
printf "usage: fisher uninstall [<plugins>] [--force] [--quiet] [--help]\n\n"
|
printf "Usage: fisher uninstall [<plugins>] [--force] [--quiet] [--help]\n\n"
|
||||||
|
|
||||||
printf " -f --force Delete copy from cache\n"
|
printf " -f --force Delete copy from cache\n"
|
||||||
printf " -q --quiet Enable quiet mode\n"
|
printf " -q --quiet Enable quiet mode\n"
|
||||||
|
|
|
@ -18,7 +18,7 @@ function fisher_update -d "Update Plugins/Fisherman"
|
||||||
set stderr /dev/null
|
set stderr /dev/null
|
||||||
|
|
||||||
case h
|
case h
|
||||||
printf "usage: fisher update [<plugins>] [--quiet] [--help]\n\n"
|
printf "Usage: fisher update [<plugins>] [--quiet] [--help]\n\n"
|
||||||
printf " -q --quiet Enable quiet mode\n"
|
printf " -q --quiet Enable quiet mode\n"
|
||||||
printf " -h --help Show usage help\n"
|
printf " -h --help Show usage help\n"
|
||||||
return
|
return
|
||||||
|
|
|
@ -106,7 +106,7 @@ function fish
|
||||||
set flags $flags $value
|
set flags $flags $value
|
||||||
|
|
||||||
case h help
|
case h help
|
||||||
printf "usage: $_ [OPTIONS] [\-c command] [FILE [ARGUMENTS\.\.\.]]\en"
|
printf "Usage: $_ [OPTIONS] [\-c command] [FILE [ARGUMENTS\.\.\.]]\en"
|
||||||
return
|
return
|
||||||
|
|
||||||
case \e*
|
case \e*
|
||||||
|
|
|
@ -78,7 +78,7 @@ function fish
|
||||||
set flags $flags $value
|
set flags $flags $value
|
||||||
|
|
||||||
case h help
|
case h help
|
||||||
printf "usage: $_ [OPTIONS] [-c command] [FILE [ARGUMENTS...]]\n"
|
printf "Usage: $_ [OPTIONS] [-c command] [FILE [ARGUMENTS...]]\n"
|
||||||
return
|
return
|
||||||
|
|
||||||
case \*
|
case \*
|
||||||
|
|
|
@ -79,7 +79,7 @@ The following example implements a command to retrieve plugin information and fo
|
||||||
function fisher_info \-d "Display information about plugins"
|
function fisher_info \-d "Display information about plugins"
|
||||||
switch "$argv"
|
switch "$argv"
|
||||||
case \-h \-\-help
|
case \-h \-\-help
|
||||||
printf "usage: fisher info name | URL [\.\.\.]\en\en"
|
printf "Usage: fisher info name | URL [\.\.\.]\en\en"
|
||||||
printf " \-h \-\-help Show usage help\en"
|
printf " \-h \-\-help Show usage help\en"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -46,7 +46,7 @@ The following example implements a command to retrieve plugin information and fo
|
||||||
function fisher_info -d "Display information about plugins"
|
function fisher_info -d "Display information about plugins"
|
||||||
switch "$argv"
|
switch "$argv"
|
||||||
case -h --help
|
case -h --help
|
||||||
printf "usage: fisher info name | URL [...]\n\n"
|
printf "Usage: fisher info name | URL [...]\n\n"
|
||||||
printf " -h --help Show usage help\n"
|
printf " -h --help Show usage help\n"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -109,7 +109,7 @@ cat > wtc\.fish
|
||||||
function wtc \-d "Generate a random commit message"
|
function wtc \-d "Generate a random commit message"
|
||||||
switch "$argv"
|
switch "$argv"
|
||||||
case \-h \-\-help
|
case \-h \-\-help
|
||||||
printf "usage: wtc [\-\-help]\en\en"
|
printf "Usage: wtc [\-\-help]\en\en"
|
||||||
printf " \-h \-\-help Show usage help\en"
|
printf " \-h \-\-help Show usage help\en"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -71,7 +71,7 @@ cat > wtc.fish
|
||||||
function wtc -d "Generate a random commit message"
|
function wtc -d "Generate a random commit message"
|
||||||
switch "$argv"
|
switch "$argv"
|
||||||
case -h --help
|
case -h --help
|
||||||
printf "usage: wtc [--help]\n\n"
|
printf "Usage: wtc [--help]\n\n"
|
||||||
printf " -h --help Show usage help\n"
|
printf " -h --help Show usage help\n"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ function -S setup
|
||||||
|
|
||||||
function fisher_$mock_command
|
function fisher_$mock_command
|
||||||
if not set -q argv[1]
|
if not set -q argv[1]
|
||||||
echo usage:...
|
echo Usage:...
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
awk $argv
|
awk $argv
|
||||||
|
@ -17,7 +17,7 @@ function -S teardown
|
||||||
end
|
end
|
||||||
|
|
||||||
test "$TESTNAME - Evaluate `fisher_' (sub) commands"
|
test "$TESTNAME - Evaluate `fisher_' (sub) commands"
|
||||||
(fisher $mock_command) = usage:...
|
(fisher $mock_command) = Usage:...
|
||||||
end
|
end
|
||||||
|
|
||||||
test "$TESTNAME - Commands can read standard input"
|
test "$TESTNAME - Commands can read standard input"
|
||||||
|
@ -33,7 +33,7 @@ test "$TESTNAME - Handle \$fisher_alias aliases"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "$TESTNAME - Display usage help"
|
test "$TESTNAME - Display usage help"
|
||||||
(fisher | sed 1q) = "usage: fisher <command> [<args>] [--list] [--version] [--help]"
|
(fisher | sed 1q) = "Usage: fisher <command> [<args>] [--list] [--version] [--help]"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "$TESTNAME - Display basic information about using the `help' command by default"
|
test "$TESTNAME - Display basic information about using the `help' command by default"
|
||||||
|
|
10
test/fixtures/help/usage.txt
vendored
10
test/fixtures/help/usage.txt
vendored
|
@ -1,25 +1,25 @@
|
||||||
usage: fisher update [<plugins>] [--quiet] [--help]
|
Usage: fisher update [<plugins>] [--quiet] [--help]
|
||||||
|
|
||||||
-q --quiet Enable quiet mode
|
-q --quiet Enable quiet mode
|
||||||
-h --help Show usage help
|
-h --help Show usage help
|
||||||
usage: fisher uninstall [<plugins>] [--force] [--quiet] [--help]
|
Usage: fisher uninstall [<plugins>] [--force] [--quiet] [--help]
|
||||||
|
|
||||||
-f --force Delete copy from cache
|
-f --force Delete copy from cache
|
||||||
-q --quiet Enable quiet mode
|
-q --quiet Enable quiet mode
|
||||||
-h --help Show usage help
|
-h --help Show usage help
|
||||||
usage: fisher search [<plugins>] [--and|--or] [--quiet] [--help]
|
Usage: fisher search [<plugins>] [--and|--or] [--quiet] [--help]
|
||||||
|
|
||||||
*--<field> Filter by url, name, info, author or tags
|
*--<field> Filter by url, name, info, author or tags
|
||||||
-o --or Join query with OR operator
|
-o --or Join query with OR operator
|
||||||
-a --and Join query with AND operator
|
-a --and Join query with AND operator
|
||||||
-q --quiet Enable quiet mode
|
-q --quiet Enable quiet mode
|
||||||
-h --help Show usage help
|
-h --help Show usage help
|
||||||
usage: fisher install [<plugins>] [--force] [--quiet] [--help]
|
Usage: fisher install [<plugins>] [--force] [--quiet] [--help]
|
||||||
|
|
||||||
-f --force Reinstall given plugin/s
|
-f --force Reinstall given plugin/s
|
||||||
-q --quiet Enable quiet mode
|
-q --quiet Enable quiet mode
|
||||||
-h --help Show usage help
|
-h --help Show usage help
|
||||||
usage: fisher help [<keyword>] [--all] [--guides] [--help]
|
Usage: fisher help [<keyword>] [--all] [--guides] [--help]
|
||||||
|
|
||||||
-a --all List available documentation
|
-a --all List available documentation
|
||||||
-g --guides List available guides
|
-g --guides List available guides
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
function -S setup
|
function -S setup
|
||||||
function foo
|
function foo
|
||||||
printf "%s\n" "usage: foo [options] ..."
|
printf "%s\n" "Usage foo [options] ..."
|
||||||
printf "%s\n" "options:"
|
printf "%s\n" "Options:"
|
||||||
printf "%s\n" " --version Show version"
|
printf "%s\n" " --version Show version"
|
||||||
printf "%s\n" " -h --help Show help"
|
printf "%s\n" " -h --help Show help"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue