oh-my-fish/pkg/omf/cli/omf.check.fish_prompt.fish
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

11 lines
384 B
Fish

function omf.check.fish_prompt
set -l prompt_file "fish_prompt.fish"
set -l theme (cat $OMF_CONFIG/theme)
set -l user_functions_path (omf.xdg.config_home)/fish/functions
set -l fish_prompt (readlink "$user_functions_path/$prompt_file" ^/dev/null)
not test -e "$fish_prompt"; and return 0
contains -- "$fish_prompt" {$OMF_CONFIG,$OMF_PATH}/themes/$theme/$prompt_file
end