mirror of
https://github.com/oh-my-fish/oh-my-fish
synced 2024-11-09 13:10:40 +00:00
omf cd
command for changing directories.
Jump around Oh My Fish packages and themes using `omf cd <name>`. If no <name> is specified, jump to oh my fish root folder.
This commit is contained in:
parent
62a45e9ec2
commit
ecb9dfa0a9
25
pkg/omf/cli/omf.cd.fish
Normal file
25
pkg/omf/cli/omf.cd.fish
Normal file
@ -0,0 +1,25 @@
|
||||
# SYNOPSIS
|
||||
# Change the current working directory to plugin / theme home directory.
|
||||
#
|
||||
# OPTIONS
|
||||
# <name> Name of the package or theme.
|
||||
|
||||
function omf.cd -a name -d "Change the current working directory to plugin / theme home directory."
|
||||
if test -z $name
|
||||
pushd $OMF_PATH
|
||||
return 0
|
||||
end
|
||||
|
||||
if test -e $OMF_CONFIG/pkg/$name
|
||||
pushd $OMF_CONFIG/pkg/$name
|
||||
else if test -e $OMF_CONFIG/themes/$name
|
||||
pushd $OMF_CONFIG/themes/$name
|
||||
else if test -e $OMF_PATH/pkg/$name
|
||||
pushd $OMF_PATH/pkg/$name
|
||||
else if test -e $OMF_PATH/themes/$name
|
||||
pushd $OMF_PATH/themes/$name
|
||||
else
|
||||
echo (omf::err)"$name is not a valid package/theme name"(omf::off) 1^&2
|
||||
return $OMF_INVALID_ARG
|
||||
end
|
||||
end
|
@ -57,6 +57,18 @@ function omf -d "Oh My Fish"
|
||||
case "-h*" "--h*" "help"
|
||||
omf.help
|
||||
|
||||
case "c" "cd"
|
||||
switch (count $argv)
|
||||
case 1
|
||||
omf.cd
|
||||
case 2
|
||||
omf.cd $argv[2]
|
||||
case "*"
|
||||
echo (omf::err)"Invalid number of arguments"(omf::off) 1^&2
|
||||
echo "Usage: $_ "(omf::em)"$argv[1]"(omf::off)" <name>" 1^&2
|
||||
return $OMF_INVALID_ARG
|
||||
end
|
||||
|
||||
case "l" "li" "lis" "lst" "list"
|
||||
omf.list_local_packages | column
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user