mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
dirs: Stringify
Two useless forks plus one per element in $dirstack.
This commit is contained in:
parent
a070dffc4e
commit
5ca63c4956
1 changed files with 2 additions and 5 deletions
|
@ -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 a new issue