mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2025-02-21 04:05:52 +08:00
commit
3d924b79ca
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
|
@ -4,17 +4,19 @@ function omf.help
|
||||
omf "(omf::em)"action"(omf::off)" [options]
|
||||
|
||||
"(omf::dim)"Actions"(omf::off)"
|
||||
"(omf::em)"l"(omf::off)"ist List local packages.
|
||||
"(omf::em)"i"(omf::off)"nstall Install one or more packages.
|
||||
"(omf::em)"t"(omf::off)"heme List / Use themes.
|
||||
"(omf::em)"r"(omf::off)"emove Remove a theme or package.
|
||||
"(omf::em)"u"(omf::off)"pdate Update Oh My Fish.
|
||||
"(omf::em)"n"(omf::off)"ew Create a new package from a template.
|
||||
"(omf::em)"s"(omf::off)"ubmit Submit a package to the registry.
|
||||
"(omf::em)"q"(omf::off)"uery Query environment variables.
|
||||
"(omf::em)"h"(omf::off)"elp Display this help.
|
||||
"(omf::em)"v"(omf::off)"ersion Display version.
|
||||
"(omf::em)"destroy"(omf::off)" Uninstall Oh My Fish.
|
||||
"(omf::em)"l"(omf::off)"ist List local packages.
|
||||
"(omf::em)"i"(omf::off)"nstall Install one or more packages.
|
||||
"(omf::em)"t"(omf::off)"heme List / Use themes.
|
||||
"(omf::em)"r"(omf::off)"emove Remove a theme or package.
|
||||
"(omf::em)"u"(omf::off)"pdate Update Oh My Fish.
|
||||
"(omf::em)"n"(omf::off)"ew Create a new package from a template.
|
||||
"(omf::em)"s"(omf::off)"ubmit Submit a package to the registry.
|
||||
"(omf::em)"q"(omf::off)"uery Query environment variables.
|
||||
"(omf::em)"destroy"(omf::off)" Uninstall Oh My Fish.
|
||||
|
||||
"(omf::dim)"Options"(omf::off)"
|
||||
"(omf::em)"--h"(omf::off)"elp Display this help.
|
||||
"(omf::em)"--v"(omf::off)"ersion Display version.
|
||||
|
||||
For more information visit → "(omf::em)"git.io/oh-my-fish"(omf::off)\n
|
||||
end
|
||||
|
@ -10,7 +10,7 @@ function omf.install -a type_flag name_or_url
|
||||
echo (omf::err)"Argument to omf.install must be --theme [name|URL] or --pkg [name|URL]"(omf::off)
|
||||
return $OMF_INVALID_ARG
|
||||
end
|
||||
|
||||
|
||||
if test -e $OMF_PATH/db/$parent_path/$name_or_url
|
||||
set target $parent_path/$name_or_url
|
||||
else
|
||||
|
@ -39,7 +39,7 @@ function omf -d "Oh My Fish"
|
||||
end
|
||||
|
||||
switch $argv[1]
|
||||
case "v" "ver" "version"
|
||||
case "-v*" "--v*"
|
||||
omf.version
|
||||
|
||||
case "q" "query"
|
||||
@ -54,9 +54,21 @@ function omf -d "Oh My Fish"
|
||||
return $OMF_INVALID_ARG
|
||||
end
|
||||
|
||||
case "h" "help"
|
||||
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…
x
Reference in New Issue
Block a user