mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 14:03:58 +00:00
Use path basename instead of basename
This is faster and guaranteed to be available
This commit is contained in:
parent
7b8684e469
commit
7d7b72f995
7 changed files with 7 additions and 11 deletions
|
@ -1,9 +1,5 @@
|
||||||
function __fish_print_debian_services --description 'Prints services installed'
|
function __fish_print_debian_services --description 'Prints services installed'
|
||||||
for service in /etc/init.d/*
|
path filter -fxZ /etc/init.d/* | path basename
|
||||||
if test -x $service
|
|
||||||
basename $service
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_invoke_rcd_has_service
|
function __fish_invoke_rcd_has_service
|
||||||
|
|
|
@ -16,7 +16,7 @@ function __fish_man_page
|
||||||
|
|
||||||
# If there are at least two tokens not starting with "-", the second one might be a subcommand.
|
# If there are at least two tokens not starting with "-", the second one might be a subcommand.
|
||||||
# Try "man first-second" and fall back to "man first" if that doesn't work out.
|
# Try "man first-second" and fall back to "man first" if that doesn't work out.
|
||||||
set -l maincmd (basename $args[1])
|
set -l maincmd (path basename $args[1])
|
||||||
# HACK: If stderr is not attached to a terminal `less` (the default pager)
|
# HACK: If stderr is not attached to a terminal `less` (the default pager)
|
||||||
# wouldn't use the alternate screen.
|
# wouldn't use the alternate screen.
|
||||||
# But since we don't know what pager it is, and because `man` is totally underspecified,
|
# But since we don't know what pager it is, and because `man` is totally underspecified,
|
||||||
|
|
|
@ -157,7 +157,7 @@ function funced --description 'Edit function definition'
|
||||||
source "$writepath"
|
source "$writepath"
|
||||||
else
|
else
|
||||||
echo (_ "Saving to original location failed; saving to user configuration instead.")
|
echo (_ "Saving to original location failed; saving to user configuration instead.")
|
||||||
set writepath $__fish_config_dir/functions/(basename "$writepath")
|
set writepath $__fish_config_dir/functions/(path basename "$writepath")
|
||||||
if cp $tmpname "$writepath"
|
if cp $tmpname "$writepath"
|
||||||
printf (_ "Function saved to %s") "$writepath"
|
printf (_ "Function saved to %s") "$writepath"
|
||||||
echo
|
echo
|
||||||
|
|
|
@ -76,7 +76,7 @@ function fish_prompt
|
||||||
set arrow "$arrow_color# "
|
set arrow "$arrow_color# "
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l cwd $cyan(basename (prompt_pwd))
|
set -l cwd $cyan(prompt_pwd | path basename)
|
||||||
|
|
||||||
set -l repo_info
|
set -l repo_info
|
||||||
if set -l repo_type (_repo_type)
|
if set -l repo_type (_repo_type)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
function fish_prompt
|
function fish_prompt
|
||||||
set_color $fish_color_cwd
|
set_color $fish_color_cwd
|
||||||
echo -n (basename $PWD)
|
echo -n (path basename $PWD)
|
||||||
set_color normal
|
set_color normal
|
||||||
echo -n ' ) '
|
echo -n ' ) '
|
||||||
end
|
end
|
||||||
|
|
|
@ -109,7 +109,7 @@ function fish_prompt
|
||||||
set -q VIRTUAL_ENV_DISABLE_PROMPT
|
set -q VIRTUAL_ENV_DISABLE_PROMPT
|
||||||
or set -g VIRTUAL_ENV_DISABLE_PROMPT true
|
or set -g VIRTUAL_ENV_DISABLE_PROMPT true
|
||||||
set -q VIRTUAL_ENV
|
set -q VIRTUAL_ENV
|
||||||
and _nim_prompt_wrapper $retc V (basename "$VIRTUAL_ENV")
|
and _nim_prompt_wrapper $retc V (path basename "$VIRTUAL_ENV")
|
||||||
|
|
||||||
# git
|
# git
|
||||||
set -l prompt_git (fish_git_prompt '%s')
|
set -l prompt_git (fish_git_prompt '%s')
|
||||||
|
|
|
@ -23,7 +23,7 @@ function fish_prompt
|
||||||
# Line 2
|
# Line 2
|
||||||
echo
|
echo
|
||||||
if test -n "$VIRTUAL_ENV"
|
if test -n "$VIRTUAL_ENV"
|
||||||
printf "(%s) " (set_color blue)(basename $VIRTUAL_ENV)(set_color normal)
|
printf "(%s) " (set_color blue)(path basename $VIRTUAL_ENV)(set_color normal)
|
||||||
end
|
end
|
||||||
printf '↪ '
|
printf '↪ '
|
||||||
set_color normal
|
set_color normal
|
||||||
|
|
Loading…
Reference in a new issue