Skip to content

Commit

Permalink
Drop VSCode-specific flag.
Browse files Browse the repository at this point in the history
It's no longer needed.
  • Loading branch information
mitchell-as committed Oct 30, 2023
1 parent 4dcb93d commit f5b81a1
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 26 deletions.
8 changes: 0 additions & 8 deletions cmd/state/internal/cmdtree/cmdtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,6 @@ func newStateCommand(globals *globalOptions, prime *primer.Values) *captain.Comm
Persist: true,
Value: &globals.Output,
},
{
/* This option is only used for the vscode extension: It prevents the integrated terminal to close immediately after an error occurs, such that the user can read the message */
Name: "confirm-exit-on-error", // Name and Shorthand should be kept in sync with cmd/state/output.go
Description: "prompts the user to press enter before exiting, when an error occurs",
Persist: true,
Hidden: true, // No need to add this to help messages
Value: &opts.ConfirmExit,
},
{
Name: "non-interactive", // Name and Shorthand should be kept in sync with cmd/state/output.go
Description: locale.T("flag_state_non_interactive_description"),
Expand Down
14 changes: 0 additions & 14 deletions cmd/state/main.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package main

import (
"bufio"
"context"
"errors"
"fmt"
"os"
"os/exec"
"runtime/debug"
"strings"
"time"
Expand Down Expand Up @@ -108,17 +105,6 @@ func main() {
if err != nil {
out.Error(err)
}

// If a state tool error occurs in a VSCode integrated terminal, we want
// to pause and give time to the user to read the error message.
// But not, if we exit, because the last command in the activated sub-shell failed.
var eerr *exec.ExitError
isExitError := errors.As(err, &eerr)
if !isExitError && outFlags.ConfirmExit {
out.Print(locale.T("confirm_exit_on_error_prompt"))
br := bufio.NewReader(os.Stdin)
br.ReadLine()
}
}
}

Expand Down
1 change: 0 additions & 1 deletion cmd/state/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func (suite *MainTestSuite) TestParseOutputFlags() {
suite.Equal(outputFlags{"json", false, false, false}, parseOutputFlags([]string{"state", "foo", "-o", "json"}))

Check failure on line 51 in cmd/state/main_test.go

View workflow job for this annotation

GitHub Actions / ubuntu-20.04

too many values in struct literal of type outputFlags

Check failure on line 51 in cmd/state/main_test.go

View workflow job for this annotation

GitHub Actions / windows-2019

too many values in struct literal of type outputFlags

Check failure on line 51 in cmd/state/main_test.go

View workflow job for this annotation

GitHub Actions / macos-11

too many values in struct literal of type outputFlags
suite.Equal(outputFlags{"editor", false, false, false}, parseOutputFlags([]string{"state", "foo", "--output", "editor"}))

Check failure on line 52 in cmd/state/main_test.go

View workflow job for this annotation

GitHub Actions / ubuntu-20.04

too many values in struct literal of type outputFlags

Check failure on line 52 in cmd/state/main_test.go

View workflow job for this annotation

GitHub Actions / windows-2019

too many values in struct literal of type outputFlags

Check failure on line 52 in cmd/state/main_test.go

View workflow job for this annotation

GitHub Actions / macos-11

too many values in struct literal of type outputFlags
suite.Equal(outputFlags{"", true, false, false}, parseOutputFlags([]string{"state", "foo", "--mono"}))

Check failure on line 53 in cmd/state/main_test.go

View workflow job for this annotation

GitHub Actions / ubuntu-20.04

too many values in struct literal of type outputFlags

Check failure on line 53 in cmd/state/main_test.go

View workflow job for this annotation

GitHub Actions / windows-2019

too many values in struct literal of type outputFlags

Check failure on line 53 in cmd/state/main_test.go

View workflow job for this annotation

GitHub Actions / macos-11

too many values in struct literal of type outputFlags
suite.Equal(outputFlags{"", false, true, false}, parseOutputFlags([]string{"state", "foo", "--confirm-exit-on-error"}))
suite.Equal(outputFlags{"", false, false, true}, parseOutputFlags([]string{"state", "foo", "--non-interactive"}))
suite.Equal(outputFlags{"", false, false, true}, parseOutputFlags([]string{"state", "foo", "-n"}))
}
Expand Down
1 change: 0 additions & 1 deletion cmd/state/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ type outputFlags struct {
// These should be kept in sync with cmd/state/internal/cmdtree (output flag)
Output string `short:"o" long:"output"`
Mono bool `long:"mono"`
ConfirmExit bool `long:"confirm-exit-on-error"`
NonInteractive bool `short:"n" long:"non-interactive"`
}

Expand Down
2 changes: 0 additions & 2 deletions internal/locale/locales/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1569,8 +1569,6 @@ deploy_usable_path:
Please ensure '[NOTICE]{{.V0}}[/RESET]' exists and is on your PATH.
script_watcher_watch_file:
other: "Watching file changes at: [NOTICE]{{.V0}}[/RESET]"
confirm_exit_on_error_prompt:
other: Press enter to continue...
tutorial_newproject_intro:
other: |
The State Tool lets you create and maintain a set of virtual environments (eg., one per project), allowing you to
Expand Down

0 comments on commit f5b81a1

Please sign in to comment.