From b21a66462f714874c37493b35467e82f3b53fb12 Mon Sep 17 00:00:00 2001 From: T31M Date: Sat, 10 Oct 2020 10:10:52 +0200 Subject: [PATCH 1/3] chore: cleanup + bugfixes --- fish/config.fish | 10 ++-------- fish/theme-t31m/envAWS.fish | 10 +++++----- fish/theme-t31m/ssm_tunnel.fish | 5 ----- fish/theme-t31m/t31m_prompt_right.fish | 4 ++-- fish_setup.sh | 2 +- main.sh | 5 ----- 6 files changed, 10 insertions(+), 26 deletions(-) diff --git a/fish/config.fish b/fish/config.fish index 964ac89..58983da 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -1,11 +1,5 @@ -# deno config -set -Ux DENO_INSTALL /home/t31m/.deno -set -Ux PATH $DENO_INSTALL/bin $PATH - -# pipx -if test (command -v pipx) - register-python-argcomplete --shell fish pipx | . -end +set -Ux PYENV_ROOT $HOME/.pyenv +set -Ux fish_user_paths $PYENV_ROOT/bin $fish_user_paths # pyenv init if command -v pyenv 1>/dev/null 2>&1 diff --git a/fish/theme-t31m/envAWS.fish b/fish/theme-t31m/envAWS.fish index 9666c78..d555a69 100644 --- a/fish/theme-t31m/envAWS.fish +++ b/fish/theme-t31m/envAWS.fish @@ -1,4 +1,4 @@ -# TWAICE AWS Credential Management for FiSH +# AWS Credential Management for FiSH # TODO change your user set AWS_IAM_USER "" @@ -24,19 +24,19 @@ function envAWS --description 'switch to different aws account environments (-) switch $argv[1] case dev echo "switching to /refreshing dev" - aws-mfa --assume-role arn:aws:iam::$DEV_ACCOUNT_ID:role/Administrators --duration 43200 --role-session-name $AWS_IAM_USER + aws-mfa --assume-role arn:aws:iam::$DEV_ACCOUNT_ID:role/Administrator --duration 43200 --role-session-name $AWS_IAM_USER getAWSenv case stg echo "switching to /refreshing staging" - aws-mfa --assume-role arn:aws:iam::$STG_ACCOUNT_ID:role/Administrators --duration 43200 --role-session-name $AWS_IAM_USER + aws-mfa --assume-role arn:aws:iam::$STG_ACCOUNT_ID:role/Administrator --duration 43200 --role-session-name $AWS_IAM_USER getAWSenv case prod echo "switching to /refreshing prod" - aws-mfa --assume-role arn:aws:iam::$PROD_ACCOUNT_ID:role/Administrators --duration 3600 --role-session-name $AWS_IAM_USER + aws-mfa --assume-role arn:aws:iam::$PROD_ACCOUNT_ID:role/Administrator --duration 3600 --role-session-name $AWS_IAM_USER getAWSenv case ops echo "switching to /refreshing ops" - aws-mfa --assume-role arn:aws:iam::$OPS_ACCOUNT_ID:role/Administrators --duration 3600 --role-session-name $AWS_IAM_USER + aws-mfa --assume-role arn:aws:iam::$OPS_ACCOUNT_ID:role/Administrator --duration 3600 --role-session-name $AWS_IAM_USER getAWSenv case '*' echo "Wrong / Invalid Environment provided" diff --git a/fish/theme-t31m/ssm_tunnel.fish b/fish/theme-t31m/ssm_tunnel.fish index 6327493..09fc7a9 100644 --- a/fish/theme-t31m/ssm_tunnel.fish +++ b/fish/theme-t31m/ssm_tunnel.fish @@ -5,11 +5,6 @@ function ssm_tunnel --description 'access private AWS ressources via Bastion Hos return end - #if [ "$AWS_PROFILE" != "twaice-ops"* ] - # echo "Switch to OPS ENV first" - # return - #end - # Get bastion host ID using it's name set INSTANCE_ID (aws ec2 describe-instances \ --filter 'Name=tag:Name,Values=ops-infrastructure-bastion'\ diff --git a/fish/theme-t31m/t31m_prompt_right.fish b/fish/theme-t31m/t31m_prompt_right.fish index 144d77c..6cde8ba 100644 --- a/fish/theme-t31m/t31m_prompt_right.fish +++ b/fish/theme-t31m/t31m_prompt_right.fish @@ -13,9 +13,9 @@ function t31m_prompt_right end end - printf '%s' \U231A + printf '%s' \U231A printf (yellow)"("(off)(date +%H(yellow):(off)%M(yellow):(off)%S)(yellow)")"(off) printf '%s' \U1F4C1 - printf (yellow)"("(off)$cwd(yellow)")"(off) + printf (yellow)"("(off)$cwd(yellow)")"(off) end diff --git a/fish_setup.sh b/fish_setup.sh index aedea08..1a74f5a 100755 --- a/fish_setup.sh +++ b/fish_setup.sh @@ -3,7 +3,7 @@ set -x # install nvm -curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash # install pyenv git clone https://github.com/pyenv/pyenv.git ~/.pyenv diff --git a/main.sh b/main.sh index 1d5998e..fc26221 100755 --- a/main.sh +++ b/main.sh @@ -21,9 +21,4 @@ chmod +x /usr/local/bin/docker-compose usermod -aG docker t31m -curl -sL -o ~/usr/local/bin/conky-x86_64.AppImage \ - $(curl -sL https://api.github.com/repos/brndnmtthws/conky/releases/latest | \ - jq --raw-output '.assets[0] | .browser_download_url') -chmod +x /usr/local/bin/conky-x86_64.AppImage - echo "Initial Setup Complete. Please run fish_setup.sh for env setup" From 1a74e28be78ea61214ec5e2306b534977093f040 Mon Sep 17 00:00:00 2001 From: T31M Date: Sun, 31 Jan 2021 17:39:14 +0100 Subject: [PATCH 2/3] Adapted to Fisher 4.x plugin style --- fish/theme-t31m/{ => functions}/cdk.fish | 0 fish/theme-t31m/{ => functions}/envAWS.fish | 0 .../theme-t31m/{ => functions}/fish_greeting.fish | 0 fish/theme-t31m/{ => functions}/fish_prompt.fish | 0 .../{ => functions}/fish_right_prompt.fish | 0 fish/theme-t31m/{ => functions}/fish_title.fish | 0 fish/theme-t31m/{ => functions}/ssm_tunnel.fish | 0 fish/theme-t31m/{ => functions}/t31m_prompt.fish | 0 .../{ => functions}/t31m_prompt_right.fish | 0 fish_setup.sh | 15 ++++++++------- 10 files changed, 8 insertions(+), 7 deletions(-) rename fish/theme-t31m/{ => functions}/cdk.fish (100%) rename fish/theme-t31m/{ => functions}/envAWS.fish (100%) rename fish/theme-t31m/{ => functions}/fish_greeting.fish (100%) rename fish/theme-t31m/{ => functions}/fish_prompt.fish (100%) rename fish/theme-t31m/{ => functions}/fish_right_prompt.fish (100%) rename fish/theme-t31m/{ => functions}/fish_title.fish (100%) rename fish/theme-t31m/{ => functions}/ssm_tunnel.fish (100%) rename fish/theme-t31m/{ => functions}/t31m_prompt.fish (100%) rename fish/theme-t31m/{ => functions}/t31m_prompt_right.fish (100%) diff --git a/fish/theme-t31m/cdk.fish b/fish/theme-t31m/functions/cdk.fish similarity index 100% rename from fish/theme-t31m/cdk.fish rename to fish/theme-t31m/functions/cdk.fish diff --git a/fish/theme-t31m/envAWS.fish b/fish/theme-t31m/functions/envAWS.fish similarity index 100% rename from fish/theme-t31m/envAWS.fish rename to fish/theme-t31m/functions/envAWS.fish diff --git a/fish/theme-t31m/fish_greeting.fish b/fish/theme-t31m/functions/fish_greeting.fish similarity index 100% rename from fish/theme-t31m/fish_greeting.fish rename to fish/theme-t31m/functions/fish_greeting.fish diff --git a/fish/theme-t31m/fish_prompt.fish b/fish/theme-t31m/functions/fish_prompt.fish similarity index 100% rename from fish/theme-t31m/fish_prompt.fish rename to fish/theme-t31m/functions/fish_prompt.fish diff --git a/fish/theme-t31m/fish_right_prompt.fish b/fish/theme-t31m/functions/fish_right_prompt.fish similarity index 100% rename from fish/theme-t31m/fish_right_prompt.fish rename to fish/theme-t31m/functions/fish_right_prompt.fish diff --git a/fish/theme-t31m/fish_title.fish b/fish/theme-t31m/functions/fish_title.fish similarity index 100% rename from fish/theme-t31m/fish_title.fish rename to fish/theme-t31m/functions/fish_title.fish diff --git a/fish/theme-t31m/ssm_tunnel.fish b/fish/theme-t31m/functions/ssm_tunnel.fish similarity index 100% rename from fish/theme-t31m/ssm_tunnel.fish rename to fish/theme-t31m/functions/ssm_tunnel.fish diff --git a/fish/theme-t31m/t31m_prompt.fish b/fish/theme-t31m/functions/t31m_prompt.fish similarity index 100% rename from fish/theme-t31m/t31m_prompt.fish rename to fish/theme-t31m/functions/t31m_prompt.fish diff --git a/fish/theme-t31m/t31m_prompt_right.fish b/fish/theme-t31m/functions/t31m_prompt_right.fish similarity index 100% rename from fish/theme-t31m/t31m_prompt_right.fish rename to fish/theme-t31m/functions/t31m_prompt_right.fish diff --git a/fish_setup.sh b/fish_setup.sh index 1a74f5a..e73564a 100755 --- a/fish_setup.sh +++ b/fish_setup.sh @@ -3,7 +3,7 @@ set -x # install nvm -curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash # install pyenv git clone https://github.com/pyenv/pyenv.git ~/.pyenv @@ -16,14 +16,15 @@ git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf bash ~/.fzf/install --no-update-rc --completion --key-bindings # install fisher -curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish +#curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish +curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher $plugins # copy fish config -if test -f "~/.config/fish/config.fish"; then +if test -f "~/.config/fish/functions/config.fish"; then echo "config.fish already exist, please rename to continue." exit 1 fi -cp fish/config.fish ~/.config/fish/ +cp fish/config.fish ~/.config/fish/functions/ # copy fishfile if test -f "~/.config/fish/fishfile"; then @@ -35,9 +36,9 @@ cp fish/fishfile ~/.config/fish/ echo "set --export PYENV_ROOT $HOME/.pyenv" > ~/.config/fish/conf.d/pyenv.fish # install packages from fishfile -fish -c "fisher self-update" -fish -c fisher -fish -c "fisher add (pwd)/fish/theme-t31m" +fish -c "fisher install jorgebucaran/fisher" +fish -c "fisher update" +fish -c "fisher install (pwd)/fish/theme-t31m" # set fish default shell echo "Change your default Shell to FiSH: chsh -s /usr/bin/fish" From 3ccb7cb3b1a7b13a1d817840bc538073dcd5693e Mon Sep 17 00:00:00 2001 From: T31M Date: Mon, 1 Feb 2021 19:01:58 +0100 Subject: [PATCH 3/3] Adapted to Fisher 4.x plugin style --- fish/{fishfile => fish_plugins} | 3 ++- fish_setup.sh | 15 ++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) rename fish/{fishfile => fish_plugins} (69%) diff --git a/fish/fishfile b/fish/fish_plugins similarity index 69% rename from fish/fishfile rename to fish/fish_plugins index 29bc98e..6086f9e 100644 --- a/fish/fishfile +++ b/fish/fish_plugins @@ -1,3 +1,4 @@ -FabioAntunes/fish-nvm +jorgebucaran/fisher edc/bass jethrokuan/fzf +FabioAntunes/fish-nvm diff --git a/fish_setup.sh b/fish_setup.sh index e73564a..f12f506 100755 --- a/fish_setup.sh +++ b/fish_setup.sh @@ -3,20 +3,16 @@ set -x # install nvm -curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash # install pyenv git clone https://github.com/pyenv/pyenv.git ~/.pyenv -# install pyenv-virtualenv plugin -git clone https://github.com/pyenv/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv - # install fzf from source git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf bash ~/.fzf/install --no-update-rc --completion --key-bindings # install fisher -#curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher $plugins # copy fish config @@ -27,18 +23,19 @@ fi cp fish/config.fish ~/.config/fish/functions/ # copy fishfile -if test -f "~/.config/fish/fishfile"; then - echo "fishfile already exist, please rename to continue." +if test -f "~/.config/fish/fish_plugins"; then + echo "fish_plugins already exist, please rename to continue." exit 1 fi -cp fish/fishfile ~/.config/fish/ +cp fish/fish_plugins ~/.config/fish/ echo "set --export PYENV_ROOT $HOME/.pyenv" > ~/.config/fish/conf.d/pyenv.fish # install packages from fishfile fish -c "fisher install jorgebucaran/fisher" -fish -c "fisher update" fish -c "fisher install (pwd)/fish/theme-t31m" +fish -c "fisher install FabioAntunes/fish-nvm" +fish -c "fisher update" # set fish default shell echo "Change your default Shell to FiSH: chsh -s /usr/bin/fish"