Skip to content

Commit b9ec4e9

Browse files
committed
chore: Clean up README
1 parent 2365315 commit b9ec4e9

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
The Terraform Workspace Selector is a command-line tool that helps you interactively select a Terraform workspace from the available options.
44

5-
I generated this entirely using ChatGPT and don't know what I'm doing, so there might be problems or inefficiencies. Feel free to open issues.
6-
7-
85
## Functionality
96

107
The application provides the following basic functionality:
@@ -13,14 +10,18 @@ The application provides the following basic functionality:
1310
- Displays an interactive prompt that allows you to select a workspace.
1411
- Sets the selected workspace using the `terraform workspace select` command.
1512

13+
## Install
1614

17-
## Usage
15+
To install Terraform Workspace Selector, you can do either of the following:
16+
- Run `go install github.com/abyss/tfws@latest`
1817

19-
To use the Terraform Workspace Selector, follow these steps:
18+
- Download a binary from GitHub and put it in your PATH
19+
20+
`tfws` calls `terraform` directly, so terraform will need to be resolvable from your path. Tools like [tenv](https://github.com/tofuutils/tenv) or [asdf](https://github.com/asdf-vm/asdf) should natively work.
21+
22+
## Usage
2023

21-
1. Run `task build` to create a binary (located in `bin/`)
22-
2. Copy that binary somewhere in your path.
23-
3. Run `tfws` in your Terraform project.
24+
To use the Terraform Workspace Selector, just run `tfws` in a Terraform project with multiple workspaces.
2425

2526
Upon running the application, it will retrieve the list of Terraform workspaces and display an interactive prompt. Use the arrow keys or fuzzy search to navigate the options and press Enter to select a workspace. The selected workspace will be set using the `terraform workspace select` command.
2627

tfws.go

-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ func main() {
4747
return
4848
}
4949

50-
// Create items for the prompt
5150
items := make([]string, len(validWorkspaces))
5251
defaultIndex := 0
5352
for i, workspace := range validWorkspaces {
@@ -57,14 +56,12 @@ func main() {
5756
}
5857
}
5958

60-
// Create the select prompt
6159
prompt := &survey.Select{
6260
Message: "Select a Terraform workspace:",
6361
Options: items,
6462
Default: items[defaultIndex],
6563
}
6664

67-
// Run the prompt
6865
var selectedWorkspace string
6966
err = survey.AskOne(prompt, &selectedWorkspace, survey.WithPageSize(10))
7067
if err != nil {
@@ -73,7 +70,6 @@ func main() {
7370

7471
fmt.Printf("Selected workspace: %s\n", selectedWorkspace)
7572

76-
// Select the chosen workspace
7773
cmd = exec.Command("terraform", "workspace", "select", selectedWorkspace)
7874
if err := cmd.Run(); err != nil {
7975
log.Fatalf("Failed to execute 'terraform workspace select': %s", err)

0 commit comments

Comments
 (0)