When using basename without any arguments, a usage helper as following
is displayed:
```
usage: basename string [suffix]
basename [-a] [-s suffix] string [...]
```
When listing the installed packages, if no theme was installed (e.g.
first installation), the `themes/` folder are empty and the usage helper
is displayed. This change addresses it by suppressing the message.
Since `test` interprets arguments starting with a single dash as
options when comparing `test -h = --help` just swap parameter
orders as in `test --help = -h`. Also related to issue #161 is the
issue from fish repository at fish-shell/fish-shell#2332
As #115 migrated list functions, after updating Oh My Fish code
the omf.list_installed_packages gets removed, but is still being
used by the update code.
This commit fixes it by providing a wrapper function.
- Move theme installation to cli entry point (omf.fish)
- Generalize XDG_CONFIG_HOME code in `omf.xdg.config_home`
- Generalize prompt conflicts check in `omf.checks.fish_prompt`
* Migrate `omf.doctor` to use it
+ Change theme activation steps
- Create user function path if not existent
- Check for conflicts in fish_prompt, aborts if found
- Remove current theme from autoloading paths
- Add target theme to autoloading paths
- Link target theme's fish_prompt to user's
- Persist selected theme to $OMF_CONFIG/theme
This approach brings two major advantages:
- Theme prompt now shows accordingly in fish_config web interface
- Faster theme changes, reducing it from seconds to some milis
- Avoids calling refresh, which makes users much more happy
Instead of having every plugin function inside the same file, which
increases the loading time unnecessarily and is not fishy, source the
`uninstall.fish` file for the plugin before the `uninstall_$plugin_name`
event is emitted.
In order to pro-actively diagnose an issue on someone's computer, a
`omf doctor' command is being added. This command will initially check
errors that could cause a theme to not be loaded, but in the future more
checks are going to be added to prevent issues from being created for
problems that are fixable by the Oh My Fish user alone.
When calling `omf destroy`, the `bundle` file is completely erased
because we are calling `remove_package` on each installed package. We
don't want to erase that file, we just want to emit the event and later
on remove the code, which is done with `rm -rf "$OMF_PATH"`.
Stash is a shell script that does not support `--git-dir`, not even on
latest versions. We need to use `git -C` which was only added on recent
versions of `git`.
`omf update` will fail in case omf need needs to run `git stash` and
git is not compatible.