mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-02 22:21:15 -03:00
Restyle fishscript and python
This commit is contained in:
@@ -51,21 +51,21 @@ function __npm_find_package_json
|
||||
end
|
||||
|
||||
function __npm_installed_global_packages
|
||||
set -l prefix (npm prefix -g)
|
||||
set -l node_modules "$prefix/lib/node_modules"
|
||||
set -l prefix (npm prefix -g)
|
||||
set -l node_modules "$prefix/lib/node_modules"
|
||||
|
||||
for path in $node_modules/*
|
||||
set -l mod (path basename -- $path)
|
||||
for path in $node_modules/*
|
||||
set -l mod (path basename -- $path)
|
||||
|
||||
if string match -rq "^@" $mod
|
||||
for sub_path in $path/*
|
||||
set -l sub_mod (string split '/' $sub_path)[-1]
|
||||
echo $mod/$sub_mod
|
||||
end
|
||||
else
|
||||
echo $mod
|
||||
end
|
||||
end
|
||||
if string match -rq "^@" $mod
|
||||
for sub_path in $path/*
|
||||
set -l sub_mod (string split '/' $sub_path)[-1]
|
||||
echo $mod/$sub_mod
|
||||
end
|
||||
else
|
||||
echo $mod
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function __npm_installed_local_packages
|
||||
|
||||
@@ -30,7 +30,7 @@ BEGIN {
|
||||
print pkg "\t" desc
|
||||
}
|
||||
pkg="" # Prevent multiple description translations from being printed
|
||||
}' < /var/lib/dpkg/status
|
||||
}' </var/lib/dpkg/status
|
||||
else
|
||||
awk '
|
||||
BEGIN {
|
||||
@@ -54,6 +54,6 @@ BEGIN {
|
||||
print pkg "\t" desc
|
||||
installed=0 # Prevent multiple description translations from being printed
|
||||
}
|
||||
}' < /var/lib/dpkg/status
|
||||
}' </var/lib/dpkg/status
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,7 +38,7 @@ function fish_config --description "Launch fish's web based configuration"
|
||||
end
|
||||
|
||||
# Variables a theme is allowed to set
|
||||
set -l theme_var_filter '^fish_(?:pager_)?color.*$';
|
||||
set -l theme_var_filter '^fish_(?:pager_)?color.*$'
|
||||
|
||||
switch $cmd
|
||||
case prompt
|
||||
|
||||
@@ -35,7 +35,7 @@ function fish_fossil_prompt --description 'Write out the fossil prompt'
|
||||
set -q fish_prompt_fossil_status_renamed
|
||||
or set -g fish_prompt_fossil_status_renamed '⇒'
|
||||
set -q fish_prompt_fossil_status_deleted
|
||||
or set -g fish_prompt_fossil_status_deleted '-'
|
||||
or set -g fish_prompt_fossil_status_deleted -
|
||||
set -q fish_prompt_fossil_status_missing
|
||||
or set -g fish_prompt_fossil_status_missing '✖'
|
||||
set -q fish_prompt_fossil_status_untracked
|
||||
@@ -43,25 +43,25 @@ function fish_fossil_prompt --description 'Write out the fossil prompt'
|
||||
set -q fish_prompt_fossil_status_conflict
|
||||
or set -g fish_prompt_fossil_status_conflict '×'
|
||||
|
||||
set -q fish_prompt_fossil_status_order
|
||||
or set -g fish_prompt_fossil_status_order added modified renamed deleted missing untracked conflict
|
||||
set -q fish_prompt_fossil_status_order
|
||||
or set -g fish_prompt_fossil_status_order added modified renamed deleted missing untracked conflict
|
||||
|
||||
|
||||
|
||||
echo -n ' ('
|
||||
set_color magenta
|
||||
echo -n "$branch"
|
||||
set_color normal
|
||||
echo -n '|'
|
||||
#set -l repo_status (fossil changes --differ 2>/dev/null | string match -rv '\w:|^\s' | string split " " -f1 | sort -u)
|
||||
set -l repo_status (fossil changes --differ 2>/dev/null | string match -rv '\w:|^\s' | string split " " -f1 | path sort -u)
|
||||
set_color magenta
|
||||
echo -n "$branch"
|
||||
set_color normal
|
||||
echo -n '|'
|
||||
#set -l repo_status (fossil changes --differ 2>/dev/null | string match -rv '\w:|^\s' | string split " " -f1 | sort -u)
|
||||
set -l repo_status (fossil changes --differ 2>/dev/null | string match -rv '\w:|^\s' | string split " " -f1 | path sort -u)
|
||||
|
||||
# Show nice color for a clean repo
|
||||
if test -z "$repo_status"
|
||||
set_color $fish_color_fossil_clean
|
||||
echo -n '✔'
|
||||
|
||||
# Handle modified or dirty (unknown state)
|
||||
# Handle modified or dirty (unknown state)
|
||||
else
|
||||
set -l fossil_statuses
|
||||
|
||||
@@ -70,19 +70,19 @@ function fish_fossil_prompt --description 'Write out the fossil prompt'
|
||||
|
||||
# Add a character for each file status if we have one
|
||||
switch $line
|
||||
case 'ADDED'
|
||||
case ADDED
|
||||
set -a fossil_statuses added
|
||||
case 'EDITED'
|
||||
case EDITED
|
||||
set -a fossil_statuses modified
|
||||
case 'EXTRA'
|
||||
case EXTRA
|
||||
set -a fossil_statuses untracked
|
||||
case 'DELETED'
|
||||
case DELETED
|
||||
set -a fossil_statuses deleted
|
||||
case 'MISSING'
|
||||
case MISSING
|
||||
set -a fossil_statuses missing
|
||||
case 'RENAMED'
|
||||
case RENAMED
|
||||
set -a fossil_statuses renamed
|
||||
case 'CONFLICT'
|
||||
case CONFLICT
|
||||
set -a fossil_statuses conflict
|
||||
end
|
||||
end
|
||||
@@ -94,7 +94,7 @@ function fish_fossil_prompt --description 'Write out the fossil prompt'
|
||||
end
|
||||
|
||||
echo -n '⚡'
|
||||
set_color normal
|
||||
set_color normal
|
||||
|
||||
# Sort status symbols
|
||||
for i in $fish_prompt_fossil_status_order
|
||||
|
||||
@@ -50,7 +50,7 @@ function trap -d 'Perform an action when the shell receives a signal'
|
||||
if test -n "$sig"
|
||||
set -l sw --on-signal $sig
|
||||
if string match -qi exit -- $sig
|
||||
set sw --on-event fish_exit
|
||||
set sw --on-event fish_exit
|
||||
end
|
||||
echo "function __trap_handler_$sig $sw; $cmd; end" | source
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user