_tide_init.fish 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. function _tide_init_install --on-event _tide_init_install
  2. set -U tide_os_icon (_tide_detect_os)
  3. set -U VIRTUAL_ENV_DISABLE_PROMPT true
  4. set -U _tide_var_list tide_os_icon VIRTUAL_ENV_DISABLE_PROMPT
  5. source (functions --details _tide_sub_configure)
  6. _load_config lean
  7. _tide_finish
  8. set -a _tide_var_list (set --names | string match --regex "^tide.*")
  9. status is-interactive && switch (read --prompt-str="Configure tide prompt? [Y/n] " | string lower)
  10. case y ye yes ''
  11. tide configure
  12. case '*'
  13. printf '%s' \n 'Run ' (printf '%s' "tide configure" | fish_indent --ansi) ' to customize your prompt.' \n
  14. end
  15. end
  16. function _tide_init_update --on-event _tide_init_update
  17. # v5 introduced tide_prompt_min_cols. Only proceed if older than v5
  18. set --query tide_prompt_min_cols && return
  19. # Save old vars to tmp file
  20. set -l tmp (mktemp -t tide_old_config.XXXXX)
  21. tide bug-report --verbose >$tmp
  22. # Delete old vars
  23. set -e $_tide_var_list _tide_var_list $_tide_prompt_var
  24. # Print a warning
  25. set_color yellow
  26. echo "You have upgraded to version 5 of Tide."
  27. echo "Since there are breaking changes, your old configuraton has been saved in:"
  28. set_color normal
  29. echo $tmp
  30. sleep 5
  31. _tide_init_install
  32. end
  33. function _tide_init_uninstall --on-event _tide_init_uninstall
  34. set -e $_tide_var_list _tide_var_list $_tide_prompt_var
  35. functions --erase (functions --all | string match --entire --regex '^_tide_')
  36. end