AutoYADM commit: 2025-04-18 16:00:05
This commit is contained in:
parent
e43a7ac777
commit
a6148ca5cd
1 changed files with 20 additions and 2 deletions
|
@ -4,7 +4,19 @@ status is-interactive; or exit
|
|||
functions -q __cd_orig; or functions --copy cd __cd_orig
|
||||
|
||||
function cd --wraps=cd --description "Change directory. No args goes to git root or $HOME. If already there, return to previous location."
|
||||
|
||||
argparse h/help -- $argv
|
||||
if set -q _flag_help
|
||||
echo smartcd.fish: Change directories, slightly smarter.
|
||||
echo Invoke by running cd. Update with smartcd_update.
|
||||
echo Usage:
|
||||
echo -h/--help: show this menu.
|
||||
echo cd [args]: behaves like normal cd.
|
||||
echo cd [no-args]: cd to ROOT. If at ROOT, cd to PREV.\n
|
||||
echo ROOT = Git repo root '||' "\$HOME".
|
||||
echo PREV = Last element of "\$dirprev".
|
||||
echo If PREV is outside ROOT, user is prompted first.
|
||||
return 0
|
||||
end
|
||||
# Skip history in subshells.
|
||||
if status --is-command-substitution
|
||||
builtin cd $argv
|
||||
|
@ -44,7 +56,13 @@ function cd --wraps=cd --description "Change directory. No args goes to git root
|
|||
end
|
||||
|
||||
function smartcd_update --description "Update smartcd.fish with the latest from the upstream."
|
||||
argparse d/dry -- $argv
|
||||
argparse h/help d/dry -- $argv
|
||||
if set -q _flag_help
|
||||
echo Update smartcd.fish with the latest from upstream.
|
||||
echo -d/--dry to not save the file.
|
||||
echo -h/--help to print this screen.
|
||||
return 0
|
||||
end
|
||||
set -l url https://git.sr.ht/~ficd/smartcd.fish/blob/main/smartcd.fish
|
||||
# set -l add "-o $fish_config/conf.d/smartcd.fish"
|
||||
not set -q _flag_dry; and set -l add -o $fish_config/conf.d/smartcd.fish
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue