mirror of
https://github.com/IlanCosman/tide.git
synced 2024-08-16 19:50:22 +03:00
Move tide subcommands into functions folder
This commit is contained in:
parent
b50bc36b69
commit
d6b4cc78c1
@ -1,8 +1,9 @@
|
||||
set -l uninstallIndex (contains -i uninstall $_tide_subcommands)
|
||||
set -l subcommandsWithoutUninstall (printf '%s ' $_tide_subcommands[1..(math $uninstallIndex-1)] $_tide_subcommands[(math $uninstallIndex+1)..-1])
|
||||
set -l subcommands (basename -s '.fish' $__fish_config_dir/functions/_tide_sub_* | string replace '_tide_sub_' '')
|
||||
set -l uninstallIndex (contains -i uninstall $subcommands)
|
||||
set -l subcommandsWithoutUninstall (printf '%s ' $subcommands[1..(math $uninstallIndex-1)] $subcommands[(math $uninstallIndex+1)..-1])
|
||||
|
||||
# Disable file completions for the entire command
|
||||
complete -c tide -f
|
||||
|
||||
# Offer subcommands if no subcommand has been given so far
|
||||
complete -c tide -n "not __fish_seen_subcommand_from $subcommandsWithoutUninstall" -a $subcommandsWithoutUninstall
|
||||
# Offer subcommands (without uninstall) if no subcommand has been given so far
|
||||
complete -c tide -n "not __fish_seen_subcommand_from $subcommands" -a $subcommandsWithoutUninstall
|
@ -1,4 +1,4 @@
|
||||
function tide_bug-report
|
||||
function _tide_sub_bug-report
|
||||
for var in $_tide_var_list
|
||||
printf '%s\n' "$var $$var"
|
||||
end
|
@ -1,4 +1,4 @@
|
||||
function tide_configure
|
||||
function _tide_sub_configure
|
||||
if test $COLUMNS -lt 55 || test $LINES -lt 21
|
||||
printf '%s\n' 'Terminal size too small; must be at least 55 x 21'
|
||||
return 1
|
@ -1,4 +1,4 @@
|
||||
function tide_help -a subcommand
|
||||
function _tide_sub_help -a subcommand
|
||||
set -g b (set_color -o)
|
||||
set -g n (set_color normal)
|
||||
set -g g (set_color $_tide_color_green)
|
@ -1,4 +1,4 @@
|
||||
function tide_test
|
||||
function _tide_sub_test
|
||||
argparse 'h/help' 'v/verbose' 'a/all' 'i/install' -- $argv
|
||||
|
||||
if set -q _flag_help
|
@ -1,4 +1,4 @@
|
||||
function tide_uninstall
|
||||
function _tide_sub_uninstall
|
||||
if not _user_confirm_defaultNo 'Uninstall tide theme?'
|
||||
printf '%s\n' 'Aborted uninstall.'
|
||||
return 1
|
@ -7,13 +7,9 @@ function tide
|
||||
return 0
|
||||
end
|
||||
|
||||
set -l actual_command_name "tide_$subcommand"
|
||||
|
||||
if contains $subcommand $_tide_subcommands
|
||||
source "$_tide_dir/functions/$subcommand.fish"
|
||||
$actual_command_name $argv[2..-1]
|
||||
if functions -q _tide_sub_$subcommand
|
||||
_tide_sub_$subcommand $argv[2..-1]
|
||||
else
|
||||
tide help
|
||||
end
|
||||
functions -e $actual_command_name
|
||||
end
|
@ -79,7 +79,6 @@ function _set_immutables
|
||||
|
||||
_set_immutable _tide_version 2.0.0
|
||||
_set_immutable _tide_dir "$__fish_config_dir/tide_theme"
|
||||
_set_immutable _tide_subcommands (basename -s '.fish' $_tide_dir/functions/*)
|
||||
# --------------Colors--------------
|
||||
_set_immutable _tide_color_green 5FD700
|
||||
_set_immutable _tide_color_light_blue 00AFFF
|
||||
|
Loading…
Reference in New Issue
Block a user