Switch to scuba

This commit is contained in:
Ilan Cosman 2020-10-12 15:05:51 -07:00
parent 9bfcbec6f3
commit 3858228776
60 changed files with 64 additions and 150 deletions

View File

@ -22,10 +22,11 @@ jobs:
- uses: fish-actions/install-fish@v1
- name: Install Tide unattended
run: |
source $GITHUB_WORKSPACE/tools/tide_install.fish
tide_install --local --unattended $GITHUB_WORKSPACE
- name: Install Scuba
run: curl -sL git.io/scuba-install | source && _scuba_sub_install ilancosman/scuba
- name: Install Tide
run: scuba install $GITHUB_WORKSPACE
- name: Install testing dependencies
run: tide test --install

View File

@ -30,7 +30,6 @@ Anything exposed to the shell or user--functions, global/universal variables, an
- `set -U tide_right_prompt_items`
- `_tide_count_left_prompt_height.fish`
- `_tide_right_prompt`
- `tide_install`
#### Specific Naming Conventions
@ -41,7 +40,7 @@ Anything exposed to the shell or user--functions, global/universal variables, an
### Dependencies
- [fisher][] - plugin manager for fish
- [scuba][] - plugin manager for fish
- [spout][] - 100% pure-fish TAP-based test runner
- [clownfish][] - override the behavior of commands
@ -93,10 +92,10 @@ Todo on release:
[`fish_indent`]: https://fishshell.com/docs/current/cmds/fish_indent.html
[clownfish]: https://github.com/IlanCosman/clownfish
[code of conduct]: CODE_OF_CONDUCT.md
[fisher]: https://github.com/jorgebucaran/fisher
[markdownlint]: https://github.com/DavidAnson/markdownlint
[prettier]: https://github.com/prettier/prettier
[reference style]: https://www.markdownguide.org/basic-syntax/#reference-style-links
[scuba]: https://github.com/IlanCosman/scuba
[spout]: https://github.com/IlanCosman/spout
[super-linter]: https://github.com/github/super-linter
[yamllint]: https://github.com/adrienverge/yamllint

View File

@ -36,10 +36,10 @@
- [Fish][] ≥ 3.1
- A [Nerd Font][nerd fonts] installed and enabled in your terminal (for example the [recommended font](#fonts)).
#### Source and run the install function
#### Install with [Scuba][]
```console
curl -sL git.io/tide | source && tide_install
scuba install IlanCosman/tide
```
## Features
@ -159,5 +159,6 @@ Open each file and click "Install". This will make the `MesloLGS NF` font availa
[nerd fonts]: https://github.com/ryanoasis/nerd-fonts
[powerlevel10k]: https://github.com/romkatv/powerlevel10k/
[pure]: https://github.com/rafaelrinaldi/pure
[scuba]: https://github.com/IlanCosman/scuba
[spacefish]: https://github.com/matchai/spacefish
[starship]: https://github.com/starship/starship

View File

@ -1,7 +1,53 @@
_tide_count_left_prompt_height
if set -q _tide_version
_tide_count_left_prompt_height
_tide_detect_os
_tide_detect_os
_tide_git_prompt_set_vars
_tide_git_prompt_set_vars
_tide_pwd
_tide_pwd
end
function _tide_init_install --on-event _tide_init_install
_set_immutable _tide_color_dark_blue 0087AF
_set_immutable _tide_color_dark_green 5FAF00
_set_immutable _tide_color_gold D7AF00
_set_immutable _tide_color_green 5FD700
_set_immutable _tide_color_light_blue 00AFFF
_set_immutable _tide_color_normal (set_color normal)
_set_immutable _tide_dir "$__fish_config_dir/functions/tide"
_set_immutable _tide_version 2.4.0
_set_immutable NVM_DIR $HOME/.nvm
_set_immutable VIRTUAL_ENV_DISABLE_PROMPT true
set -U _tide_var_list
source "$_tide_dir/configure/choices/all/style.fish"
_load_config 'lean'
source "$_tide_dir/configure/choices/all/finish.fish"
_tide_finish
source "$__fish_config_dir/functions/fish_prompt.fish"
if status is-interactive
while true
switch (read --prompt-str="Configure tide prompt? [Y/n] ")
case y Y yes Yes ''
tide configure
case n N no No
printf '%s' \
\n 'Run ' (set_color $fish_color_command) 'tide ' \
(set_color $fish_color_param) 'configure ' (set_color normal) 'to customize your prompt.' \n
end
break
end
end
end
function _set_immutable -a var_name
set -U $var_name $argv[2..-1]
set -Ua _tide_var_immutable_list $var_name
end

View File

@ -12,7 +12,7 @@ The following sections contain tables of variable names, their descriptions, and
Variables in these sections will be denoted as `foo_bar` but will actually be `tide_<INSERT HEADER>_foo_bar`. Variables that do not conform to this standard will be written out in full.
You can take a look at the default configurations in `~/.config/fish/tide_theme/configure/configs` for inspiration.
You can take a look at the default configurations in `~/.config/fish/functions/tide/configure/configs` for inspiration.
You can modify variables using `set --universal` from the command line or `set --global` in your `config.fish` file.

View File

@ -5,9 +5,8 @@ function _tide_sub_test
_tide_test_help
return 0
else if set -q _flag_install
# Install fisher and spout for testing
curl git.io/fisher --create-dirs -sLo $__fish_config_dir/functions/fisher.fish
fisher add IlanCosman/spout IlanCosman/clownfish
# Install scuba, spout, and clownfish for testing
curl -sL git.io/scuba-install | source && _scuba_sub_install ilancosman/scuba IlanCosman/spout IlanCosman/clownfish
return 0
end
@ -84,7 +83,7 @@ function _tide_test_help
'display test output even if passed' \
'run all available tests' \
'print this help message' \
'install fisher and spout test dependencies' \
'install testing dependencies' \
'run tests designed for CI'
printf '%s\n' 'Usage: '$bl'tide test '$n'[options] '$b'[TESTS...]'$n

View File

@ -1,102 +0,0 @@
function _tide_actual_install
argparse 'l/local' 'u/unattended' -- $argv
set -l location $argv[1]
if test -z "$location"
set location 'main'
end
set -gx TERM xterm # Necessary for testing purposes, ensures color codes are printed
printf '%s\n' 'Installing tide theme...'
# -----------------Download Files-----------------
set -lx tempDir '/tmp/tide_theme'
if test -e $tempDir
rm -rf $tempDir
end
# Copy/clone repository into $tempDir
if set -q _flag_local
cp -rf "$location" "$tempDir"
else
git clone --quiet --depth 1 --branch $location https://github.com/IlanCosman/tide.git $tempDir
end
for dir in completions conf.d functions tide_theme
cp -r "$tempDir/$dir" $__fish_config_dir
end
# --------------------Set Defaults--------------------
_set_immutables
set -U _tide_var_list
source "$_tide_dir/configure/choices/all/style.fish"
_load_config 'lean'
source "$_tide_dir/configure/choices/all/finish.fish"
_tide_finish
# -----------------------Finish-----------------------
for file in $_tide_file_list
source "$__fish_config_dir/$file"
end
source "$__fish_config_dir/functions/fish_prompt.fish"
set_color $_tide_color_green
printf '%s\n' 'Tide theme installed!'
set_color normal
printf '%s\n'
if not set -q _flag_unattended
if _user_confirm_defaultYes 'Configure tide prompt?'
tide configure
else
printf '%s\n'
printf '%s\n' 'Run tide configure to customize your prompt.'
end
end
rm -rf $tempDir
end
function _set_immutables
set -U _tide_var_immutable_list
_set_immutable _tide_color_dark_blue 0087AF
_set_immutable _tide_color_dark_green 5FAF00
_set_immutable _tide_color_gold D7AF00
_set_immutable _tide_color_green 5FD700
_set_immutable _tide_color_light_blue 00AFFF
_set_immutable _tide_color_normal (set_color normal)
_set_immutable _tide_dir "$__fish_config_dir/tide_theme"
_set_immutable _tide_file_list (string replace "$tempDir/" '' $tempDir/{completions/*, conf.d/*, functions/*})
_set_immutable _tide_version 2.4.0
_set_immutable NVM_DIR $HOME/.nvm
_set_immutable VIRTUAL_ENV_DISABLE_PROMPT true
end
function _set_immutable -a var_name
set -U $var_name $argv[2..-1]
set -a _tide_var_immutable_list $var_name
end
function _user_confirm_defaultYes -a question
while true
read -P "$question [Y/n] " input
switch $input
case y Y yes Yes
return 0
case n N no No
return 1
case ''
return 0
end
end
end

View File

@ -1,30 +0,0 @@
function tide_install
if not command -q git
printf '%s\n' 'Git must be available to install Tide.'
return 1
end
set -l options l/local u/unattended
argparse $options -- $argv
# Pass through options to _tide_actual_install
for option in $options
set -l longFormOption (string split '/' $option)[2]
if set -q _flag_$longFormOption
set -a flags "--$longFormOption"
end
end
set -l location $argv[-1]
if test -z "$location"
set location 'main'
end
if set -q _flag_local
source "$location/tools/_tide_actual_install.fish"
else
curl --silent "https://raw.githubusercontent.com/IlanCosman/tide/$location/tools/_tide_actual_install.fish" | source
end
_tide_actual_install $flags $argv
end