refactor: use __fish_palette in small utility functions (2/2)
25 duplicated declarations replaced by 7 calls. Completes the 33 structural conversions: 167 declarations removed, 33 calls added, and --structural confirms every one of the 33 diffs is declaration removals plus inserted calls only -- no rendering text touched. functions/y.fish is the one file in the repo with no trailing newline on main; its original file ending is preserved rather than normalised.
This commit is contained in:
@@ -27,11 +27,7 @@ function replay --description 'Run Bash commands replaying changes in Fish'
|
|||||||
case -v --version
|
case -v --version
|
||||||
echo "replay, version 1.2.1"
|
echo "replay, version 1.2.1"
|
||||||
case "" -h --help
|
case "" -h --help
|
||||||
set -l c_head (set_color --bold cyan)
|
__fish_palette
|
||||||
set -l c_cmd (set_color --bold)
|
|
||||||
set -l c_flag (set_color yellow)
|
|
||||||
set -l c_arg (set_color cyan)
|
|
||||||
set -l c_reset (set_color normal)
|
|
||||||
echo "$c_head""Usage:$c_reset $c_cmd""replay$c_reset $c_arg""<commands>$c_reset Run Bash commands replaying changes in Fish"
|
echo "$c_head""Usage:$c_reset $c_cmd""replay$c_reset $c_arg""<commands>$c_reset Run Bash commands replaying changes in Fish"
|
||||||
echo "$c_head""Options:$c_reset"
|
echo "$c_head""Options:$c_reset"
|
||||||
echo " $c_flag-v$c_reset or $c_flag--version$c_reset Print version"
|
echo " $c_flag-v$c_reset or $c_flag--version$c_reset Print version"
|
||||||
|
|||||||
@@ -52,10 +52,7 @@
|
|||||||
# NOTES
|
# NOTES
|
||||||
# Typo abbreviation: open-repo (expands to repo-open on space/enter).
|
# Typo abbreviation: open-repo (expands to repo-open on space/enter).
|
||||||
function repo-open --description 'Open the origin remote of the current repo in a browser'
|
function repo-open --description 'Open the origin remote of the current repo in a browser'
|
||||||
set -l c_head (set_color --bold cyan)
|
__fish_palette
|
||||||
set -l c_cmd (set_color --bold)
|
|
||||||
set -l c_flag (set_color yellow)
|
|
||||||
set -l c_reset (set_color normal)
|
|
||||||
|
|
||||||
argparse -X 0 h/help p/print r/root -- $argv
|
argparse -X 0 h/help p/print r/root -- $argv
|
||||||
or return 1
|
or return 1
|
||||||
|
|||||||
@@ -29,11 +29,7 @@ function spark --description 'Sparklines'
|
|||||||
if set --query _flag_version[1]
|
if set --query _flag_version[1]
|
||||||
echo "spark, version 1.1.0"
|
echo "spark, version 1.1.0"
|
||||||
else if set --query _flag_help[1]
|
else if set --query _flag_help[1]
|
||||||
set -l c_head (set_color --bold cyan)
|
__fish_palette
|
||||||
set -l c_cmd (set_color --bold)
|
|
||||||
set -l c_flag (set_color yellow)
|
|
||||||
set -l c_arg (set_color cyan)
|
|
||||||
set -l c_reset (set_color normal)
|
|
||||||
echo "$c_head""Usage:$c_reset $c_cmd""spark$c_reset $c_arg""<numbers ...>$c_reset"
|
echo "$c_head""Usage:$c_reset $c_cmd""spark$c_reset $c_arg""<numbers ...>$c_reset"
|
||||||
echo " stdin | $c_cmd""spark$c_reset"
|
echo " stdin | $c_cmd""spark$c_reset"
|
||||||
echo "$c_head""Options:$c_reset"
|
echo "$c_head""Options:$c_reset"
|
||||||
|
|||||||
@@ -31,8 +31,7 @@
|
|||||||
function split --description 'Run a command in a new terminal split'
|
function split --description 'Run a command in a new terminal split'
|
||||||
# Opinionated guard (C4): integrations disabled
|
# Opinionated guard (C4): integrations disabled
|
||||||
if not __fish_config_op_enabled (status current-function)
|
if not __fish_config_op_enabled (status current-function)
|
||||||
set -l c_err (set_color red)
|
__fish_palette
|
||||||
set -l c_reset (set_color normal)
|
|
||||||
echo "$c_err"'split: disabled by __fish_config_op_integrations'"$c_reset" >&2
|
echo "$c_err"'split: disabled by __fish_config_op_integrations'"$c_reset" >&2
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -26,8 +26,7 @@
|
|||||||
function spwin --wraps='~/.config/kitty/spawn-window.sh' --description 'spawn window in kitty or wezterm'
|
function spwin --wraps='~/.config/kitty/spawn-window.sh' --description 'spawn window in kitty or wezterm'
|
||||||
# Opinionated guard (C4): integrations disabled
|
# Opinionated guard (C4): integrations disabled
|
||||||
if not __fish_config_op_enabled (status current-function)
|
if not __fish_config_op_enabled (status current-function)
|
||||||
set -l c_err (set_color red)
|
__fish_palette
|
||||||
set -l c_reset (set_color normal)
|
|
||||||
echo "$c_err"'spwin: disabled by __fish_config_op_integrations'"$c_reset" >&2
|
echo "$c_err"'spwin: disabled by __fish_config_op_integrations'"$c_reset" >&2
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|||||||
+1
-2
@@ -27,8 +27,7 @@
|
|||||||
function tab --description 'Spawn a new tab in the current terminal'
|
function tab --description 'Spawn a new tab in the current terminal'
|
||||||
# Opinionated guard (C4): integrations disabled
|
# Opinionated guard (C4): integrations disabled
|
||||||
if not __fish_config_op_enabled (status current-function)
|
if not __fish_config_op_enabled (status current-function)
|
||||||
set -l c_err (set_color red)
|
__fish_palette
|
||||||
set -l c_reset (set_color normal)
|
|
||||||
echo "$c_err"'tab: disabled by __fish_config_op_integrations'"$c_reset" >&2
|
echo "$c_err"'tab: disabled by __fish_config_op_integrations'"$c_reset" >&2
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|||||||
+1
-5
@@ -25,11 +25,7 @@
|
|||||||
function y --description 'Yank to clipboard'
|
function y --description 'Yank to clipboard'
|
||||||
# Check for help flag
|
# Check for help flag
|
||||||
if contains -- -h $argv; or contains -- --help $argv
|
if contains -- -h $argv; or contains -- --help $argv
|
||||||
set -l c_head (set_color --bold cyan)
|
__fish_palette
|
||||||
set -l c_cmd (set_color --bold)
|
|
||||||
set -l c_arg (set_color cyan)
|
|
||||||
set -l c_dim (set_color brblack)
|
|
||||||
set -l c_reset (set_color normal)
|
|
||||||
echo "$c_head""Usage:$c_reset $c_cmd""y$c_reset $c_arg""[TEXT]$c_reset or $c_arg""[COMMAND]$c_reset | $c_cmd""y$c_reset"
|
echo "$c_head""Usage:$c_reset $c_cmd""y$c_reset $c_arg""[TEXT]$c_reset or $c_arg""[COMMAND]$c_reset | $c_cmd""y$c_reset"
|
||||||
echo ""
|
echo ""
|
||||||
echo "$c_head""Examples:$c_reset"
|
echo "$c_head""Examples:$c_reset"
|
||||||
|
|||||||
Reference in New Issue
Block a user