Merge pull request #90 from oh-my-fish/commands-organization

Organize commands and remove undocumented aliases
This commit is contained in:
Bruno 2015-10-03 01:09:56 +01:00
commit 2e5761ab38
2 changed files with 118 additions and 118 deletions

View File

@ -1,68 +1,5 @@
function omf.help -a type_flag
switch $type_flag
case "i" "install" "get"
echo \n"\
Install packages.
"(omf::dim)"Usage:"(omf::off)"
omf install Install missing packages from bundle
omf install "(omf::em)"<name>"(omf::off)" | "(omf::em)"<url>"(omf::off)" Install package by name or URL
"(omf::dim)"Examples:"(omf::off)"
omf install
omf install brew
omf install https://github.com/oh-my-fish/plugin-brew
"
case "u" "up" "upd" "update"
echo \n"\
Update Oh My Fish.
"(omf::dim)"Usage:"(omf::off)"
omf update
"
case "destroy"
echo \n"\
Uninstall Oh My Fish.
"(omf::dim)"Usage:"(omf::off)"
omf destroy
"
case "l" "li" "lis" "lst" "list"
echo \n"\
List local packages.
"(omf::dim)"Usage:"(omf::off)"
omf list
"
case "t" "theme"
echo \n"\
Install and list themes.
"(omf::dim)"Usage:"(omf::off)"
omf theme List available themes to install
omf theme "(omf::em)"<name>"(omf::off)" Install theme by name
"(omf::dim)"Examples:"(omf::off)"
omf theme
omf theme l
"
case "r" "rem" "rm" "remove" "uninstall"
echo \n"\
Remove a theme or package.
"(omf::dim)"Usage:"(omf::off)"
omf remove "(omf::em)"<package name>"(omf::off)" | "(omf::em)"<theme name>"(omf::off)" Removes a theme or package by name
"(omf::dim)"Examples:"(omf::off)"
omf remove brew
omf remove l
"
function omf.help -a command
switch $command
case "c" "cd"
echo \n"\
Change directory to root or plugin/theme directory.
@ -77,7 +14,50 @@ function omf.help -a type_flag
omf cd l
"
case "n" "nw" "new"
case "d" "describe"
echo \n"\
Get information about what packages do.
"(omf::dim)"Usage:"(omf::off)"
omf describe Get information from all available packages
omf describe "(omf::em)"<name>"(omf::off)" Get information from package by name
"(omf::dim)"Examples:"(omf::off)"
omf describe
omf describe brew
"
case "destroy"
echo \n"\
Uninstall Oh My Fish.
"(omf::dim)"Usage:"(omf::off)"
omf destroy
"
case "i" "install" "get"
echo \n"\
Install packages.
"(omf::dim)"Usage:"(omf::off)"
omf install Install missing packages from bundle
omf install "(omf::em)"<name>"(omf::off)" | "(omf::em)"<url>"(omf::off)" Install package by name or URL
"(omf::dim)"Examples:"(omf::off)"
omf install
omf install brew
omf install https://github.com/oh-my-fish/plugin-brew
"
case "l" "ls" "list"
echo \n"\
List local packages.
"(omf::dim)"Usage:"(omf::off)"
omf list
"
case "n" "new"
echo \n"\
Create a new package from a template.
@ -89,18 +69,6 @@ function omf.help -a type_flag
omf new theme mytheme
"
case "s" "su" "sub" "submit"
echo \n"\
Submit a package to the registry.
"(omf::dim)"Usage:"(omf::off)"
omf submit ("(omf::dim)"pkg"(omf::off)" | "(omf::dim)"theme"(omf::off)") "(omf::em)"<url>"(omf::off)" Submit a package or theme to the registry
"(omf::dim)"Examples:"(omf::off)"
omf submit pkg https://github.com/oh-my-fish/plugin-mypkg
omf submit theme https://github.com/oh-my-fish/plugin-mythemes
"
case "q" "query"
echo \n"\
Query environment variables.
@ -114,17 +82,49 @@ function omf.help -a type_flag
omf query version
"
case "d" "desc" "describe"
case "r" "rm" "remove" "uninstall"
echo \n"\
Get information about what packages do.
Remove a theme or package.
"(omf::dim)"Usage:"(omf::off)"
omf describe Get information from all available packages
omf describe "(omf::em)"<name>"(omf::off)" Get information from package by name
omf remove "(omf::em)"<package name>"(omf::off)" | "(omf::em)"<theme name>"(omf::off)" Removes a theme or package by name
"(omf::dim)"Examples:"(omf::off)"
omf describe
omf describe brew
omf remove brew
omf remove l
"
case "s" "submit"
echo \n"\
Submit a package to the registry.
"(omf::dim)"Usage:"(omf::off)"
omf submit ("(omf::dim)"pkg"(omf::off)" | "(omf::dim)"theme"(omf::off)") "(omf::em)"<url>"(omf::off)" Submit a package or theme to the registry
"(omf::dim)"Examples:"(omf::off)"
omf submit pkg https://github.com/oh-my-fish/plugin-mypkg
omf submit theme https://github.com/oh-my-fish/plugin-mythemes
"
case "t" "theme"
echo \n"\
Install and list themes.
"(omf::dim)"Usage:"(omf::off)"
omf theme List available themes to install
omf theme "(omf::em)"<name>"(omf::off)" Install theme by name
"(omf::dim)"Examples:"(omf::off)"
omf theme
omf theme l
"
case "u" "update"
echo \n"\
Update Oh My Fish.
"(omf::dim)"Usage:"(omf::off)"
omf update
"
case "*"

View File

@ -73,16 +73,16 @@ function omf -d "Oh My Fish"
return $OMF_INVALID_ARG
end
case "l" "li" "lis" "lst" "list"
omf.list_local_packages | column
case "d" "desc" "describe"
case "d" "describe"
if test (count $argv) -eq 1
omf.describe
else
omf.describe $argv[2..-1]
end
case "destroy"
omf.destroy
case "i" "install" "get"
if test (count $argv) -eq 1
omf.bundle.install
@ -91,6 +91,35 @@ function omf -d "Oh My Fish"
refresh
end
case "l" "ls" "list"
omf.list_local_packages | column
case "n" "new"
if test (count $argv) -ne 3
echo (omf::err)"Package type or name missing"(omf::off) 1^&2
echo "Usage: $_ "(omf::em)"$argv[1]"(omf::off)" "(omf::em)"pkg|theme"(omf::off)" <name>" 1^&2
return $OMF_MISSING_ARG
end
omf.new $argv[2..-1]
case "r" "rm" "remove" "uninstall"
if test (count $argv) -ne 2
echo (omf::err)"Invalid number of arguments"(omf::off) 1^&2
echo "Usage: $_ "(omf::em)"$argv[1]"(omf::off)" <[package|theme] name>" 1^&2
return $OMF_INVALID_ARG
end
omf.remove_package $argv[2] ; and refresh
case "s" "submit"
switch (count $argv)
case 3
omf.submit $argv[2] $argv[3]
case "*"
echo (omf::err)"Argument missing"(omf::off) 1^&2
echo "Usage: $_ "(omf::em)"$argv[1]"(omf::off)" "(omf::em)"pkg|themes"(omf::off)"/<name> <url>" 1^&2
return $OMF_MISSING_ARG
end
case "t" "theme"
if test (count $argv) -eq 1
set -l ostype (uname)
@ -110,15 +139,7 @@ function omf -d "Oh My Fish"
return $OMF_INVALID_ARG
end
case "r" "rem" "rm" "remove" "uninstall"
if test (count $argv) -ne 2
echo (omf::err)"Invalid number of arguments"(omf::off) 1^&2
echo "Usage: $_ "(omf::em)"$argv[1]"(omf::off)" <[package|theme] name>" 1^&2
return $OMF_INVALID_ARG
end
omf.remove_package $argv[2] ; and refresh
case "u" "up" "upd" "update"
case "u" "update"
echo (omf::em)"Updating Oh My Fish..."(omf::off)
if omf.repo.pull $OMF_PATH
echo (omf::em)"Oh My Fish is up to date."(omf::off)
@ -130,27 +151,6 @@ function omf -d "Oh My Fish"
omf.install_package (omf.list_installed_packages)
refresh
case "s" "su" "sub" "submit"
switch (count $argv)
case 3
omf.submit $argv[2] $argv[3]
case "*"
echo (omf::err)"Argument missing"(omf::off) 1^&2
echo "Usage: $_ "(omf::em)"$argv[1]"(omf::off)" "(omf::em)"pkg|themes"(omf::off)"/<name> <url>" 1^&2
return $OMF_MISSING_ARG
end
case "n" "nw" "new"
if test (count $argv) -ne 3
echo (omf::err)"Package type or name missing"(omf::off) 1^&2
echo "Usage: $_ "(omf::em)"$argv[1]"(omf::off)" "(omf::em)"pkg|theme"(omf::off)" <name>" 1^&2
return $OMF_MISSING_ARG
end
omf.new $argv[2..-1]
case "destroy"
omf.destroy
case "*"
echo (omf::err)"$argv[1] option not recognized"(omf::off) 1^&2
return $OMF_UNKNOWN_OPT