Commit Graph

99 Commits

Author SHA1 Message Date
Derek Stavis
49dda5c2f7 Reorganize omf plugin structure
This updates omf plugin to new architecture, moving
functions to `functions` directory. It also revamps the
separation of concerns between CLI and underlying
implementations, organizing them into directories,
whose are autoloaded in plugin startup.
2016-01-09 18:59:54 -02:00
Itzik Ephraim
4dbb1ca57c Support omf- prefix for packages 2016-01-01 20:15:49 +02:00
Itzik Ephraim
c5670bb9ee 'omf theme' now lists installed and other available themes separately.
Headings are underlined.
Current theme is highlighted in the Installed category.
2015-12-21 20:13:02 +02:00
Bruno Pinto
ea4d78ffc3 Basic omf tests 2015-12-19 11:46:09 +00:00
Derek Stavis
acace9039c omf/templates: Align README headers based on omf's 2015-11-30 01:36:54 -02:00
Derek Stavis
fa88749da3 install: Implement package dependency installation 2015-11-17 21:07:12 -02:00
Bruno Pinto
f57ef1b4b5 Suppress basename usage output
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.
2015-11-12 12:41:36 +00:00
Derek Stavis
3fb8b3484b cli: fix #161 by inverting test argument order
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
2015-11-08 11:13:32 -02:00
Derek Stavis
00189cc6bf Fix more wrong basename usage cases 2015-11-04 19:01:08 -02:00
Derek Stavis
bc5e434b76 packages.list: Use basename -a with multiple paths 2015-11-04 09:33:53 -02:00
Derek Stavis
a1db5d5240 omf.repo.pull: Don't repeat yourself treatment 2015-10-25 00:21:09 -02:00
Derek Stavis
8db6b24966 omf.repo.pull: Simplify stashed flag using set -q 2015-10-18 23:49:10 -02:00
Derek Stavis
bdfc248452 omf/templates: Remove Travis from scaffolding 2015-10-17 21:55:28 -03:00
Derek Stavis
d224e01570 omf.bundle.install: Fix #123 by rewriting the code
Rewrites the code, as now `omf.install` is type
agnostic, and any -- preceded parameter will
be interpreted as package name.
2015-10-15 23:51:38 -03:00
Derek Stavis
c4bd4ade55 omf: Refresh after bundle install 2015-10-15 23:51:38 -03:00
Pablo Santiago Blum de Aguiar
2ac04c7e5e omf.packages.list: list no “builtin” packages 2015-10-14 01:40:45 -03:00
Derek Stavis
ccd704bca0 omf.theme: Validate if theme is installed 2015-10-14 01:40:45 -03:00
Derek Stavis
7ccdada8c6 omf install: Don't refresh when nothing installed 2015-10-14 01:40:45 -03:00
Bruno Pinto
e234aab3c6 Remove .git$ from name when installing from URL
Support `omf install https://github.com/oh-my-fish/plugin-jump.git`
2015-10-14 01:40:45 -03:00
Bruno Pinto
cc7b321268 Create omf.update function
Update and install were one thing before.
2015-10-14 01:40:45 -03:00
Bruno Pinto
c346731743 Simplify install command
- Install does not do update.
- Share code when installing from URL or name.
2015-10-14 01:40:44 -03:00
Derek Stavis
67c07cb6f6 Fixes a regression in update process added in #115
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.
2015-10-13 10:30:06 -03:00
Bruno Pinto
870efd0dda Merge all omf list functions 2015-10-12 21:05:23 +01:00
Bruno Pinto
7025525ef1 Simplify omf cd code
This also namespace the function to `omf.packages`.
2015-10-12 18:25:12 +01:00
nwykes
ffa6338664 update some cli completions: remove query and version. add doctor 2015-10-08 13:28:50 -06:00
Derek Stavis
ea0b464f1d omf.theme: Rework theme activation code
- 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
2015-10-07 00:50:14 -03:00
Derek Stavis
a99e3ce86a omf.install: Fix success/error return codes
Return 0 when package installs, != 0 on error
2015-10-06 18:00:10 -03:00
Derek Stavis
291d0c9784 bundle.add: fix theme being persisted twice
`omf theme` was persisting the installed theme twice, one time on
`omf.install` and other time on `omf.bundle.add`.
2015-10-06 17:05:16 -03:00
Derek Stavis
05f3be01be destroy: Revert fish_prompt backup when found
Works toward generalizing the backup restoration logic using a
function, then restoring both config.fish and fish_prompt.
2015-10-05 14:11:59 -03:00
Bruno Pinto
653f173971 Forgot to suppress error message 2015-10-04 13:49:58 +01:00
Bruno Pinto
1ab8a20b8c Fix #8: Fishy plugin template 2015-10-03 22:18:52 +01:00
Bruno Pinto
520d597947 Source uninstall.fish file before emitting event
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.
2015-10-03 22:11:49 +01:00
Bruno Pinto
bc0d4847e8 Resolve #30: omf doctor command
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.
2015-10-03 21:04:30 +01:00
Bruno Pinto
cf8a24deed Only emit uninstall_* event on omf destroy
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"`.
2015-10-03 01:10:23 +01:00
Bruno Pinto
46e4d036ba Organize commands and remove undocumented aliases 2015-10-03 01:07:40 +01:00
Bruno Pinto
319c8a05cd Don't overwrite function on test environment
Instead of overwriting functions that use `exec fish` on test
environment, skip this call if the variable `CI` has been defined on the
running shell.
2015-10-02 23:50:18 +01:00
Bruno Pinto
e2a7f7d229 Split into init.fish and omf.fish files 2015-10-02 21:35:06 +01:00
Bruno Pinto
9cc8ee5a82 Stash does not support --git-dir
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.
2015-10-02 21:16:50 +01:00
jeremiejig
56b1d837e0 changing to git -C to git --git-dir work-tree 2015-09-27 18:53:51 +02:00
jeremiejig
5cdde2639a bin/install & omf.repo.pull adding -C $git_dir removing pushd and popd 2015-09-27 18:53:51 +02:00
jeremiejig
773f1010b9 omf.destroy: find the most recent backup of config.
using XDG_CONFIG_HOME
2015-09-26 22:32:10 +02:00
jeremiejig
b9c1bd9576 Fixing how omf remove work, and omf.remove_package
destroy was broken because of a premature refresh. (giving false hang
behaviour)
2015-09-26 22:32:10 +02:00
jeremiejig
8d1b4dc897 Using raw name_or_url instead of name. 2015-09-13 23:22:12 +02:00
Derek Stavis
de9955e025 omf.bundle.install: sort the bundle after install 2015-09-13 18:13:22 -03:00
Derek Stavis
d3ace4fd81 omf.bundle.install: replace uniq by sort -u 2015-09-13 18:13:22 -03:00
Derek Stavis
56bc40bde9 omf.bundle.remove: return 0 when done 2015-09-13 18:13:22 -03:00
Derek Stavis
b20f8dd141 omf.bundle.remove: replace uniq by sort -u 2015-09-13 18:13:22 -03:00
Derek Stavis
00e3d3e058 omf.bundle.add: sort the bundle after adding entry 2015-09-13 18:13:21 -03:00
Derek Stavis
a71bc714f4 completions: use standard fish functions for subcommands 2015-09-09 21:03:05 -03:00
Derek Stavis
c929fa41ab bundle: move related functions to omf.bundle namespace 2015-09-08 11:03:14 -03:00