mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 19:03:38 +08:00
dirs: Stringify
Two useless forks plus one per element in $dirstack.
This commit is contained in:
parent
a070dffc4e
commit
5ca63c4956
|
@ -1,6 +1,6 @@
|
||||||
function dirs --description 'Print directory stack'
|
function dirs --description 'Print directory stack'
|
||||||
# process options
|
# process options
|
||||||
if count $argv >/dev/null
|
if set -q argv[1]
|
||||||
switch $argv[1]
|
switch $argv[1]
|
||||||
case -c
|
case -c
|
||||||
# clear directory stack
|
# clear directory stack
|
||||||
|
@ -10,9 +10,6 @@ function dirs --description 'Print directory stack'
|
||||||
end
|
end
|
||||||
|
|
||||||
# replace $HOME with ~
|
# replace $HOME with ~
|
||||||
echo -n (echo (command pwd) | sed -e "s|^$HOME|~|")" "
|
string replace -r '^'"$HOME"'($|/)' '~$1' -- $PWD $dirstack | string join " "
|
||||||
for i in $dirstack
|
|
||||||
echo -n (echo $i | sed -e "s|^$HOME|~|")" "
|
|
||||||
end
|
|
||||||
echo
|
echo
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user