mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
Option to disable spinner via environment variable. (#1207)
Signed-off-by: Fabian Kammel <fk@edgeless.systems>
This commit is contained in:
parent
35a58316f4
commit
5e7dc0d7db
@ -14,6 +14,7 @@ import (
|
|||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/edgelesssys/constellation/v2/internal/constants"
|
||||||
tty "github.com/mattn/go-isatty"
|
tty "github.com/mattn/go-isatty"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
@ -45,10 +46,11 @@ type spinner struct {
|
|||||||
|
|
||||||
func newSpinnerOrStderr(cmd *cobra.Command) (spinnerInterf, error) {
|
func newSpinnerOrStderr(cmd *cobra.Command) (spinnerInterf, error) {
|
||||||
debug, err := cmd.Flags().GetBool("debug")
|
debug, err := cmd.Flags().GetBool("debug")
|
||||||
|
noSpinner := os.Getenv(constants.EnvVarNoSpinner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if debug {
|
if debug || noSpinner != "" {
|
||||||
return &nopSpinner{cmd.ErrOrStderr()}, nil
|
return &nopSpinner{cmd.ErrOrStderr()}, nil
|
||||||
}
|
}
|
||||||
return newSpinner(cmd.ErrOrStderr()), nil
|
return newSpinner(cmd.ErrOrStderr()), nil
|
||||||
|
@ -37,7 +37,10 @@ func NewTerminateCmd() *cobra.Command {
|
|||||||
// runTerminate runs the terminate command.
|
// runTerminate runs the terminate command.
|
||||||
func runTerminate(cmd *cobra.Command, args []string) error {
|
func runTerminate(cmd *cobra.Command, args []string) error {
|
||||||
fileHandler := file.NewHandler(afero.NewOsFs())
|
fileHandler := file.NewHandler(afero.NewOsFs())
|
||||||
spinner := newSpinner(cmd.ErrOrStderr())
|
spinner, err := newSpinnerOrStderr(cmd)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("creating spinner: %w", err)
|
||||||
|
}
|
||||||
defer spinner.Stop()
|
defer spinner.Stop()
|
||||||
terminator := cloudcmd.NewTerminator()
|
terminator := cloudcmd.NewTerminator()
|
||||||
|
|
||||||
|
@ -145,6 +145,10 @@ const (
|
|||||||
// EnvVarAzureClientSecretValue is environment variable to overwrite
|
// EnvVarAzureClientSecretValue is environment variable to overwrite
|
||||||
// provider.azure.clientSecretValue .
|
// provider.azure.clientSecretValue .
|
||||||
EnvVarAzureClientSecretValue = EnvVarPrefix + "AZURE_CLIENT_SECRET_VALUE"
|
EnvVarAzureClientSecretValue = EnvVarPrefix + "AZURE_CLIENT_SECRET_VALUE"
|
||||||
|
// EnvVarNoSpinner is environment variable used to disable the loading indicator (spinner)
|
||||||
|
// displayed in Constellation CLI. Any non-empty value, e.g., CONSTELL_NO_SPINNER=1,
|
||||||
|
// can be used to disable the spinner.
|
||||||
|
EnvVarNoSpinner = EnvVarPrefix + "NO_SPINNER"
|
||||||
// MiniConstellationUID is a sentinel value for the UID of a mini constellation.
|
// MiniConstellationUID is a sentinel value for the UID of a mini constellation.
|
||||||
MiniConstellationUID = "mini"
|
MiniConstellationUID = "mini"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user