Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add terraform workspace segment #75

Merged
merged 1 commit into from
Oct 19, 2020

Conversation

matsest
Copy link

@matsest matsest commented Oct 16, 2020

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • The commit message follows the conventional commits guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Description

This adds support for showing the current terraform workspace name.

Inspired by a bash prompt I've used to show the current workspace:

function terraform_prompt()
  {
     if [ -d .terraform ]; then
       workspace="$(command terraform workspace show 2>/dev/null)"
       echo " (${workspace})"
     fi
  }

@matsest
Copy link
Author

matsest commented Oct 16, 2020

The existence of the .terraform dir and test for it is the WIP part I've identified and not too sure about (not very familiar with golang)

Edit: I think this is working now, after testing locally and running the gh actions. But very open to improvement suggestions :)

@matsest matsest changed the title WIP: feat: add terraform workspace segment feat: add terraform workspace segment Oct 16, 2020
docs/docs/segment-terraform.md Outdated Show resolved Hide resolved
segment_terraform.go Outdated Show resolved Hide resolved
segment_terraform.go Outdated Show resolved Hide resolved
@JanDeDobbeleer
Copy link
Owner

@matsest feel free to reach out for help when you need it, I'm here to assist. Great work overall, looking forward to merging this 👍🏻

@matsest matsest force-pushed the add-tf-segment branch 3 times, most recently from e0c88d1 to 9646f7b Compare October 16, 2020 23:40
@JanDeDobbeleer
Copy link
Owner

2 comments and a general remark, can you squash all these commits into 1? It's small enough to be in a single commit context.

@matsest
Copy link
Author

matsest commented Oct 17, 2020

@JanDeDobbeleer Sounds good! Will fix this when I'm back home tomorrow evening

@matsest
Copy link
Author

matsest commented Oct 19, 2020

Thanks for the helpful review. I've gone through your review comments, rebased and squashed the PR into one commit. Hope it looks good now @JanDeDobbeleer :)

@JanDeDobbeleer
Copy link
Owner

Hope it looks good now

Only need to remove the properties in the docs and it can be merged!

@JanDeDobbeleer JanDeDobbeleer merged commit c3e81f4 into JanDeDobbeleer:main Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants