style: format fish files with fish_indent
This commit is contained in:
@@ -80,69 +80,68 @@ set -g __fish_config_op_registry_keys \
|
||||
"zoxide:"
|
||||
|
||||
set -g __fish_config_op_registry_values \
|
||||
"autoexec/venv" \
|
||||
"logging/terminal-capture" \
|
||||
"autoexec/sync" \
|
||||
"logging/multiplexer-capture" \
|
||||
"integrations/terminal-abbrs" \
|
||||
"overrides/key-bindings" \
|
||||
"aliases/dev-tools" \
|
||||
"autoexec/sync" \
|
||||
"overrides/key-bindings" \
|
||||
"aliases/shell-tools" \
|
||||
"overrides/key-bindings" \
|
||||
"aliases/filesystem" \
|
||||
"aliases/dev-tools" \
|
||||
"aliases/filesystem" \
|
||||
"overrides/key-bindings" \
|
||||
"overrides/environment" \
|
||||
"overrides/environment" \
|
||||
"overrides/key-bindings" \
|
||||
"greeting/greeting-message" \
|
||||
"overrides/environment" \
|
||||
"overrides/environment" \
|
||||
"overrides/privacy" \
|
||||
"overrides/key-bindings" \
|
||||
"integrations/notifications" \
|
||||
"aliases/filesystem" \
|
||||
"aliases/dev-tools" \
|
||||
"autoexec/plugin-management" \
|
||||
"greeting/first-run" \
|
||||
"overrides/prompt" \
|
||||
"aliases/shell-tools" \
|
||||
"integrations/history-logs" \
|
||||
"overrides/key-bindings" \
|
||||
"logging/terminal-capture" \
|
||||
"logging/terminal-capture" \
|
||||
"aliases/shell-tools" \
|
||||
"integrations/history-logs" \
|
||||
"aliases/filesystem" \
|
||||
"aliases/filesystem" \
|
||||
"aliases/filesystem" \
|
||||
"autoexec/pkg-wrappers" \
|
||||
"logging/pkg-logs" \
|
||||
"aliases/network" \
|
||||
"overrides/key-bindings" \
|
||||
"aliases/search" \
|
||||
"aliases/filesystem" \
|
||||
"overrides/key-bindings" \
|
||||
"logging/terminal-capture" \
|
||||
"integrations/window-mgmt" \
|
||||
"integrations/window-mgmt" \
|
||||
"aliases/network" \
|
||||
"overrides/prompt" \
|
||||
"integrations/window-mgmt" \
|
||||
"overrides/prompt" \
|
||||
"logging/multiplexer-capture" \
|
||||
"aliases/monitor" \
|
||||
"aliases/filesystem" \
|
||||
"overrides/key-bindings" \
|
||||
"overrides/environment" \
|
||||
"integrations/pkg-upgrade" \
|
||||
"autoexec/telemetry" \
|
||||
"integrations/notifications" \
|
||||
"autoexec/pkg-wrappers" \
|
||||
"logging/pkg-logs" \
|
||||
"aliases/network" \
|
||||
"aliases/filesystem"
|
||||
|
||||
autoexec/venv \
|
||||
logging/terminal-capture \
|
||||
autoexec/sync \
|
||||
logging/multiplexer-capture \
|
||||
integrations/terminal-abbrs \
|
||||
overrides/key-bindings \
|
||||
aliases/dev-tools \
|
||||
autoexec/sync \
|
||||
overrides/key-bindings \
|
||||
aliases/shell-tools \
|
||||
overrides/key-bindings \
|
||||
aliases/filesystem \
|
||||
aliases/dev-tools \
|
||||
aliases/filesystem \
|
||||
overrides/key-bindings \
|
||||
overrides/environment \
|
||||
overrides/environment \
|
||||
overrides/key-bindings \
|
||||
greeting/greeting-message \
|
||||
overrides/environment \
|
||||
overrides/environment \
|
||||
overrides/privacy \
|
||||
overrides/key-bindings \
|
||||
integrations/notifications \
|
||||
aliases/filesystem \
|
||||
aliases/dev-tools \
|
||||
autoexec/plugin-management \
|
||||
greeting/first-run \
|
||||
overrides/prompt \
|
||||
aliases/shell-tools \
|
||||
integrations/history-logs \
|
||||
overrides/key-bindings \
|
||||
logging/terminal-capture \
|
||||
logging/terminal-capture \
|
||||
aliases/shell-tools \
|
||||
integrations/history-logs \
|
||||
aliases/filesystem \
|
||||
aliases/filesystem \
|
||||
aliases/filesystem \
|
||||
autoexec/pkg-wrappers \
|
||||
logging/pkg-logs \
|
||||
aliases/network \
|
||||
overrides/key-bindings \
|
||||
aliases/search \
|
||||
aliases/filesystem \
|
||||
overrides/key-bindings \
|
||||
logging/terminal-capture \
|
||||
integrations/window-mgmt \
|
||||
integrations/window-mgmt \
|
||||
aliases/network \
|
||||
overrides/prompt \
|
||||
integrations/window-mgmt \
|
||||
overrides/prompt \
|
||||
logging/multiplexer-capture \
|
||||
aliases/monitor \
|
||||
aliases/filesystem \
|
||||
overrides/key-bindings \
|
||||
overrides/environment \
|
||||
integrations/pkg-upgrade \
|
||||
autoexec/telemetry \
|
||||
integrations/notifications \
|
||||
autoexec/pkg-wrappers \
|
||||
logging/pkg-logs \
|
||||
aliases/network \
|
||||
aliases/filesystem
|
||||
|
||||
+19
-15
@@ -17,8 +17,10 @@ function expand_bang_all --description 'Execute expand_bang_all'
|
||||
__fish_config_op_enabled (status basename); or return 1
|
||||
|
||||
set -l token $argv[1]
|
||||
if test -z "$token"; set token (commandline -t); end
|
||||
|
||||
if test -z "$token"
|
||||
set token (commandline -t)
|
||||
end
|
||||
|
||||
set -l tokens (string split -n " " -- $history[1])
|
||||
if test (count $tokens) -gt 1
|
||||
echo -- (string join " " -- $tokens[2..-1])
|
||||
@@ -46,12 +48,14 @@ function expand_bang_minus_n --description 'Execute expand_bang_minus_n'
|
||||
__fish_config_op_enabled (status basename); or return 1
|
||||
|
||||
set -l token $argv[1]
|
||||
if test -z "$token"; set token (commandline -t); end
|
||||
|
||||
if test -z "$token"
|
||||
set token (commandline -t)
|
||||
end
|
||||
|
||||
# Extract the number from the regex match
|
||||
if string match -qr '!-(\d+)' -- "$token"
|
||||
set -l n (string match -r '!-(\d+)' -- "$token")[2]
|
||||
|
||||
|
||||
if test (count $history) -ge $n
|
||||
echo -- $history[$n]
|
||||
else
|
||||
@@ -71,20 +75,20 @@ function expand_bang_search --description 'Execute expand_bang_search'
|
||||
if test -z "$token"
|
||||
set token (commandline -t)
|
||||
end
|
||||
|
||||
|
||||
# Extract query: looks for text after !? and before an optional ?
|
||||
set -l query (string match -r '!\?([^?]+)' -- $token)[2]
|
||||
|
||||
|
||||
if test -n "$query"
|
||||
# Search history for a match anywhere in the command
|
||||
set -l match (builtin history search --contains --max=1 -- $query)
|
||||
|
||||
|
||||
if test -n "$match"
|
||||
echo -- $match
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
echo -- $token
|
||||
end
|
||||
|
||||
@@ -98,20 +102,20 @@ function expand_bang_string --description 'Execute expand_bang_string'
|
||||
if test -z "$token"
|
||||
set token (commandline -t)
|
||||
end
|
||||
|
||||
|
||||
# Remove the '!' to get the search query
|
||||
set -l query (string sub -s 2 -- $token)
|
||||
|
||||
|
||||
if test -n "$query"
|
||||
# Search history for a prefix match
|
||||
set -l match (builtin history search --prefix --max=1 -- $query)
|
||||
|
||||
|
||||
if test -n "$match"
|
||||
echo -- $match
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# If no match or empty query, return the token so it doesn't vanish
|
||||
echo -- $token
|
||||
end
|
||||
@@ -128,12 +132,12 @@ function expand_typo_sub --description 'Execute expand_typo_sub'
|
||||
if test -z "$current_token"
|
||||
set current_token (commandline -t)
|
||||
end
|
||||
|
||||
|
||||
if string match -qr '\^([^^]+)\^([^^]*)' -- "$current_token"
|
||||
set -l captured (string match -r '\^([^^]+)\^([^^]*)' -- "$current_token")
|
||||
set -l old $captured[2]
|
||||
set -l new $captured[3]
|
||||
|
||||
|
||||
if test -n "$old"
|
||||
# Using -- to ensure strings starting with '-' aren't treated as flags
|
||||
echo -- (string replace -a -- "$old" "$new" "$last_cmd")
|
||||
|
||||
@@ -60,7 +60,7 @@ printf '%s\n' \
|
||||
"cmd_str=\"$_paru_real\"" \
|
||||
'for arg in "$@"; do' \
|
||||
' cmd_str+=" $(printf '"'"'%q'"'"' "$arg")"' \
|
||||
'done' \
|
||||
done \
|
||||
'script -q -e -c "$cmd_str" "$log_file"' \
|
||||
'exit_code=$?' \
|
||||
'' \
|
||||
@@ -70,19 +70,18 @@ printf '%s\n' \
|
||||
'cleaner="${XDG_CONFIG_HOME:-$HOME/.config}/fish/scripts/clean_progress_log.py"' \
|
||||
'if command -v python3 >/dev/null 2>&1 && [[ -f "$cleaner" ]]; then' \
|
||||
' python3 "$cleaner" < "$log_file" > "${log_file}.tmp" 2>/dev/null && mv "${log_file}.tmp" "$log_file" || rm -f "${log_file}.tmp"' \
|
||||
'else' \
|
||||
else \
|
||||
' sed -i "/^Script \(started\|done\) on /d" "$log_file" 2>/dev/null || true' \
|
||||
'fi' \
|
||||
fi \
|
||||
'' \
|
||||
'max_files="${SCROLLBACK_HISTORY_MAX_FILES:-100}"' \
|
||||
'mapfile -t logs < <(ls -1t "$log_dir"/paru_*.log 2>/dev/null)' \
|
||||
'excess=$(( ${#logs[@]} - max_files ))' \
|
||||
'for (( i = ${#logs[@]} - 1; i >= ${#logs[@]} - excess && i >= 0; i-- )); do' \
|
||||
' rm -f "${logs[$i]}"' \
|
||||
'done' \
|
||||
done \
|
||||
'' \
|
||||
'exit $exit_code' \
|
||||
> $_paru_wrapper
|
||||
'exit $exit_code' >$_paru_wrapper
|
||||
|
||||
chmod +x $_paru_wrapper
|
||||
|
||||
|
||||
+27
-26
@@ -20,37 +20,38 @@ __fish_config_op_enabled (status basename) wakatime-autoexec; or exit
|
||||
__fish_config_op_enabled (status basename) wakatime-hook; or exit
|
||||
|
||||
function __register_wakatime_fish_before_exec -e fish_postexec
|
||||
if set -q FISH_WAKATIME_DISABLED
|
||||
return 0
|
||||
end
|
||||
|
||||
set -l exec_command_str
|
||||
if set -q FISH_WAKATIME_DISABLED
|
||||
return 0
|
||||
end
|
||||
|
||||
set exec_command_str (string split -f1 ' ' "$argv")
|
||||
set -l exec_command_str
|
||||
|
||||
if test "$exec_command_str" = 'exit'
|
||||
return 0
|
||||
end
|
||||
set exec_command_str (string split -f1 ' ' "$argv")
|
||||
|
||||
set -l PLUGIN_NAME "ik11235/wakatime.fish"
|
||||
set -l PLUGIN_VERSION "0.0.6"
|
||||
if test "$exec_command_str" = exit
|
||||
return 0
|
||||
end
|
||||
|
||||
set -l project
|
||||
set -l wakatime_path
|
||||
set -l PLUGIN_NAME "ik11235/wakatime.fish"
|
||||
set -l PLUGIN_VERSION "0.0.6"
|
||||
|
||||
if type -p wakatime 2>&1 > /dev/null
|
||||
set wakatime_path (type -p wakatime)
|
||||
else if type -p ~/.wakatime/wakatime-cli 2>&1 > /dev/null
|
||||
set wakatime_path (type -p ~/.wakatime/wakatime-cli)
|
||||
else
|
||||
return 1
|
||||
end
|
||||
set -l project
|
||||
set -l wakatime_path
|
||||
|
||||
if git rev-parse --is-inside-work-tree &> /dev/null
|
||||
set project (basename (git rev-parse --show-toplevel))
|
||||
else
|
||||
set project "Terminal"
|
||||
end
|
||||
if type -p wakatime 2>&1 >/dev/null
|
||||
set wakatime_path (type -p wakatime)
|
||||
else if type -p ~/.wakatime/wakatime-cli 2>&1 >/dev/null
|
||||
set wakatime_path (type -p ~/.wakatime/wakatime-cli)
|
||||
else
|
||||
return 1
|
||||
end
|
||||
|
||||
$wakatime_path --write --plugin "$PLUGIN_NAME/$PLUGIN_VERSION" --entity-type app --project "$project" --entity "$exec_command_str" &> /dev/null&; disown
|
||||
if git rev-parse --is-inside-work-tree &>/dev/null
|
||||
set project (basename (git rev-parse --show-toplevel))
|
||||
else
|
||||
set project Terminal
|
||||
end
|
||||
|
||||
$wakatime_path --write --plugin "$PLUGIN_NAME/$PLUGIN_VERSION" --entity-type app --project "$project" --entity "$exec_command_str" &>/dev/null &
|
||||
disown
|
||||
end
|
||||
|
||||
@@ -60,7 +60,7 @@ printf '%s\n' \
|
||||
"cmd_str=\"$_yay_real\"" \
|
||||
'for arg in "$@"; do' \
|
||||
' cmd_str+=" $(printf '"'"'%q'"'"' "$arg")"' \
|
||||
'done' \
|
||||
done \
|
||||
'script -q -e -c "$cmd_str" "$log_file"' \
|
||||
'exit_code=$?' \
|
||||
'' \
|
||||
@@ -70,19 +70,18 @@ printf '%s\n' \
|
||||
'cleaner="${XDG_CONFIG_HOME:-$HOME/.config}/fish/scripts/clean_progress_log.py"' \
|
||||
'if command -v python3 >/dev/null 2>&1 && [[ -f "$cleaner" ]]; then' \
|
||||
' python3 "$cleaner" < "$log_file" > "${log_file}.tmp" 2>/dev/null && mv "${log_file}.tmp" "$log_file" || rm -f "${log_file}.tmp"' \
|
||||
'else' \
|
||||
else \
|
||||
' sed -i "/^Script \(started\|done\) on /d" "$log_file" 2>/dev/null || true' \
|
||||
'fi' \
|
||||
fi \
|
||||
'' \
|
||||
'max_files="${SCROLLBACK_HISTORY_MAX_FILES:-100}"' \
|
||||
'mapfile -t logs < <(ls -1t "$log_dir"/yay_*.log 2>/dev/null)' \
|
||||
'excess=$(( ${#logs[@]} - max_files ))' \
|
||||
'for (( i = ${#logs[@]} - 1; i >= ${#logs[@]} - excess && i >= 0; i-- )); do' \
|
||||
' rm -f "${logs[$i]}"' \
|
||||
'done' \
|
||||
done \
|
||||
'' \
|
||||
'exit $exit_code' \
|
||||
> $_yay_wrapper
|
||||
'exit $exit_code' >$_yay_wrapper
|
||||
|
||||
chmod +x $_yay_wrapper
|
||||
|
||||
|
||||
Reference in New Issue
Block a user