mirror of
https://github.com/oh-my-fish/oh-my-fish
synced 2024-11-11 07:10:29 +00:00
parent
4b541ec0a1
commit
15e9af84b1
@ -76,6 +76,10 @@ Scaffold out a new package or theme.
|
|||||||
|
|
||||||
> This creates a new directory under `$OMF_CONFIG/{pkg | themes}/` with a template.
|
> This creates a new directory under `$OMF_CONFIG/{pkg | themes}/` with a template.
|
||||||
|
|
||||||
|
#### `omf search` _`-t|--theme / -pkg|--package`_ _`<name>`_
|
||||||
|
|
||||||
|
Searches Oh My Fish's database for a given package, theme or both. It also supports fuzzy search, so if you are not sure of the name you can simply `omf search simple`.
|
||||||
|
|
||||||
#### `omf submit` _`pkg/<name>`_ _`[<url>]`_
|
#### `omf submit` _`pkg/<name>`_ _`[<url>]`_
|
||||||
|
|
||||||
Add a new package. To add a theme, use `omf submit` _`themes/<name>`_ _`<url>`_.
|
Add a new package. To add a theme, use `omf submit` _`themes/<name>`_ _`<url>`_.
|
||||||
|
@ -30,6 +30,7 @@ complete -c omf -f -a remove -n "__fish_use_subcommand" -d "Remove a theme or
|
|||||||
complete -c omf -f -a update -n "__fish_use_subcommand" -d "Update Oh My Fish"
|
complete -c omf -f -a update -n "__fish_use_subcommand" -d "Update Oh My Fish"
|
||||||
complete -c omf -f -a cd -n "__fish_use_subcommand" -d "Change directory to plugin/theme directory"
|
complete -c omf -f -a cd -n "__fish_use_subcommand" -d "Change directory to plugin/theme directory"
|
||||||
complete -c omf -f -a new -n "__fish_use_subcommand" -d "Create a new package from a template"
|
complete -c omf -f -a new -n "__fish_use_subcommand" -d "Create a new package from a template"
|
||||||
|
complete -c omf -f -a search -n "__fish_use_subcommand" -d "Search the database for a theme, package or both"
|
||||||
complete -c omf -f -a submit -n "__fish_use_subcommand" -d "Submit a package to the registry"
|
complete -c omf -f -a submit -n "__fish_use_subcommand" -d "Submit a package to the registry"
|
||||||
complete -c omf -f -a help -n "__fish_use_subcommand" -d "Display this help"
|
complete -c omf -f -a help -n "__fish_use_subcommand" -d "Display this help"
|
||||||
complete -c omf -f -a destroy -n "__fish_use_subcommand" -d "Remove Oh My Fish"
|
complete -c omf -f -a destroy -n "__fish_use_subcommand" -d "Remove Oh My Fish"
|
||||||
|
@ -89,6 +89,19 @@ function omf.cli.help -a command
|
|||||||
omf remove l
|
omf remove l
|
||||||
"
|
"
|
||||||
|
|
||||||
|
case "search"
|
||||||
|
echo \n"\
|
||||||
|
Search for a package or theme.
|
||||||
|
|
||||||
|
"(omf::dim)"Usage:"(omf::off)"
|
||||||
|
omf search ("(omf::dim)"-pkg/--package"(omf::off)" | "(omf::dim)"-t/--theme"(omf::off)") "(omf::em)"<name>"(omf::off)" Search for a package or theme
|
||||||
|
|
||||||
|
"(omf::dim)"Examples:"(omf::off)"
|
||||||
|
omf search -pkg nvm
|
||||||
|
omf search -t bobthefish
|
||||||
|
omf search vi
|
||||||
|
"
|
||||||
|
|
||||||
case "s" "submit"
|
case "s" "submit"
|
||||||
echo \n"\
|
echo \n"\
|
||||||
Submit a package to the registry.
|
Submit a package to the registry.
|
||||||
@ -130,6 +143,7 @@ function omf.cli.help -a command
|
|||||||
omf "(omf::em)"install"(omf::off)" [<name>|<url>]
|
omf "(omf::em)"install"(omf::off)" [<name>|<url>]
|
||||||
omf "(omf::em)"theme"(omf::off)" [<name>]
|
omf "(omf::em)"theme"(omf::off)" [<name>]
|
||||||
omf "(omf::em)"remove"(omf::off)" [<name>]
|
omf "(omf::em)"remove"(omf::off)" [<name>]
|
||||||
|
omf "(omf::em)"search"(omf::off)" [<name>]
|
||||||
omf "(omf::em)"update"(omf::off)"
|
omf "(omf::em)"update"(omf::off)"
|
||||||
omf "(omf::em)"help"(omf::off)" [<command>]
|
omf "(omf::em)"help"(omf::off)" [<command>]
|
||||||
|
|
||||||
@ -142,6 +156,7 @@ function omf.cli.help -a command
|
|||||||
"(omf::em)"u"(omf::off)"pdate Update Oh My Fish.
|
"(omf::em)"u"(omf::off)"pdate Update Oh My Fish.
|
||||||
"(omf::em)"c"(omf::off)"d Change directory to plugin/theme directory.
|
"(omf::em)"c"(omf::off)"d Change directory to plugin/theme directory.
|
||||||
"(omf::em)"n"(omf::off)"ew Create a new package from a template.
|
"(omf::em)"n"(omf::off)"ew Create a new package from a template.
|
||||||
|
"(omf::em)"search"(omf::off)" Search for a package or theme.
|
||||||
"(omf::em)"s"(omf::off)"ubmit Submit a package to the registry.
|
"(omf::em)"s"(omf::off)"ubmit Submit a package to the registry.
|
||||||
"(omf::em)"destroy"(omf::off)" Uninstall Oh My Fish.
|
"(omf::em)"destroy"(omf::off)" Uninstall Oh My Fish.
|
||||||
"(omf::em)"doctor"(omf::off)" Troubleshoot Oh My Fish.
|
"(omf::em)"doctor"(omf::off)" Troubleshoot Oh My Fish.
|
||||||
|
26
pkg/omf/functions/cli/omf.cli.search.fish
Normal file
26
pkg/omf/functions/cli/omf.cli.search.fish
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
function omf.cli.search -d "CLI parser for the search command"
|
||||||
|
|
||||||
|
switch (count $argv);
|
||||||
|
case 1;
|
||||||
|
omf.search.pkg $argv[1]
|
||||||
|
echo
|
||||||
|
omf.search.theme $argv[1]
|
||||||
|
case 2;
|
||||||
|
switch "$argv[1]"
|
||||||
|
case "-pkg" "--package";
|
||||||
|
omf.search.pkg $argv[2]
|
||||||
|
case "-t" "--theme";
|
||||||
|
omf.search.theme $argv[2]
|
||||||
|
case '*';
|
||||||
|
__omf.cli.search.usage
|
||||||
|
end
|
||||||
|
case '*';
|
||||||
|
__omf.cli.search.usage
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function __omf.cli.search.usage -d "Print usage"
|
||||||
|
|
||||||
|
echo (omf::err)"Usage: omf search ([-t | --theme]) ([-pkg | --package]) item"(omf::off)
|
||||||
|
|
||||||
|
end
|
@ -64,6 +64,9 @@ function omf -d "Oh My Fish"
|
|||||||
case "u" "update"
|
case "u" "update"
|
||||||
omf.cli.update $arguments
|
omf.cli.update $arguments
|
||||||
|
|
||||||
|
case "search"
|
||||||
|
omf.cli.search $arguments
|
||||||
|
|
||||||
case "*"
|
case "*"
|
||||||
echo (omf::err)"$argv[1] option not recognized"(omf::off) 1^&2
|
echo (omf::err)"$argv[1] option not recognized"(omf::off) 1^&2
|
||||||
return $OMF_UNKNOWN_OPT
|
return $OMF_UNKNOWN_OPT
|
||||||
|
10
pkg/omf/functions/search/omf.search.pkg.fish
Normal file
10
pkg/omf/functions/search/omf.search.pkg.fish
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
function omf.search.pkg -a item -d "Search db/pkg for the specified item"
|
||||||
|
|
||||||
|
set -l available_pkg (omf.packages.list --database --plugin)
|
||||||
|
echo (omf::under)"Packages"(omf::off)
|
||||||
|
|
||||||
|
set -l regex "([A-Za-z0-9-]*)($item)([A-Za-z0-9-]*)"
|
||||||
|
|
||||||
|
echo $available_pkg | egrep -io $regex | column
|
||||||
|
|
||||||
|
end
|
10
pkg/omf/functions/search/omf.search.theme.fish
Normal file
10
pkg/omf/functions/search/omf.search.theme.fish
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
function omf.search.theme -a item -d "Search db/theme for the specified item"
|
||||||
|
|
||||||
|
set -l available_theme (omf.packages.list --database --theme)
|
||||||
|
echo (omf::under)"Themes"(omf::off)
|
||||||
|
|
||||||
|
set -l regex "([A-Za-z0-9-]*)($item)([A-Za-z0-9-]*)"
|
||||||
|
|
||||||
|
echo $available_theme | egrep -io $regex | column
|
||||||
|
|
||||||
|
end
|
@ -24,5 +24,5 @@ function init -a path --on-event init_omf
|
|||||||
set_color normal
|
set_color normal
|
||||||
end
|
end
|
||||||
|
|
||||||
autoload $path/functions/{compat,core,packages,themes,bundle,util,repo,cli}
|
autoload $path/functions/{compat,core,packages,themes,bundle,util,repo,cli,search}
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user