README: Move packages section to docs directory

pull/13/head
Derek Stavis 9 years ago
parent 76461696a3
commit 11d96d8c02

@ -77,12 +77,6 @@ Uninstall Oh My Fish. See [uninstall](#uninstall) for more information.
+ [Startup](#startup)
+ [Dotfiles](#dotfiles)
+ [Core Library](#core-library)
+ [Packages](#packages)
+ [Creating](#creating)
+ [Submitting](#submitting)
+ [Initialization](#initialization)
+ [Uninstall](#uninstall)
+ [Ignoring](#ignoring)
## Startup
@ -108,90 +102,6 @@ The core library is a minimum set of basic utility functions that extend your sh
+ [See the documentation](/lib/README.md).
## Packages
### Creating
> A package name may only contain lowercase letters and hyphens to separate words.
To scaffold out a new package:
```fish
$ omf new pkg my_package
my_package/
README.md
my_package.fish
completions/my_package.fish
```
> Use `omf new theme my_theme` for themes.
Please provide [auto completion](http://fishshell.com/docs/current/commands.html#complete) for your utilities if applicable and describe how your package works in the `README.md`.
`my_package.fish` defines a single function:
```fish
function my_package -d "My package"
end
```
> Bear in mind that fish lacks a private scope so consider the following options to avoid polluting the global namespace:
+ Prefix functions: `my_package_my_func`.
+ Using [blocks](http://fishshell.com/docs/current/commands.html#block).
### Submitting
Oh My Fish keeps a registry of packages under `$OMF_PATH/db/`.
To create a new entry run:
```fish
omf submit pkg/my_package .../my_package.git
```
Similarly for themes use:
```fish
omf submit theme/my_theme .../my_theme.git
```
This will add a new entry to your local copy of the registry. Please [send us a PR][omf-pulls-link] to update the global registry.
### Initialization
If you want to be [notified](http://fishshell.com/docs/current/commands.html#emit) when your package loads, declare the following function in your `my_package.fish`:
```fish
function init -a path --on-event init_mypkg
end
```
Use this event to modify the environment, load resources, autoload functions, etc. If your package does not export any functions, you can still use this event to add functionality to your package.
### Uninstall
Oh My Fish emits `uninstall_<pkg>` events before a package is removed via `omf remove <pkg>`. Subscribers can use the event to clean up custom resources, etc.
```fish
function uninstall --on-event uninstall_pkg
end
```
### Ignoring
Remove any packages you wish to turn off using `omf remove <package name>`. Alternatively, you can set a global env variable `$OMF_IGNORE` in your `~/.config/fish/config.fish` with the packages you wish to ignore. For example:
```fish
set -g OMF_IGNORE skip this that ...
```
# License
MIT © [Oh My Fish][contributors] :metal:

@ -0,0 +1,72 @@
## Creating
Package names may only contain lowercase letters and hyphens to separate words. To scaffold out a new package:
```fish
$ omf new pkg my_package
my_package/
README.md
my_package.fish
completions/my_package.fish
```
> Use `omf new theme my_theme` for themes.
Please provide [auto completion](http://fishshell.com/docs/current/commands.html#complete) for your utilities if applicable and describe how your package works in the `README.md`.
`my_package.fish` defines a single function:
```fish
function my_package -d "My package"
end
```
> Bear in mind that fish lacks a private scope so consider the following options to avoid polluting the global namespace:
+ Prefix functions: `my_package_my_func`.
+ Using [blocks](http://fishshell.com/docs/current/commands.html#block).
## Submitting
Oh My Fish keeps a registry of packages under `$OMF_PATH/db/`.
To create a new entry run:
```fish
omf submit pkg/my_package .../my_package.git
```
Similarly for themes use:
```fish
omf submit theme/my_theme .../my_theme.git
```
This will add a new entry to your local copy of the registry. Please [send us a PR][omf-pulls-link] to update the global registry.
## Initialization
If you want to be [notified](http://fishshell.com/docs/current/commands.html#emit) when your package loads, declare the following function in your `my_package.fish`:
```fish
function init -a path --on-event init_mypkg
end
```
Use this event to modify the environment, load resources, autoload functions, etc. If your package does not export any functions, you can still use this event to add functionality to your package.
## Uninstall
Oh My Fish emits `uninstall_<pkg>` events before a package is removed via `omf remove <pkg>`. Subscribers can use the event to clean up custom resources, etc.
```fish
function uninstall --on-event uninstall_pkg
end
```
[omf-pulls-link]: https://github.com/oh-my-fish/oh-my-fish/pulls
Loading…
Cancel
Save