Convert version and help into options

Instead of clobbering the actions with both version and help, use
options instead. They are also going to be used for subcommands (e.g.
omf list --help) once they support options.
This commit is contained in:
Bruno Pinto 2015-08-28 17:08:40 +01:00
parent 0fc2249b12
commit 62a45e9ec2
3 changed files with 16 additions and 14 deletions

View File

@ -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

View File

@ -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

View File

@ -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,7 +54,7 @@ function omf -d "Oh My Fish"
return $OMF_INVALID_ARG
end
case "h" "help"
case "-h*" "--h*" "help"
omf.help
case "l" "li" "lis" "lst" "list"