Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added pulumi support to show the stack name * update symbol with a minor p * changed color to 133 to make Pulumis color * use pulumi commnad to fetch the active stack * refactor(pulumi): Update to v4 * docs(pulumi): Add docs for pulumi Co-authored-by: Chin <chin.tong@slalom.com> Co-authored-by: Denys Dovhan <denysdovhan@gmail.com>
- Loading branch information
1 parent
f4d85de
commit 1ab9162
Showing
6 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Pulumi (`pulumi`) | ||
|
||
!!! important "This section is rendered asynchronously by default" | ||
|
||
!!! info | ||
[**Terraform**](https://www.pulumi.com/) is an infrastructure-as-code platform for full-stack developers. | ||
|
||
The `pulumi` section shows Pulumi stack. | ||
|
||
This section is only displayed when you have a `pulumi` command available and: | ||
|
||
* Upsearch finds a `Pulumi.yaml` or `Pulumi.yml` file | ||
* Upsearch finds a `.pulumi/stacks` file | ||
|
||
## Options | ||
|
||
| Variable | Default | Meaning | | ||
| :------------------------ | :--------------------------------: | ----------------------------------- | | ||
| `SPACESHIP_PULUMI_SHOW` | `true` | Show section | | ||
| `SPACESHIP_PULUMI_ASYNC` | `true` | Render section asynchronously | | ||
| `SPACESHIP_PULUMI_PREFIX` | `$SPACESHIP_PROMPT_DEFAULT_PREFIX` | Section's prefix | | ||
| `SPACESHIP_PULUMI_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Section's suffix | | ||
| `SPACESHIP_PULUMI_SYMBOL` | `🛠️·` | Symbol displayed before the section | | ||
| `SPACESHIP_PULUMI_COLOR` | `133` | Section's color | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# | ||
# Pulumi | ||
# | ||
# Pulumi automates the repetitive tasks of setting up cloud resources | ||
# Link: https://www.pulumi.com/ | ||
# | ||
# This section shows you the current stack and number of resources | ||
# Link: https://www.pulumi.com/docs/intro/concepts/stack/ | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Configuration | ||
# ------------------------------------------------------------------------------ | ||
|
||
SPACESHIP_PULUMI_SHOW="${SPACESHIP_PULUMI_SHOW=true}" | ||
SPACESHIP_PULUMI_ASYNC="${SPACESHIP_PULUMI_ASYNC=true}" | ||
SPACESHIP_PULUMI_PREFIX="${SPACESHIP_PULUMI_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}" | ||
SPACESHIP_PULUMI_SUFFIX="${SPACESHIP_PULUMI_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}" | ||
SPACESHIP_PULUMI_SYMBOL="${SPACESHIP_PULUMI_SYMBOL=" "}" | ||
SPACESHIP_PULUMI_COLOR="${SPACESHIP_PULUMI_COLOR="133"}" | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Section | ||
# ----------------------------------------------- ------------------------------- | ||
|
||
spaceship_pulumi() { | ||
[[ $SPACESHIP_PULUMI_SHOW == false ]] && return | ||
|
||
spaceship::exists pulumi || return | ||
|
||
# Show PULUMI Stack when exists | ||
local pulumi_project=$(spaceship::upsearch Pulumi.y*ml) | ||
[[ -n "$pulumi_project" || -d .pulumi/stacks ]] || return | ||
|
||
local pulumi_stack=$(pulumi stack ls 2>/dev/null | sed -n -e '2p' | cut -f1 -d" " | sed s/\*//) | ||
[[ -z $pulumi_stack ]] && return | ||
|
||
spaceship::section \ | ||
--color "$SPACESHIP_PULUMI_COLOR" \ | ||
--prefix "$SPACESHIP_PULUMI_PREFIX" \ | ||
--suffix "$SPACESHIP_PULUMI_SUFFIX" \ | ||
--symbol "$SPACESHIP_PULUMI_SYMBOL" \ | ||
"$pulumi_stack" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters