diff --git a/README.md b/README.md index 583a898..c3a4dc8 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ Oh My Fish includes a small utility `omf` to fetch and install new packages and #### `omf update` _`[omf]`_ _`[...]`_ -Update the framework and installed packages. +Update Oh My Fish, all package repositories, and all installed packages. - When called without arguments, update core and all installed packages. - You can choose to update only the core, by running `omf update omf`. @@ -64,6 +64,10 @@ Install one _or more_ packages. - You can install packages directly by URL via `omf install URL` - When called without arguments, install missing packages from [bundle](#dotfiles). +#### `omf repositories` _`[list|add|remove]`_ + +Manage user-installed package repositories. Package repositories are where packages come from used by commands like `omf install`. By default the [official repository](https://github.com/oh-my-fish/packages-main) is always installed and available. + #### `omf list` List installed packages. @@ -94,13 +98,6 @@ Scaffold out a new package or theme. 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/`_ _`[]`_ - -Add a new package. To add a theme, use `omf submit` _`themes/`_ _``_. -Please note that the _`[]`_ portion of the command should be the url to your repo on github. For example, with the `example` plugin, the command run should be `omf submit pkg/example https://github.com/oh-my-fish/example`. - -Make sure to [send us a PR][omf-pulls-link] to update the registry. - #### `omf channel` Gets or changes the update channel. diff --git a/bin/install b/bin/install index 2da4738..69d9867 100755 --- a/bin/install +++ b/bin/install @@ -489,7 +489,7 @@ end # Assert that all tools we need are available. function assert_cmds - set -l cmds basename cp cut date dirname fold head mkdir mv rm sed sort tar tr + set -l cmds awk basename cp cut date dirname fold head mkdir mv rm sed sort tar tr for cmd in $cmds type -f -q $cmd diff --git a/db/pkg/android-sdk b/db/pkg/android-sdk deleted file mode 100644 index b8fa4be..0000000 --- a/db/pkg/android-sdk +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-android-sdk diff --git a/db/pkg/ansible b/db/pkg/ansible deleted file mode 100644 index f1ed702..0000000 --- a/db/pkg/ansible +++ /dev/null @@ -1 +0,0 @@ -https://github.com/pkg-gretel/pkg-ansible diff --git a/db/pkg/apt b/db/pkg/apt deleted file mode 100644 index 851b69d..0000000 --- a/db/pkg/apt +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-apt diff --git a/db/pkg/archlinux b/db/pkg/archlinux deleted file mode 100644 index 5967b56..0000000 --- a/db/pkg/archlinux +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-archlinux diff --git a/db/pkg/argu b/db/pkg/argu deleted file mode 100644 index 0947b53..0000000 --- a/db/pkg/argu +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-argu diff --git a/db/pkg/artisan b/db/pkg/artisan deleted file mode 100644 index 50d34e7..0000000 --- a/db/pkg/artisan +++ /dev/null @@ -1 +0,0 @@ -https://github.com/thecotne/omf-plugin-artisan diff --git a/db/pkg/await b/db/pkg/await deleted file mode 100644 index 220ea5e..0000000 --- a/db/pkg/await +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-await diff --git a/db/pkg/aws b/db/pkg/aws deleted file mode 100644 index 11874ae..0000000 --- a/db/pkg/aws +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-aws diff --git a/db/pkg/bak b/db/pkg/bak deleted file mode 100644 index fb0a25e..0000000 --- a/db/pkg/bak +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-bak diff --git a/db/pkg/balias b/db/pkg/balias deleted file mode 100644 index c512bce..0000000 --- a/db/pkg/balias +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-balias diff --git a/db/pkg/bang-bang b/db/pkg/bang-bang deleted file mode 100644 index 277a258..0000000 --- a/db/pkg/bang-bang +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-bang-bang diff --git a/db/pkg/basename-compat b/db/pkg/basename-compat deleted file mode 100644 index 036d96e..0000000 --- a/db/pkg/basename-compat +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-basename-compat diff --git a/db/pkg/battery b/db/pkg/battery deleted file mode 100644 index 2376905..0000000 --- a/db/pkg/battery +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-battery diff --git a/db/pkg/blt b/db/pkg/blt deleted file mode 100644 index 87a1923..0000000 --- a/db/pkg/blt +++ /dev/null @@ -1 +0,0 @@ -https://github.com/devert/plugin-blt diff --git a/db/pkg/brew b/db/pkg/brew deleted file mode 100644 index a6ea431..0000000 --- a/db/pkg/brew +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-brew diff --git a/db/pkg/bundler b/db/pkg/bundler deleted file mode 100644 index 44d593c..0000000 --- a/db/pkg/bundler +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-bundler diff --git a/db/pkg/cd b/db/pkg/cd deleted file mode 100644 index 6a93d30..0000000 --- a/db/pkg/cd +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-cd \ No newline at end of file diff --git a/db/pkg/composer b/db/pkg/composer deleted file mode 100644 index fdf5f0a..0000000 --- a/db/pkg/composer +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-composer diff --git a/db/pkg/config b/db/pkg/config deleted file mode 100644 index 3bbf4b2..0000000 --- a/db/pkg/config +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-config diff --git a/db/pkg/direnv b/db/pkg/direnv deleted file mode 100644 index 7ae200a..0000000 --- a/db/pkg/direnv +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-direnv diff --git a/db/pkg/docker-machine b/db/pkg/docker-machine deleted file mode 100644 index 7faa794..0000000 --- a/db/pkg/docker-machine +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-docker-machine diff --git a/db/pkg/dpaste b/db/pkg/dpaste deleted file mode 100644 index ac4f4ee..0000000 --- a/db/pkg/dpaste +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-dpaste diff --git a/db/pkg/emacs b/db/pkg/emacs deleted file mode 100644 index 1bca375..0000000 --- a/db/pkg/emacs +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-emacs diff --git a/db/pkg/errno b/db/pkg/errno deleted file mode 100644 index 77d9ab8..0000000 --- a/db/pkg/errno +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-errno diff --git a/db/pkg/exenv b/db/pkg/exenv deleted file mode 100644 index 108eb6e..0000000 --- a/db/pkg/exenv +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-exenv diff --git a/db/pkg/expand b/db/pkg/expand deleted file mode 100644 index 466cc04..0000000 --- a/db/pkg/expand +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-expand diff --git a/db/pkg/export b/db/pkg/export deleted file mode 100644 index 3a98f5b..0000000 --- a/db/pkg/export +++ /dev/null @@ -1 +0,0 @@ -https://github.com/jcouyang/plugin-export diff --git a/db/pkg/extract b/db/pkg/extract deleted file mode 100644 index 3ab3099..0000000 --- a/db/pkg/extract +++ /dev/null @@ -1 +0,0 @@ -https://github.com/pkg-gretel/pkg-extract diff --git a/db/pkg/fasd b/db/pkg/fasd deleted file mode 100644 index 9abb205..0000000 --- a/db/pkg/fasd +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-fasd diff --git a/db/pkg/fish_logo b/db/pkg/fish_logo deleted file mode 100644 index a26f173..0000000 --- a/db/pkg/fish_logo +++ /dev/null @@ -1 +0,0 @@ -https://github.com/HenrikWL/plugin-fish_logo.git diff --git a/db/pkg/fonts b/db/pkg/fonts deleted file mode 100644 index cabf711..0000000 --- a/db/pkg/fonts +++ /dev/null @@ -1 +0,0 @@ -https://github.com/derekstavis/plugin-fonts diff --git a/db/pkg/foreign-env b/db/pkg/foreign-env deleted file mode 100644 index 41449ee..0000000 --- a/db/pkg/foreign-env +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-foreign-env diff --git a/db/pkg/fzf b/db/pkg/fzf deleted file mode 100644 index 222535e..0000000 --- a/db/pkg/fzf +++ /dev/null @@ -1 +0,0 @@ -https://github.com/gretel/pkg-fzf diff --git a/db/pkg/gem b/db/pkg/gem deleted file mode 100644 index ecdabd3..0000000 --- a/db/pkg/gem +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-gem diff --git a/db/pkg/getopts b/db/pkg/getopts deleted file mode 100644 index 014c70d..0000000 --- a/db/pkg/getopts +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-getopts diff --git a/db/pkg/gi b/db/pkg/gi deleted file mode 100644 index c089fa5..0000000 --- a/db/pkg/gi +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-gi \ No newline at end of file diff --git a/db/pkg/git-flow b/db/pkg/git-flow deleted file mode 100644 index 80b82ee..0000000 --- a/db/pkg/git-flow +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-git-flow diff --git a/db/pkg/gityaw b/db/pkg/gityaw deleted file mode 100644 index 19f902a..0000000 --- a/db/pkg/gityaw +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-gityaw diff --git a/db/pkg/grc b/db/pkg/grc deleted file mode 100644 index 9d86226..0000000 --- a/db/pkg/grc +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-grc diff --git a/db/pkg/hash b/db/pkg/hash deleted file mode 100644 index 4eda522..0000000 --- a/db/pkg/hash +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-hash diff --git a/db/pkg/homebrew-command-not-found b/db/pkg/homebrew-command-not-found deleted file mode 100644 index 722567b..0000000 --- a/db/pkg/homebrew-command-not-found +++ /dev/null @@ -1 +0,0 @@ -https://github.com/lfiolhais/plugin-homebrew-command-not-found diff --git a/db/pkg/hub b/db/pkg/hub deleted file mode 100644 index 6a75692..0000000 --- a/db/pkg/hub +++ /dev/null @@ -1 +0,0 @@ -https://github.com/pkg-gretel/pkg-hub diff --git a/db/pkg/iex b/db/pkg/iex deleted file mode 100644 index a94fd11..0000000 --- a/db/pkg/iex +++ /dev/null @@ -1 +0,0 @@ -https://github.com/belltoy/plugin-iex diff --git a/db/pkg/jump b/db/pkg/jump deleted file mode 100644 index 99c7912..0000000 --- a/db/pkg/jump +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-jump diff --git a/db/pkg/keychain b/db/pkg/keychain deleted file mode 100644 index 380e451..0000000 --- a/db/pkg/keychain +++ /dev/null @@ -1 +0,0 @@ -https://github.com/pkg-gretel/pkg-keychain diff --git a/db/pkg/kill-on-port b/db/pkg/kill-on-port deleted file mode 100644 index 07c4b7b..0000000 --- a/db/pkg/kill-on-port +++ /dev/null @@ -1 +0,0 @@ -https://github.com/vincentjames501/fish-kill-on-port diff --git a/db/pkg/license b/db/pkg/license deleted file mode 100644 index 8d8803a..0000000 --- a/db/pkg/license +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-license diff --git a/db/pkg/linuxbrew b/db/pkg/linuxbrew deleted file mode 100644 index d4af751..0000000 --- a/db/pkg/linuxbrew +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-linuxbrew diff --git a/db/pkg/local-config b/db/pkg/local-config deleted file mode 100644 index f47ee4e..0000000 --- a/db/pkg/local-config +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-local-config diff --git a/db/pkg/marlin b/db/pkg/marlin deleted file mode 100644 index a57d1c8..0000000 --- a/db/pkg/marlin +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/marlin diff --git a/db/pkg/mix b/db/pkg/mix deleted file mode 100644 index 19a6f89..0000000 --- a/db/pkg/mix +++ /dev/null @@ -1 +0,0 @@ -https://github.com/belltoy/plugin-mix diff --git a/db/pkg/mou b/db/pkg/mou deleted file mode 100644 index 4688a1a..0000000 --- a/db/pkg/mou +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-mou diff --git a/db/pkg/mvn b/db/pkg/mvn deleted file mode 100644 index 3113a7a..0000000 --- a/db/pkg/mvn +++ /dev/null @@ -1 +0,0 @@ -https://github.com/benc/pkg-mvn diff --git a/db/pkg/node-binpath b/db/pkg/node-binpath deleted file mode 100644 index 6c99216..0000000 --- a/db/pkg/node-binpath +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-node-binpath diff --git a/db/pkg/nodenv b/db/pkg/nodenv deleted file mode 100644 index b9d55ae..0000000 --- a/db/pkg/nodenv +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-nodenv diff --git a/db/pkg/nvm b/db/pkg/nvm deleted file mode 100644 index 706603b..0000000 --- a/db/pkg/nvm +++ /dev/null @@ -1 +0,0 @@ -https://github.com/derekstavis/plugin-nvm diff --git a/db/pkg/osx b/db/pkg/osx deleted file mode 100644 index 5baf34b..0000000 --- a/db/pkg/osx +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-osx diff --git a/db/pkg/pbcopy b/db/pkg/pbcopy deleted file mode 100644 index 00a65c7..0000000 --- a/db/pkg/pbcopy +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-pbcopy \ No newline at end of file diff --git a/db/pkg/peco b/db/pkg/peco deleted file mode 100644 index 3dce97e..0000000 --- a/db/pkg/peco +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-peco diff --git a/db/pkg/php-version b/db/pkg/php-version deleted file mode 100644 index b6ac3bf..0000000 --- a/db/pkg/php-version +++ /dev/null @@ -1 +0,0 @@ -https://github.com/rzyns/pkg-php-version diff --git a/db/pkg/phpbrew b/db/pkg/phpbrew deleted file mode 100644 index 4194237..0000000 --- a/db/pkg/phpbrew +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-phpbrew diff --git a/db/pkg/pj b/db/pkg/pj deleted file mode 100644 index be24c32..0000000 --- a/db/pkg/pj +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-pj.git diff --git a/db/pkg/powerline b/db/pkg/powerline deleted file mode 100644 index f3f82c3..0000000 --- a/db/pkg/powerline +++ /dev/null @@ -1 +0,0 @@ -https://github.com/iamruinous/plugin-powerline diff --git a/db/pkg/proxy b/db/pkg/proxy deleted file mode 100644 index b14e9f2..0000000 --- a/db/pkg/proxy +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-proxy diff --git a/db/pkg/pyenv b/db/pkg/pyenv deleted file mode 100644 index da3ec3c..0000000 --- a/db/pkg/pyenv +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-pyenv diff --git a/db/pkg/python b/db/pkg/python deleted file mode 100644 index 888056e..0000000 --- a/db/pkg/python +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-python diff --git a/db/pkg/rails b/db/pkg/rails deleted file mode 100644 index 8f91a0a..0000000 --- a/db/pkg/rails +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-rails diff --git a/db/pkg/rbenv b/db/pkg/rbenv deleted file mode 100644 index f904e4f..0000000 --- a/db/pkg/rbenv +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-rbenv diff --git a/db/pkg/rustup b/db/pkg/rustup deleted file mode 100644 index 45d733e..0000000 --- a/db/pkg/rustup +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-rustup.git diff --git a/db/pkg/rvm b/db/pkg/rvm deleted file mode 100644 index 3a9cc0c..0000000 --- a/db/pkg/rvm +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-rvm diff --git a/db/pkg/spark b/db/pkg/spark deleted file mode 100644 index f80a5cb..0000000 --- a/db/pkg/spark +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-spark diff --git a/db/pkg/ssh-config.d b/db/pkg/ssh-config.d deleted file mode 100644 index 49612bd..0000000 --- a/db/pkg/ssh-config.d +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-ssh-config.d diff --git a/db/pkg/ssh-term-helper b/db/pkg/ssh-term-helper deleted file mode 100644 index 3c28c7b..0000000 --- a/db/pkg/ssh-term-helper +++ /dev/null @@ -1 +0,0 @@ -https://github.com/wk/plugin-ssh-term-helper diff --git a/db/pkg/sublime b/db/pkg/sublime deleted file mode 100644 index d116b46..0000000 --- a/db/pkg/sublime +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-sublime diff --git a/db/pkg/sudope b/db/pkg/sudope deleted file mode 100644 index 7d84681..0000000 --- a/db/pkg/sudope +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-sudope.git diff --git a/db/pkg/tab b/db/pkg/tab deleted file mode 100644 index 3dc5abd..0000000 --- a/db/pkg/tab +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-tab diff --git a/db/pkg/technicolor b/db/pkg/technicolor deleted file mode 100644 index 20694e0..0000000 --- a/db/pkg/technicolor +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-technicolor diff --git a/db/pkg/termux b/db/pkg/termux deleted file mode 100644 index 25a9c60..0000000 --- a/db/pkg/termux +++ /dev/null @@ -1 +0,0 @@ -https://github.com/sagebind/plugin-termux diff --git a/db/pkg/thefuck b/db/pkg/thefuck deleted file mode 100644 index 71bec6a..0000000 --- a/db/pkg/thefuck +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-thefuck diff --git a/db/pkg/tiny b/db/pkg/tiny deleted file mode 100644 index 24ab2c6..0000000 --- a/db/pkg/tiny +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-tiny diff --git a/db/pkg/title b/db/pkg/title deleted file mode 100644 index 4f46fa1..0000000 --- a/db/pkg/title +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-title diff --git a/db/pkg/tmux-zen b/db/pkg/tmux-zen deleted file mode 100644 index 123dcae..0000000 --- a/db/pkg/tmux-zen +++ /dev/null @@ -1 +0,0 @@ -https://github.com/sagebind/tmux-zen diff --git a/db/pkg/vcs b/db/pkg/vcs deleted file mode 100644 index be5237c..0000000 --- a/db/pkg/vcs +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-vcs diff --git a/db/pkg/vi-mode b/db/pkg/vi-mode deleted file mode 100644 index 83e71ef..0000000 --- a/db/pkg/vi-mode +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-vi-mode diff --git a/db/pkg/virtualfish b/db/pkg/virtualfish deleted file mode 100644 index 9950950..0000000 --- a/db/pkg/virtualfish +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-virtualfish.git diff --git a/db/pkg/vundle b/db/pkg/vundle deleted file mode 100644 index f7c614a..0000000 --- a/db/pkg/vundle +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-vundle diff --git a/db/pkg/wd b/db/pkg/wd deleted file mode 100644 index e3dadd4..0000000 --- a/db/pkg/wd +++ /dev/null @@ -1 +0,0 @@ -https://github.com/fischerling/plugin-wd diff --git a/db/pkg/weather b/db/pkg/weather deleted file mode 100644 index b8c16a5..0000000 --- a/db/pkg/weather +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-weather diff --git a/db/pkg/wifi-password b/db/pkg/wifi-password deleted file mode 100644 index 6a88b5f..0000000 --- a/db/pkg/wifi-password +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-wifi-password diff --git a/db/pkg/wttr b/db/pkg/wttr deleted file mode 100644 index 85a329c..0000000 --- a/db/pkg/wttr +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-wttr diff --git a/db/pkg/z b/db/pkg/z deleted file mode 100644 index 1ab1353..0000000 --- a/db/pkg/z +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/plugin-z diff --git a/db/themes/agnoster b/db/themes/agnoster deleted file mode 100644 index 9f8f676..0000000 --- a/db/themes/agnoster +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-agnoster diff --git a/db/themes/batman b/db/themes/batman deleted file mode 100644 index ecdf256..0000000 --- a/db/themes/batman +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-batman diff --git a/db/themes/beloglazov b/db/themes/beloglazov deleted file mode 100644 index 9407759..0000000 --- a/db/themes/beloglazov +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-beloglazov diff --git a/db/themes/bira b/db/themes/bira deleted file mode 100644 index 8b3bb19..0000000 --- a/db/themes/bira +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-bira diff --git a/db/themes/bobthefish b/db/themes/bobthefish deleted file mode 100644 index fcef7f8..0000000 --- a/db/themes/bobthefish +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-bobthefish diff --git a/db/themes/budspencer b/db/themes/budspencer deleted file mode 100644 index 0b09a56..0000000 --- a/db/themes/budspencer +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-budspencer diff --git a/db/themes/cbjohnson b/db/themes/cbjohnson deleted file mode 100644 index 0895574..0000000 --- a/db/themes/cbjohnson +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-cbjohnson diff --git a/db/themes/chain b/db/themes/chain deleted file mode 100644 index 9880881..0000000 --- a/db/themes/chain +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-chain diff --git a/db/themes/clearance b/db/themes/clearance deleted file mode 100644 index 7e2e3d2..0000000 --- a/db/themes/clearance +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-clearance diff --git a/db/themes/cmorrell b/db/themes/cmorrell deleted file mode 100644 index cb85c8b..0000000 --- a/db/themes/cmorrell +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-cmorrell.com diff --git a/db/themes/coffeeandcode b/db/themes/coffeeandcode deleted file mode 100644 index ed7794e..0000000 --- a/db/themes/coffeeandcode +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-coffeeandcode diff --git a/db/themes/cor b/db/themes/cor deleted file mode 100644 index c5f2d0c..0000000 --- a/db/themes/cor +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-cor diff --git a/db/themes/cyan b/db/themes/cyan deleted file mode 100644 index 756f4e1..0000000 --- a/db/themes/cyan +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-qing diff --git a/db/themes/dangerous b/db/themes/dangerous deleted file mode 100644 index 232befc..0000000 --- a/db/themes/dangerous +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-dangerous diff --git a/db/themes/default b/db/themes/default deleted file mode 100644 index 0ad500b..0000000 --- a/db/themes/default +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-default diff --git a/db/themes/eclm b/db/themes/eclm deleted file mode 100644 index a117eaf..0000000 --- a/db/themes/eclm +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-eclm diff --git a/db/themes/edan b/db/themes/edan deleted file mode 100644 index b6a557f..0000000 --- a/db/themes/edan +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-edan diff --git a/db/themes/eden b/db/themes/eden deleted file mode 100644 index 075ab84..0000000 --- a/db/themes/eden +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-eden diff --git a/db/themes/emoji-powerline b/db/themes/emoji-powerline deleted file mode 100644 index 66c9911..0000000 --- a/db/themes/emoji-powerline +++ /dev/null @@ -1 +0,0 @@ -https://github.com/wyqydsyq/emoji-powerline diff --git a/db/themes/es b/db/themes/es deleted file mode 100644 index c897aa4..0000000 --- a/db/themes/es +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-es \ No newline at end of file diff --git a/db/themes/fishbone b/db/themes/fishbone deleted file mode 100644 index dd5b011..0000000 --- a/db/themes/fishbone +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-fishbone diff --git a/db/themes/fishface b/db/themes/fishface deleted file mode 100644 index 7d98ca4..0000000 --- a/db/themes/fishface +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-fishface diff --git a/db/themes/fishy-drupal b/db/themes/fishy-drupal deleted file mode 100644 index 7af60ac..0000000 --- a/db/themes/fishy-drupal +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-fishy-drupal diff --git a/db/themes/fisk b/db/themes/fisk deleted file mode 100644 index 523c39a..0000000 --- a/db/themes/fisk +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-fisk diff --git a/db/themes/flash b/db/themes/flash deleted file mode 100644 index 92533ff..0000000 --- a/db/themes/flash +++ /dev/null @@ -1 +0,0 @@ -https://github.com/fishery/flash diff --git a/db/themes/fox b/db/themes/fox deleted file mode 100644 index cd61ce9..0000000 --- a/db/themes/fox +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-fox diff --git a/db/themes/gentoo b/db/themes/gentoo deleted file mode 100644 index b5def15..0000000 --- a/db/themes/gentoo +++ /dev/null @@ -1 +0,0 @@ -https://github.com/ribugent/theme-gentoo diff --git a/db/themes/gianu b/db/themes/gianu deleted file mode 100644 index a663ed4..0000000 --- a/db/themes/gianu +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-gianu diff --git a/db/themes/gitstatus b/db/themes/gitstatus deleted file mode 100644 index 58f2438..0000000 --- a/db/themes/gitstatus +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-gitstatus diff --git a/db/themes/gnuykeaj b/db/themes/gnuykeaj deleted file mode 100644 index 90eb711..0000000 --- a/db/themes/gnuykeaj +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-gnuykeaj diff --git a/db/themes/godfather b/db/themes/godfather deleted file mode 100644 index 6cab30a..0000000 --- a/db/themes/godfather +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-godfather diff --git a/db/themes/hulk b/db/themes/hulk deleted file mode 100644 index 6c2e95d..0000000 --- a/db/themes/hulk +++ /dev/null @@ -1 +0,0 @@ -https://github.com/fishery/hulk diff --git a/db/themes/idan b/db/themes/idan deleted file mode 100644 index 22a5bd4..0000000 --- a/db/themes/idan +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-idan diff --git a/db/themes/integral b/db/themes/integral deleted file mode 100644 index 43d76b1..0000000 --- a/db/themes/integral +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-integral diff --git a/db/themes/jacaetevha b/db/themes/jacaetevha deleted file mode 100644 index 95e0e85..0000000 --- a/db/themes/jacaetevha +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-jacaetevha diff --git a/db/themes/kawasaki b/db/themes/kawasaki deleted file mode 100644 index 730f0cc..0000000 --- a/db/themes/kawasaki +++ /dev/null @@ -1 +0,0 @@ -https://github.com/hastinbe/theme-kawasaki diff --git a/db/themes/krisleech b/db/themes/krisleech deleted file mode 100644 index 80a5378..0000000 --- a/db/themes/krisleech +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-krisleech diff --git a/db/themes/l b/db/themes/l deleted file mode 100644 index ff4c88c..0000000 --- a/db/themes/l +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-l diff --git a/db/themes/lambda b/db/themes/lambda deleted file mode 100644 index 294dc31..0000000 --- a/db/themes/lambda +++ /dev/null @@ -1 +0,0 @@ -https://github.com/hasanozgan/theme-lambda diff --git a/db/themes/lolfish b/db/themes/lolfish deleted file mode 100644 index 05d82db..0000000 --- a/db/themes/lolfish +++ /dev/null @@ -1 +0,0 @@ -https://github.com/er0/lolfish diff --git a/db/themes/mars b/db/themes/mars deleted file mode 100644 index d1e8930..0000000 --- a/db/themes/mars +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-mars diff --git a/db/themes/mokou b/db/themes/mokou deleted file mode 100644 index d807a6b..0000000 --- a/db/themes/mokou +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-mokou diff --git a/db/themes/mtahmed b/db/themes/mtahmed deleted file mode 100644 index a0d61e6..0000000 --- a/db/themes/mtahmed +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-mtahmed diff --git a/db/themes/nai b/db/themes/nai deleted file mode 100644 index dc1a1b4..0000000 --- a/db/themes/nai +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-nai diff --git a/db/themes/nelsonjchen b/db/themes/nelsonjchen deleted file mode 100644 index 736fb45..0000000 --- a/db/themes/nelsonjchen +++ /dev/null @@ -1 +0,0 @@ -https://github.com/nelsonjchen/omf-theme-nelsonjchen diff --git a/db/themes/numist b/db/themes/numist deleted file mode 100644 index 0545759..0000000 --- a/db/themes/numist +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-numist diff --git a/db/themes/ocean b/db/themes/ocean deleted file mode 100644 index bb0d22d..0000000 --- a/db/themes/ocean +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-ocean diff --git a/db/themes/pastfish b/db/themes/pastfish deleted file mode 100644 index 9ca67c4..0000000 --- a/db/themes/pastfish +++ /dev/null @@ -1 +0,0 @@ -https://github.com/chgu82837/theme-PastFish diff --git a/db/themes/perryh b/db/themes/perryh deleted file mode 100644 index 215371f..0000000 --- a/db/themes/perryh +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-perryh diff --git a/db/themes/plain b/db/themes/plain deleted file mode 100644 index a53e90f..0000000 --- a/db/themes/plain +++ /dev/null @@ -1 +0,0 @@ -https://github.com/changyuheng/theme-plain diff --git a/db/themes/pure b/db/themes/pure deleted file mode 100644 index 47c995d..0000000 --- a/db/themes/pure +++ /dev/null @@ -1 +0,0 @@ -https://github.com/rafaelrinaldi/theme-pure diff --git a/db/themes/red-snapper b/db/themes/red-snapper deleted file mode 100644 index 2dea693..0000000 --- a/db/themes/red-snapper +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-red-snapper diff --git a/db/themes/robbyrussell b/db/themes/robbyrussell deleted file mode 100644 index b25ff0a..0000000 --- a/db/themes/robbyrussell +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-robbyrussell diff --git a/db/themes/scorphish b/db/themes/scorphish deleted file mode 100644 index 005b7d5..0000000 --- a/db/themes/scorphish +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-scorphish diff --git a/db/themes/shellder b/db/themes/shellder deleted file mode 100644 index b576514..0000000 --- a/db/themes/shellder +++ /dev/null @@ -1 +0,0 @@ -https://github.com/simnalamburt/shellder diff --git a/db/themes/simple-ass-prompt b/db/themes/simple-ass-prompt deleted file mode 100644 index a1f2453..0000000 --- a/db/themes/simple-ass-prompt +++ /dev/null @@ -1 +0,0 @@ -https://github.com/lfiolhais/theme-simple-ass-prompt diff --git a/db/themes/simplevi b/db/themes/simplevi deleted file mode 100644 index 5662f6c..0000000 --- a/db/themes/simplevi +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-simplevi diff --git a/db/themes/slavic-cat b/db/themes/slavic-cat deleted file mode 100644 index da6c3d8..0000000 --- a/db/themes/slavic-cat +++ /dev/null @@ -1 +0,0 @@ -https://github.com/yangwao/omf-theme-slavic-cat diff --git a/db/themes/sushi b/db/themes/sushi deleted file mode 100644 index 51c946b..0000000 --- a/db/themes/sushi +++ /dev/null @@ -1 +0,0 @@ -https://github.com/umayr/theme-sushi \ No newline at end of file diff --git a/db/themes/syl20bnr b/db/themes/syl20bnr deleted file mode 100644 index f359c55..0000000 --- a/db/themes/syl20bnr +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-syl20bnr diff --git a/db/themes/taktoa b/db/themes/taktoa deleted file mode 100644 index b223353..0000000 --- a/db/themes/taktoa +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-taktoa diff --git a/db/themes/technopagan b/db/themes/technopagan deleted file mode 100644 index aad8b09..0000000 --- a/db/themes/technopagan +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-technopagan diff --git a/db/themes/toaster b/db/themes/toaster deleted file mode 100644 index e24cf5e..0000000 --- a/db/themes/toaster +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-toaster diff --git a/db/themes/tomita b/db/themes/tomita deleted file mode 100644 index 4989c01..0000000 --- a/db/themes/tomita +++ /dev/null @@ -1 +0,0 @@ -https://github.com/daveyarwood/tomita diff --git a/db/themes/trout b/db/themes/trout deleted file mode 100644 index 883698d..0000000 --- a/db/themes/trout +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-trout diff --git a/db/themes/uggedal b/db/themes/uggedal deleted file mode 100644 index c07b23f..0000000 --- a/db/themes/uggedal +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-uggedal diff --git a/db/themes/will b/db/themes/will deleted file mode 100644 index 9f75ba3..0000000 --- a/db/themes/will +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-will diff --git a/db/themes/yimmy b/db/themes/yimmy deleted file mode 100644 index 9bd4f45..0000000 --- a/db/themes/yimmy +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-yimmy diff --git a/db/themes/zish b/db/themes/zish deleted file mode 100644 index ebc455b..0000000 --- a/db/themes/zish +++ /dev/null @@ -1 +0,0 @@ -https://github.com/oh-my-fish/theme-zish diff --git a/docs/en-US/Packages.md b/docs/en-US/Packages.md index bda364c..64e01ae 100644 --- a/docs/en-US/Packages.md +++ b/docs/en-US/Packages.md @@ -116,25 +116,11 @@ Inside this hook, you can access two package-related variables: Packages can use this hook to clean up custom resources, etc. ->Note: for backwards-compatibility, uninstall hooks will also be run if they are located at `uninstall.fish` in the package root. +> Note: for backwards-compatibility, uninstall hooks will also be run if they are located at `uninstall.fish` in the package root. # Make it public -Oh My Fish keeps a registry of public packages under `$OMF_PATH/db/`. - -To add your package to the registry you need to: - -```fish -# For packages: -omf submit pkg/hello_world https://github.com/oh-my-fish/plugin-hello_world.git - -# For themes -omf submit theme/my_theme https://github.com/oh-my-fish/theme-my_theme.git -``` - -This will add a new entry to your local copy of the registry. Now you just need to [send us a PR][omf-pulls-link] to update the global registry. - ->When sending pull requests with package URL under Oh My Fish organization (https://github.com/oh-my-fish) we will allocate a repository inside the organization so you can push your work and join the community! :tada: +The official registry of public packages is managed in the [oh-my-fish/packages-main](https://github.com/oh-my-fish/packages-main) repository. See the README of that repository for instructions on how to add your package to the official package database. [fish-bind]: http://fishshell.com/docs/current/commands.html#bind diff --git a/pkg/omf/completions/omf.fish b/pkg/omf/completions/omf.fish index 7089a15..910a313 100644 --- a/pkg/omf/completions/omf.fish +++ b/pkg/omf/completions/omf.fish @@ -3,25 +3,31 @@ complete -c omf -f -d "Oh My Fish" -set -l installed_themes (omf.packages.list --installed --theme) -set -l installed_plugins (omf.packages.list --installed --plugin) -set -l installed $installed_themes $installed_plugins -for subcommand in "r rm remove" "c cd" - complete -c omf -f -n "__fish_seen_subcommand_from $subcommand" -a "$installed_themes" -d theme - complete -c omf -f -n "__fish_seen_subcommand_from $subcommand" -a "$installed_plugins" -d plugin +function __omf_assert_args_count -a count + set -l cmd (commandline -poc) + set -e cmd[1] + test (count $cmd) -eq $count end -set -l available_themes (omf.packages.list --available --theme) -set -l available_plugins (omf.packages.list --available --plugin) -for subcommand in "i install" +set -l installed_themes (omf.packages.list --theme) +set -l installed_plugins (omf.packages.list --plugin) +set -l installed $installed_themes $installed_plugins +for subcommand in "r rm remove" "c cd" "u update" + complete -c omf -f -n "__fish_seen_subcommand_from $subcommand; and __omf_assert_args_count 1" -a "$installed_themes" -d theme + complete -c omf -f -n "__fish_seen_subcommand_from $subcommand; and __omf_assert_args_count 1" -a "$installed_plugins" -d plugin +end + +set -l available_themes (omf.index.query --type=theme) +set -l available_plugins (omf.index.query --type=plugin) +for subcommand in "i install" "d describe" complete -c omf -f -n "__fish_seen_subcommand_from $subcommand" -a "$available_themes" -d theme complete -c omf -f -n "__fish_seen_subcommand_from $subcommand" -a "$available_plugins" -d plugin end -complete -c omf -f -n "__fish_seen_subcommand_from d desc describe" -a (printf "%s " (omf.packages.list --database --plugin)) +complete -c omf -f -n "__fish_seen_subcommand_from d desc describe" -a (printf "%s " (omf.index.query --type=plugin)) complete -c omf -f -n "__fish_seen_subcommand_from t theme" -a "$installed_themes" complete -c omf -f -n "__fish_seen_subcommand_from channel" -a "stable dev" -complete -c omf -f -n "__fish_seen_subcommand_from help" -a "install theme remove update list describe cd new submit destroy doctor" +complete -c omf -f -n "__fish_seen_subcommand_from help" -a "install theme remove update list describe cd new destroy doctor repositories" complete -c omf -f -a list -n "__fish_use_subcommand" -d "List local packages" complete -c omf -f -a describe -n "__fish_use_subcommand" -d "Get information about what packages do" @@ -29,10 +35,13 @@ complete -c omf -f -a install -n "__fish_use_subcommand" -d "Install one or mor complete -c omf -f -a theme -n "__fish_use_subcommand" -d "List / Use themes" complete -c omf -f -a remove -n "__fish_use_subcommand" -d "Remove a theme or package" complete -c omf -f -a update -n "__fish_use_subcommand" -d "Update Oh My Fish" +complete -c omf -f -a repositories -n "__fish_use_subcommand" -d "Manage package repositories" +complete -c omf -f -n "__fish_seen_subcommand_from repo repositories; and __omf_assert_args_count 1" -a list -d "List installed repositories" +complete -c omf -f -n "__fish_seen_subcommand_from repo repositories; and __omf_assert_args_count 1" -a add -d "Add a package repository" +complete -c omf -f -n "__fish_seen_subcommand_from repo repositories; and __omf_assert_args_count 1" -a remove -d "Remove a package repository" 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 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 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 doctor -n "__fish_use_subcommand" -d "Troubleshoot Oh My Fish" diff --git a/pkg/omf/functions/bundle/omf.bundle.install.fish b/pkg/omf/functions/bundle/omf.bundle.install.fish index 98a37d4..7518390 100644 --- a/pkg/omf/functions/bundle/omf.bundle.install.fish +++ b/pkg/omf/functions/bundle/omf.bundle.install.fish @@ -4,7 +4,7 @@ function omf.bundle.install or set bundle $OMF_CONFIG/bundle if test -f $bundle - set packages (omf.packages.list --installed) + set packages (omf.packages.list) set bundle_contents (cat $bundle | sort -u) for record in $bundle_contents @@ -20,12 +20,12 @@ function omf.bundle.install if not contains $name $packages omf.packages.install $name_or_url; - and set installed + or set error end end sort -u $bundle -o $bundle end - set -q installed + not set -q error end diff --git a/pkg/omf/functions/cli/omf.cli.describe.fish b/pkg/omf/functions/cli/omf.cli.describe.fish index 2c498f9..0cfb330 100644 --- a/pkg/omf/functions/cli/omf.cli.describe.fish +++ b/pkg/omf/functions/cli/omf.cli.describe.fish @@ -1,4 +1,13 @@ -function omf.cli.describe -a name - omf.packages.describe $name - return 0 +function omf.cli.describe -a package -d 'Show information about a package' + if set -l props (omf.index.stat $package description repository maintainer) + echo "Package: $package" + echo "Description: $props[1]" + echo "Repository: $props[2]" + echo "Maintainer: $props[3]" + + return 0 + end + + echo "Unable to locate package '$package'." >&2 + return 1 end diff --git a/pkg/omf/functions/cli/omf.cli.help.fish b/pkg/omf/functions/cli/omf.cli.help.fish index 2343e0c..fa93c71 100644 --- a/pkg/omf/functions/cli/omf.cli.help.fish +++ b/pkg/omf/functions/cli/omf.cli.help.fish @@ -38,11 +38,9 @@ determines what version "(omf::em)"omf update"(omf::off)" will upgrade to. Get information about what packages do. "(omf::dim)"Usage:"(omf::off)" - omf describe Get information from all available packages - omf describe "(omf::em)""(omf::off)" Get information from package by name + omf describe "(omf::em)""(omf::off)" Show information about a package "(omf::dim)"Examples:"(omf::off)" - omf describe omf describe brew " @@ -98,6 +96,21 @@ Create a new package from a template. omf new theme mytheme " + case "repo" "repositories" + echo "\ +Manage package repositories. + +"(omf::dim)"Usage:"(omf::off)" + omf repositories [list|ls] List installed repositories + omf repositories add "(omf::em)""(omf::off)" ["(omf::em)""(omf::off)"] Add a package repository + omf repositories rm|remove "(omf::em)""(omf::off)" ["(omf::em)""(omf::off)"] Remove a package repository + +"(omf::dim)"Examples:"(omf::off)" + omf repositories + omf repositories add https://github.com/vendor/fish-packages + omf repositories rm https://github.com/vendor/fish-packages master +" + case "r" "rm" "remove" "uninstall" echo "\ Remove a theme or package. @@ -112,29 +125,17 @@ Remove a theme or package. case "search" echo "\ -Search for a package or theme. +Search for a plugin or theme. "(omf::dim)"Usage:"(omf::off)" - omf search ("(omf::dim)"-pkg/--package"(omf::off)" | "(omf::dim)"-t/--theme"(omf::off)") "(omf::em)""(omf::off)" Search for a package or theme + omf search ("(omf::dim)"-p/--plugin"(omf::off)" | "(omf::dim)"-t/--theme"(omf::off)") "(omf::em)""(omf::off)" Search for a plugin or theme "(omf::dim)"Examples:"(omf::off)" - omf search -pkg nvm + omf search -p nvm omf search -t bobthefish omf search vi " - case "s" "submit" - echo "\ -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)""(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 "\ Install and list themes. @@ -169,23 +170,23 @@ Update Oh My Fish. omf "(omf::em)"help"(omf::off)" [] "(omf::dim)"Commands:"(omf::off)" - "(omf::em)"l"(omf::off)"ist List local packages. - "(omf::em)"d"(omf::off)"escribe Get information about what packages do. - "(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)"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)"search"(omf::off)" Search for a package or theme. - "(omf::em)"s"(omf::off)"ubmit Submit a package to the registry. - "(omf::em)"destroy"(omf::off)" Uninstall Oh My Fish. - "(omf::em)"doctor"(omf::off)" Troubleshoot Oh My Fish. - "(omf::em)"help"(omf::off)" Shows help about a specific action. + "(omf::em)"c"(omf::off)"d Change directory to plugin/theme directory. + "(omf::em)"d"(omf::off)"escribe Get information about what packages do. + "(omf::em)"destroy"(omf::off)" Uninstall Oh My Fish. + "(omf::em)"doctor"(omf::off)" Troubleshoot Oh My Fish. + "(omf::em)"help"(omf::off)" Shows help about a specific action. + "(omf::em)"i"(omf::off)"nstall Install one or more packages. + "(omf::em)"l"(omf::off)"ist List local packages. + "(omf::em)"n"(omf::off)"ew Create a new package from a template. + "(omf::em)"r"(omf::off)"emove Remove a theme or package. + "(omf::em)"repo"(omf::off)"sitories Manage package repositories. + "(omf::em)"s"(omf::off)"earch Search for a package or theme. + "(omf::em)"t"(omf::off)"heme List / Use themes. + "(omf::em)"u"(omf::off)"pdate Update 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. + "(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 diff --git a/pkg/omf/functions/cli/omf.cli.install.fish b/pkg/omf/functions/cli/omf.cli.install.fish index 828df24..c1aa5d7 100644 --- a/pkg/omf/functions/cli/omf.cli.install.fish +++ b/pkg/omf/functions/cli/omf.cli.install.fish @@ -1,6 +1,9 @@ function omf.cli.install set fail_count 0 + omf.index.update + or return 1 + switch (count $argv) case 0 omf.bundle.install; @@ -11,8 +14,8 @@ function omf.cli.install and require $package # If package is a theme, set it to active. - if contains "$package" (omf.packages.list --installed --theme) - omf.theme.set "$package" + if contains -- $package (omf.packages.list --theme) + omf.theme.set $package end test $status != 0; diff --git a/pkg/omf/functions/cli/omf.cli.list.fish b/pkg/omf/functions/cli/omf.cli.list.fish index 3e89696..6183cde 100644 --- a/pkg/omf/functions/cli/omf.cli.list.fish +++ b/pkg/omf/functions/cli/omf.cli.list.fish @@ -2,10 +2,10 @@ function omf.cli.list switch (count $argv) case 0 echo (set_color -u)Plugins(set_color normal) - omf.packages.list --installed --plugin | column + omf.packages.list --plugin | column echo echo (set_color -u)Themes(set_color normal) - omf.packages.list --installed --theme | column + omf.packages.list --theme | column case '*' omf.packages.list $argv | column end diff --git a/pkg/omf/functions/cli/omf.cli.search.fish b/pkg/omf/functions/cli/omf.cli.search.fish index b7d04ec..8c7fd05 100644 --- a/pkg/omf/functions/cli/omf.cli.search.fish +++ b/pkg/omf/functions/cli/omf.cli.search.fish @@ -1,26 +1,38 @@ -function omf.cli.search -d "CLI parser for the search command" - +function omf.cli.search -d 'Searches all available packages' switch (count $argv); case 1; - omf.search.pkg $argv[1] + omf.index.update --if-missing + + echo (omf::under)"Plugins"(omf::off) + __omf.cli.search.output --type=plugin --text=$argv[1] echo - omf.search.theme $argv[1] + echo (omf::under)"Themes"(omf::off) + __omf.cli.search.output --type=theme --text=$argv[1] + case 2; + omf.index.update --if-missing + switch "$argv[1]" - case "-pkg" "--package"; - omf.search.pkg $argv[2] + case "-p" "--plugin"; + __omf.cli.search.output --type=plugin --text=$argv[2] case "-t" "--theme"; - omf.search.theme $argv[2] + __omf.cli.search.output --type=theme --text=$argv[2] case '*'; - __omf.cli.search.usage + omf.cli.help search + return 1 end + case '*'; - __omf.cli.search.usage + omf.cli.help search + return 1 + end + + return 0 +end + +function __omf.cli.search.output + for package in (omf.index.query $argv) + set -l desc (omf.index.stat $package description) + echo "$package - $desc" end end - -function __omf.cli.search.usage -d "Print usage" - - echo (omf::err)"Usage: omf search ([-t | --theme]) ([-pkg | --package]) item"(omf::off) - -end diff --git a/pkg/omf/functions/cli/omf.cli.submit.fish b/pkg/omf/functions/cli/omf.cli.submit.fish deleted file mode 100644 index 388e248..0000000 --- a/pkg/omf/functions/cli/omf.cli.submit.fish +++ /dev/null @@ -1,10 +0,0 @@ -function omf.cli.submit - switch (count $argv) - case 2 - omf.packages.submit $argv - case "*" - echo (omf::err)"Argument missing"(omf::off) >&2 - echo "Usage: $_ "(omf::em)"submit"(omf::off)" "(omf::em)"pkg|themes"(omf::off)"/ " >&2 - return $OMF_MISSING_ARG - end -end diff --git a/pkg/omf/functions/cli/omf.cli.themes.list.fish b/pkg/omf/functions/cli/omf.cli.themes.list.fish index 926b244..5c5d828 100644 --- a/pkg/omf/functions/cli/omf.cli.themes.list.fish +++ b/pkg/omf/functions/cli/omf.cli.themes.list.fish @@ -4,8 +4,8 @@ function omf.cli.themes.list set -l highlight_current s/"$regex_current"/"\1"(omf::em)"\2"(omf::off)"\3"/g echo (omf::under)"Installed:"(omf::off) - omf.packages.list --installed --theme | column | sed -E "$highlight_current" + omf.packages.list --theme | column | sed -E "$highlight_current" echo echo (omf::under)"Available:"(omf::off) - omf.packages.list --available --theme | column + omf.index.query --type=theme | column end diff --git a/pkg/omf/functions/cli/omf.cli.update.fish b/pkg/omf/functions/cli/omf.cli.update.fish index 0f42105..9eb0b85 100644 --- a/pkg/omf/functions/cli/omf.cli.update.fish +++ b/pkg/omf/functions/cli/omf.cli.update.fish @@ -8,7 +8,7 @@ function omf.cli.update and set -e packages[$index] or set -e update_core else - set packages (omf.packages.list --installed) + set packages (omf.packages.list) end if set -q update_core @@ -27,6 +27,9 @@ function omf.cli.update end end + omf.index.update + or return 1 + for package in $packages omf.packages.update $package end diff --git a/pkg/omf/functions/index/omf.index.path.fish b/pkg/omf/functions/index/omf.index.path.fish new file mode 100644 index 0000000..b7c09db --- /dev/null +++ b/pkg/omf/functions/index/omf.index.path.fish @@ -0,0 +1,5 @@ +function omf.index.path -d 'Get the path to the local package index' + set -q XDG_CACHE_HOME + and echo "$XDG_CACHE_HOME/omf" + or echo "$HOME/.cache/omf" +end diff --git a/pkg/omf/functions/index/omf.index.query.fish b/pkg/omf/functions/index/omf.index.query.fish new file mode 100644 index 0000000..2ab20c3 --- /dev/null +++ b/pkg/omf/functions/index/omf.index.query.fish @@ -0,0 +1,101 @@ +function omf.index.query -d 'Query packages in the index' + set -l q_type any + set -l q_name '' + set -l q_text '' + + # Parse search terms. + for arg in $argv + switch "$arg" + case '--type=any' + set q_type any + case '--type=plugin' + set q_type plugin + case '--type=theme' + set q_type theme + case '--name=?*' + set -l IFS '=' + echo "$arg" | read dummy q_name + case '--text=?*' + set -l IFS '=' + echo "$arg" | read dummy q_text + case '*' + echo "Invalid search term: '$arg'" >&2 + return 1 + end + end + + # Put all packages into a list. + set -l packages (omf.index.path)/*/packages/* + + # If there are no packages, there is nothing to search. + if not set -q packages[1] + return 1 + end + + # Perform a text search if any filters were given. + if set -q argv[1] + set results (command awk -v "q_type=$q_type" -v "q_name=$q_name" -v "q_text=$q_text" ' + function flush() { + if (package && type_matches && name_matches && text_matches) { + print package; + } + } + + BEGIN { + FS = "[ \t]*=[ \t]*"; + q_name = tolower(q_name); + q_text = tolower(q_text); + } + + FNR == 1 { + flush(); + + if (q_type == "any") { + type_matches = 1; + } else { + type_matches = 0; + } + name_matches = 0; + text_matches = 0; + + package = parts[split(FILENAME, parts, "/")]; + + if (match(package, q_name)) { + name_matches = 1; + } + + if (match(package, q_text)) { + text_matches = 1; + } + } + + !type_matches && !/^#/ && $1 == "type" && $2 == q_type { + type_matches = 1; + } + + !text_matches && !/^#/ { + if (match(tolower($2), q_text)) { + text_matches = 1; + } + } + + END { + flush(); + } + ' $packages) + else + # No filters, just list all package names. + set results (for package in $packages + command basename $package + end) + end + + if not set -q results[1] + return 1 + end + + # Sort results alphabetically. + for result in $results + echo $result + end | command sort -d +end diff --git a/pkg/omf/functions/index/omf.index.repositories.fish b/pkg/omf/functions/index/omf.index.repositories.fish new file mode 100644 index 0000000..4ebb251 --- /dev/null +++ b/pkg/omf/functions/index/omf.index.repositories.fish @@ -0,0 +1,94 @@ +function omf.index.repositories -d 'Manage package repositories' + # List repositories by default. + if not set -q argv[1] + set argv[1] list + end + + switch $argv[1] + case help --help -h + omf help repositories + return + + case list ls + for file in {$OMF_PATH,$OMF_CONFIG}/repositories + if test -f $file + command cat $file + end + end + + case add + if set -q argv[2] + set repo_url $argv[2] + else + echo "URL not specified" >&2 + return 1 + end + + if set -q argv[3] + set repo_branch $argv[3] + else + set repo_branch master + end + + set -l repo "$repo_url $repo_branch" + + # Check if we already have the repository. + if test -f $OMF_CONFIG/repositories + if command grep -q $repo $OMF_CONFIG/repositories + echo "The repository is already added." >&2 + return 1 + end + end + + if command grep -q $repo $OMF_PATH/repositories + echo "The repository is already added." >&2 + return 1 + end + + # Before we add, do a quick ls-remote to see if the URL is a valid repo. + if not command git ls-remote --exit-code $repo_url refs/heads/$repo_branch > /dev/null ^&1 + echo "The remote repository could not be found." >&2 + return 1 + end + + echo "$repo" >> $OMF_CONFIG/repositories + + case rm remove + if set -q argv[2] + set repo_url $argv[2] + else + echo "URL not specified" >&2 + return 1 + end + + if set -q argv[3] + set repo_branch $argv[3] + else + set repo_branch master + end + + set -l repo "$repo_url $repo_branch" + + # Check to see if user has repositories and if the given URL is listed. + if test -f $OMF_CONFIG/repositories + if command grep -q $repo $OMF_CONFIG/repositories + command grep -v $repo $OMF_CONFIG/repositories > $OMF_CONFIG/repositories.swp + command mv $OMF_CONFIG/repositories.swp $OMF_CONFIG/repositories + + return + end + end + + # The given URL is not listed, check if it is a built-in repository they can't remove. + if command grep -q $repo $OMF_PATH/repositories + echo "The repository '$repo' is built-in and cannot be removed." >&2 + else + echo "Could not find user repository '$repo'" >&2 + end + return 1 + + case '*' + echo "Unknown command '$argv[1]'" >&2 + return 1 + end +end diff --git a/pkg/omf/functions/index/omf.index.stat.fish b/pkg/omf/functions/index/omf.index.stat.fish new file mode 100644 index 0000000..c6bd6c4 --- /dev/null +++ b/pkg/omf/functions/index/omf.index.stat.fish @@ -0,0 +1,64 @@ +function omf.index.stat -a name -d 'Get package properties' + if test -z "$name" + return 1 + end + + set -e argv[1] + set -l properties $argv + set -l package_file + + # Find the package definition file. + set -l package_files (omf.index.path)/*/packages/$name + + if set -q package_files[1] + set package_file $package_files[1] + else + return 1 + end + + # If no properties are specified, output all properties with names. + if not set -q properties[1] + command cat $package_file + return + end + + # Find only the values of the properties requested. + command awk ' + BEGIN { + FS = "[ \t]*=[ \t]*"; + + # Set default values for certain properties. + defaults["type"] = "plugin"; + + # Get the list of properties to display. + for (i = 2; i < ARGC; i++) { + properties[i - 1] = ARGV[i]; + delete ARGV[i]; + count++; + } + } + + !/^#/ { + # Store the property value. + values[$1] = $2; + } + + END { + # Print out each requested property. + for (i = 1; i <= count; i++) { + property = properties[i]; + + if (property in values) { + # If the property was set, print it out. + print values[property]; + } else if (property in defaults) { + # If the property was not set and has a default value, print it out. + print defaults[property]; + } else { + # Print a blank line if the property was not found. + print ""; + } + } + } + ' - $properties < $package_file +end diff --git a/pkg/omf/functions/index/omf.index.update.fish b/pkg/omf/functions/index/omf.index.update.fish new file mode 100644 index 0000000..1e2c69f --- /dev/null +++ b/pkg/omf/functions/index/omf.index.update.fish @@ -0,0 +1,62 @@ +function omf.index.update -d 'Update package indexes' + # Only update if the index is missing. + if contains -- --if-missing $argv + set -l paths (omf.index.path)/* + + if set -q paths[1] + return 0 + end + end + + # Find repository lists. + for list in {$OMF_PATH,$OMF_CONFIG}/repositories + test -f $list + and set lists $lists $list + end + + # Read the configured repositories from the lists. + if set -q lists[1] + set repositories (command awk ' + { + dir = $1 "_" $2; + gsub(/[ \/:@]/, "_", dir); + if (!visited[dir]++) { + print $1 "\n" $2 "\n" dir; + } + } + ' $lists) + end + + # Update repositories. + while set -q repositories[1] + set -l url $repositories[1] + set -l branch $repositories[2] + set -l path (omf.index.path)/$repositories[3] + set valid_paths $valid_paths $path + + echo -n "Updating $url $branch... " + if begin + if not test -d $path + command git clone --quiet --depth 1 --branch $branch $url $path + else + command git -C $path pull --quiet + end + end + echo "Done!" + else + echo "Error" + return 1 + end + + set -e repositories[1..3] + end + + # Remove repositories not in the lists. + for path in (omf.index.path)/* + if not contains -- $path $valid_paths + command rm -rf $path + end + end + + return 0 +end diff --git a/pkg/omf/functions/omf.fish b/pkg/omf/functions/omf.fish index e26d4c6..7e673b1 100644 --- a/pkg/omf/functions/omf.fish +++ b/pkg/omf/functions/omf.fish @@ -55,19 +55,19 @@ function omf -d "Oh My Fish" case "r" "rm" "remove" "uninstall" omf.cli.remove $arguments - case "s" "submit" - omf.cli.submit $arguments - case "t" "theme" omf.cli.theme $arguments case "u" "update" omf.cli.update $arguments + case "repo" "repositories" + omf.index.repositories $arguments + case "channel" omf.cli.channel $arguments - case "search" + case "s" "search" omf.cli.search $arguments case "version" diff --git a/pkg/omf/functions/packages/omf.packages.describe.fish b/pkg/omf/functions/packages/omf.packages.describe.fish deleted file mode 100644 index 326837d..0000000 --- a/pkg/omf/functions/packages/omf.packages.describe.fish +++ /dev/null @@ -1,18 +0,0 @@ -function omf.packages.describe -a name - if test (count $argv) -eq 0 - for package in (omf.packages.list --database) - echo $package - (omf.packages.describe $package) - end - else - set package_path $OMF_PATH/db/pkg/$name - - if test -e $package_path - set url (cat $package_path) - set repo (basename (dirname $url))/(basename $url) - curl -s https://api.github.com/repos/$repo ^/dev/null | grep \"description\" | head -1 | cut -d':' -f2- | sed -e 's/["|,]//g;s/^[ \t]//g' - else - echo (omf::err)"$name is not a valid pkg."(omf::off) >&2 - return $OMF_INVALID_ARG - end - end -end diff --git a/pkg/omf/functions/packages/omf.packages.install.fish b/pkg/omf/functions/packages/omf.packages.install.fish index 4e1521a..4bfe1ae 100644 --- a/pkg/omf/functions/packages/omf.packages.install.fish +++ b/pkg/omf/functions/packages/omf.packages.install.fish @@ -11,44 +11,59 @@ function __omf.packages.install.error.already end function omf.packages.install -a name_or_url - if test \( -e $OMF_PATH/db/themes/$name_or_url \) -o (echo $name_or_url | grep theme-) - set install_type "theme" - set parent_path "themes" - else - set install_type "package" - set parent_path "pkg" - end - - if test -e $OMF_PATH/db/$parent_path/$name_or_url + if set -l props (omf.index.stat $name_or_url type repository) + set package_type $props[1] set name $name_or_url - set url (cat $OMF_PATH/db/$parent_path/$name) + set url $props[2] else set name (omf.packages.name $name_or_url) set url $name_or_url end - if test -e $OMF_PATH/$parent_path/$name - __omf.packages.install.error.already "$install_type $name_or_url" + if contains -- $name (omf.packages.list) + __omf.packages.install.error.already "$name_or_url" return $OMF_INVALID_ARG end - echo (omf::dim)"Installing $install_type $name"(omf::off) + echo (omf::dim)"Installing package $name"(omf::off) - if omf.repo.clone $url $OMF_PATH/$parent_path/$name - omf.bundle.install $OMF_PATH/$parent_path/$name/bundle - omf.bundle.add $install_type $name_or_url + set -l install_dir $OMF_PATH/pkg/$name - # Run the install hook. - if not omf.packages.run_hook $OMF_PATH/$parent_path/$name install - __omf.packages.install.error "$install_type $name" - return $OMF_UNKNOWN_ERR - end - - __omf.packages.install.success "$install_type $name" - else - __omf.packages.install.error "$install_type $name" + # Clone the package repository. + if not omf.repo.clone $url $install_dir + __omf.packages.install.error "$name" return $OMF_UNKNOWN_ERR end + # If we don't know the package type yet, check if the package is a theme. + if not set -q package_type + echo $url | grep -q theme- + and set package_type theme + or set package_type plugin + end + + # If the package is a theme, move it to the themes directory. + if test $package_type = theme + test -d $OMF_PATH/themes + or command mkdir -p $OMF_PATH/themes + + command mv $install_dir $OMF_PATH/themes/$name + set install_dir $OMF_PATH/themes/$name + + omf.bundle.add theme $name_or_url + else + omf.bundle.add package $name_or_url + end + + omf.bundle.install $install_dir/bundle + + # Run the install hook. + if not omf.packages.run_hook $install_dir install + __omf.packages.install.error "$name" + return $OMF_UNKNOWN_ERR + end + + __omf.packages.install.success "$name" + return 0 end diff --git a/pkg/omf/functions/packages/omf.packages.list.fish b/pkg/omf/functions/packages/omf.packages.list.fish index 4bae755..f32fa21 100644 --- a/pkg/omf/functions/packages/omf.packages.list.fish +++ b/pkg/omf/functions/packages/omf.packages.list.fish @@ -1,93 +1,31 @@ -set -l builtin_package_path {$OMF_PATH,$OMF_CONFIG}/pkg*/{omf,fish-spec} +set -l builtin_packages {$OMF_PATH,$OMF_CONFIG}/pkg*/{omf,fish-spec} -function __omf.packages.basename - set -l IFS / - for path in $argv - echo $path | read -la components - echo $components[-1] - end -end - -function __omf.packages.list.available -a type - set -l database_package_path $OMF_PATH/db/pkg/* - set -l database_theme_path $OMF_PATH/db/themes/* - set -l installed_package_path {$OMF_CONFIG,$OMF_PATH}/pkg/* - set -l installed_theme_path {$OMF_CONFIG,$OMF_PATH}/themes/* - - set -l database_packages (__omf.packages.basename $database_package_path) - set -l database_themes (__omf.packages.basename $database_theme_path) - set -l installed_packages (__omf.packages.basename $installed_package_path) - set -l installed_themes (__omf.packages.basename $installed_theme_path) - - test "$type" = "--theme"; or for package in $database_packages - contains $package $installed_packages; or echo $package - end - - test "$type" = "--plugin"; or for theme in $database_themes - contains $path $installed_themes; or echo $theme - end -end - -function __omf.packages.list.database -a type - set -l list - set -l database_package_path $OMF_PATH/db/pkg/* - set -l database_theme_path $OMF_PATH/db/themes/* - - test "$type" = "--theme"; or for path in $database_package_path - set list $list $path - end - - test "$type" = "--plugin"; or for path in $database_theme_path - set list $list $path - end - - __omf.packages.basename $list -end - -function __omf.packages.list.installed -a type - set -l list - set -l installed_package_path $OMF_PATH/pkg/* - set -l installed_theme_path $OMF_PATH/themes/* - - test "$type" = "--theme"; or for path in $installed_package_path - contains $path $builtin_package_path; or set list $list $path - end - - test "$type" = "--plugin"; or for path in $installed_theme_path - set list $list $path - end - - __omf.packages.basename $list -end - -function omf.packages.list - set -l type_index (begin - contains -i -- --theme $argv - contains -i -- -t $argv - contains -i -- --plugin $argv - contains -i -- -p $argv - end) - - set -l option_index (begin - contains -i -- --available $argv - contains -i -- -a $argv - contains -i -- --installed $argv - contains -i -- -i $argv - contains -i -- --database $argv - contains -i -- -d $argv - end) - - set -l option $argv[$option_index] - set -l type $argv[$type_index] - - switch "$option" - case "-a" "--available" - __omf.packages.list.available $type - case "-d" "--database" - __omf.packages.list.database $type - case "-i" "--installed" - __omf.packages.list.installed $type - case "*" - __omf.packages.list.installed $type + +function omf.packages.list -d 'List installed packages' + set -l show_plugins + set -l show_themes + + if begin; contains -- --plugin $argv; or contains -- -p $argv; end + set -e show_themes + end + + if begin; contains -- --theme $argv; or contains -- -t $argv; end + set show_themes + set -e show_plugins + end + + set -l plugins_paths $OMF_PATH/pkg/* + set -l themes_paths $OMF_PATH/themes/* + + if set -q show_plugins + for path in $plugins_paths + contains $path $builtin_packages; or command basename $path + end + end + + if set -q show_themes + for path in $themes_paths + command basename $path + end end end diff --git a/pkg/omf/functions/packages/omf.packages.name.fish b/pkg/omf/functions/packages/omf.packages.name.fish index 904c07e..4141200 100644 --- a/pkg/omf/functions/packages/omf.packages.name.fish +++ b/pkg/omf/functions/packages/omf.packages.name.fish @@ -1,3 +1,3 @@ function omf.packages.name -a name_or_url - basename $name_or_url | sed -E 's/^(omf-)?((plugin|pkg|theme)-)?//;s/.git$//' + command basename $name_or_url | sed -E 's/^(omf-)?((plugin|pkg|theme)-)?//;s/.git$//' end diff --git a/pkg/omf/functions/packages/omf.packages.submit.fish b/pkg/omf/functions/packages/omf.packages.submit.fish deleted file mode 100644 index b10718f..0000000 --- a/pkg/omf/functions/packages/omf.packages.submit.fish +++ /dev/null @@ -1,42 +0,0 @@ -# SYNOPSIS -# Submit a package to the registry -# -# OPTIONS -# name Name of the package. -# [url] URL to the package repository. - -function omf.packages.submit -a name url -d "Submit a package to the registry" - switch (dirname $name) - case pkg - case themes - case "*" - echo (omf::err)"Missing directory name: pkg/ or themes/"(omf::off) >&2 - return $OMF_INVALID_ARG - end - - set -l pkg (basename $name) - if not omf.packages.valid_name $pkg - echo (omf::err)"$pkg is not a valid package/theme name"(omf::off) >&2 - return $OMF_INVALID_ARG - end - - if test -z "$url" - echo (omf::em)"URL not specified, looking for a remote origin..."(omf::off) >&2 - set url (git config --get remote.origin.url) - if test -z "$url" - echo (omf::em)"$pkg remote URL not found"(omf::off) >&2 - echo "Try: git remote add or see Docs#Submitting" >&2 - return $OMF_INVALID_ARG - end - else - if test -e "$OMF_PATH/db/$name" - echo (omf::err)"Error: $pkg already exists in the registry!"(omf::off) >&2 - return $OMF_INVALID_ARG - else - echo "$url" > $OMF_PATH/db/$name - echo (omf::em)"$pkg added to the local "(dirname $name)" registry."(omf::off) - echo "Want to contribute? Send us a PR → github.com/oh-my-fish/oh-my-fish" - return 0 - end - end -end diff --git a/pkg/omf/functions/search/omf.search.pkg.fish b/pkg/omf/functions/search/omf.search.pkg.fish deleted file mode 100644 index b814ffd..0000000 --- a/pkg/omf/functions/search/omf.search.pkg.fish +++ /dev/null @@ -1,10 +0,0 @@ -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 diff --git a/pkg/omf/functions/search/omf.search.theme.fish b/pkg/omf/functions/search/omf.search.theme.fish deleted file mode 100644 index 61a32a8..0000000 --- a/pkg/omf/functions/search/omf.search.theme.fish +++ /dev/null @@ -1,10 +0,0 @@ -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 diff --git a/pkg/omf/functions/themes/omf.theme.set.fish b/pkg/omf/functions/themes/omf.theme.set.fish index f12e6d8..c9ebb90 100644 --- a/pkg/omf/functions/themes/omf.theme.set.fish +++ b/pkg/omf/functions/themes/omf.theme.set.fish @@ -1,5 +1,5 @@ function omf.theme.set -a target_theme - if not contains "$target_theme" (omf.packages.list --installed --theme) + if not contains "$target_theme" (omf.packages.list --theme) echo (omf::err)"Theme not installed!"(omf::off) echo Install it using (omf::em)omf install $target_theme(omf::off) return $OMF_INVALID_ARG diff --git a/pkg/omf/init.fish b/pkg/omf/init.fish index dc8e668..8fae243 100644 --- a/pkg/omf/init.fish +++ b/pkg/omf/init.fish @@ -23,4 +23,4 @@ function omf::off set_color normal ^ /dev/null end -autoload $path/functions/{compat,core,packages,themes,bundle,util,repo,cli,search} +autoload $path/functions/{compat,core,index,packages,themes,bundle,util,repo,cli,search} diff --git a/repositories b/repositories new file mode 100644 index 0000000..e3f5ae5 --- /dev/null +++ b/repositories @@ -0,0 +1 @@ +https://github.com/oh-my-fish/packages-main master