From 3e759e717c1b8f6806bc3c07304f4965a4e1e18b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C4=81rti=C5=86=C5=A1=20Jakubovi=C4=8Ds?= Date: Fri, 2 Feb 2024 20:04:10 +0200 Subject: [PATCH 1/2] feat: aws-vault prompt item --- functions/_tide_item_aws_vault.fish | 5 +++++ functions/tide/configure/configs/classic.fish | 2 ++ .../configure/configs/classic_16color.fish | 2 ++ functions/tide/configure/configs/lean.fish | 2 ++ .../tide/configure/configs/lean_16color.fish | 2 ++ functions/tide/configure/configs/rainbow.fish | 2 ++ .../configure/configs/rainbow_16color.fish | 2 ++ functions/tide/configure/icons.fish | 1 + tests/_tide_item_aws_vault.test.fish | 18 ++++++++++++++++++ 9 files changed, 36 insertions(+) create mode 100644 functions/_tide_item_aws_vault.fish create mode 100644 tests/_tide_item_aws_vault.test.fish diff --git a/functions/_tide_item_aws_vault.fish b/functions/_tide_item_aws_vault.fish new file mode 100644 index 00000000..901b9a17 --- /dev/null +++ b/functions/_tide_item_aws_vault.fish @@ -0,0 +1,5 @@ +function _tide_item_aws_vault + if test -n "$AWS_VAULT" + _tide_print_item aws_vault $tide_aws_vault_icon' ' "$AWS_VAULT" + end +end diff --git a/functions/tide/configure/configs/classic.fish b/functions/tide/configure/configs/classic.fish index 8973cbc2..56b4fd08 100644 --- a/functions/tide/configure/configs/classic.fish +++ b/functions/tide/configure/configs/classic.fish @@ -1,5 +1,7 @@ tide_aws_bg_color 444444 tide_aws_color FF9900 +tide_aws_vault_bg_color FF3333 +tide_aws_vault_color 1A0000 tide_character_color $_tide_color_green tide_character_color_failure FF0000 tide_cmd_duration_bg_color 444444 diff --git a/functions/tide/configure/configs/classic_16color.fish b/functions/tide/configure/configs/classic_16color.fish index 670170f5..60fbbcc5 100644 --- a/functions/tide/configure/configs/classic_16color.fish +++ b/functions/tide/configure/configs/classic_16color.fish @@ -1,5 +1,7 @@ tide_aws_bg_color black tide_aws_color yellow +tide_aws_vault_bg_color black +tide_aws_vault_color brred tide_character_color brgreen tide_character_color_failure brred tide_cmd_duration_bg_color black diff --git a/functions/tide/configure/configs/lean.fish b/functions/tide/configure/configs/lean.fish index a958a175..68737a57 100644 --- a/functions/tide/configure/configs/lean.fish +++ b/functions/tide/configure/configs/lean.fish @@ -1,5 +1,7 @@ tide_aws_bg_color normal tide_aws_color FF9900 +tide_aws_vault_bg_color normal +tide_aws_vault_color FF3333 tide_character_color $_tide_color_green tide_character_color_failure FF0000 tide_cmd_duration_bg_color normal diff --git a/functions/tide/configure/configs/lean_16color.fish b/functions/tide/configure/configs/lean_16color.fish index 16c2511d..c78c0dde 100644 --- a/functions/tide/configure/configs/lean_16color.fish +++ b/functions/tide/configure/configs/lean_16color.fish @@ -1,5 +1,7 @@ tide_aws_bg_color normal tide_aws_color yellow +tide_aws_vault_bg_color normal +tide_aws_vault_color brred tide_character_color brgreen tide_character_color_failure brred tide_cmd_duration_bg_color normal diff --git a/functions/tide/configure/configs/rainbow.fish b/functions/tide/configure/configs/rainbow.fish index 60c15925..86b075d4 100644 --- a/functions/tide/configure/configs/rainbow.fish +++ b/functions/tide/configure/configs/rainbow.fish @@ -1,5 +1,7 @@ tide_aws_bg_color FF9900 tide_aws_color 232F3E +tide_aws_vault_bg_color FF3333 +tide_aws_vault_color 1A0000 tide_character_color $_tide_color_green tide_character_color_failure FF0000 tide_cmd_duration_bg_color C4A000 diff --git a/functions/tide/configure/configs/rainbow_16color.fish b/functions/tide/configure/configs/rainbow_16color.fish index a040f584..63f73f13 100644 --- a/functions/tide/configure/configs/rainbow_16color.fish +++ b/functions/tide/configure/configs/rainbow_16color.fish @@ -1,5 +1,7 @@ tide_aws_bg_color yellow tide_aws_color brblack +tide_aws_vault_bg_color brred +tide_aws_vault_color black tide_character_color brgreen tide_character_color_failure brred tide_cmd_duration_bg_color yellow diff --git a/functions/tide/configure/icons.fish b/functions/tide/configure/icons.fish index 70611cdf..68908526 100644 --- a/functions/tide/configure/icons.fish +++ b/functions/tide/configure/icons.fish @@ -1,4 +1,5 @@ tide_aws_icon  # Actual aws glyph is harder to see +tide_aws_vault_icon  tide_character_icon ❯ tide_character_vi_icon_default ❮ tide_character_vi_icon_replace ▶ diff --git a/tests/_tide_item_aws_vault.test.fish b/tests/_tide_item_aws_vault.test.fish new file mode 100644 index 00000000..88b9c7cd --- /dev/null +++ b/tests/_tide_item_aws_vault.test.fish @@ -0,0 +1,18 @@ +# RUN: %fish %s +_tide_parent_dirs + +function _aws_vault + _tide_decolor (_tide_item_aws_vault) +end + +set -lx tide_aws_vault_icon  + +_aws_vault # CHECK: + +set -lx AWS_VAULT TestAcc1 + +_aws_vault # CHECK:  TestAcc1 + +set -lx AWS_VAULT TestAcc2 + +_aws_vault # CHECK:  TestAcc2 From 97565d63f0551b6815607f6d3d8a5397f3c8468b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C4=81rti=C5=86=C5=A1=20Jakubovi=C4=8Ds?= Date: Fri, 2 Feb 2024 20:18:59 +0200 Subject: [PATCH 2/2] fix: format --- functions/_tide_item_aws_vault.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/_tide_item_aws_vault.fish b/functions/_tide_item_aws_vault.fish index 901b9a17..31d757fe 100644 --- a/functions/_tide_item_aws_vault.fish +++ b/functions/_tide_item_aws_vault.fish @@ -1,5 +1,5 @@ function _tide_item_aws_vault if test -n "$AWS_VAULT" - _tide_print_item aws_vault $tide_aws_vault_icon' ' "$AWS_VAULT" + _tide_print_item aws_vault $tide_aws_vault_icon' ' "$AWS_VAULT" end end