File tree Expand file tree Collapse file tree 3 files changed +8
-0
lines changed Expand file tree Collapse file tree 3 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ require (
25
25
26
26
require (
27
27
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
28
+ github.com/andrew-d/go-termutil v0.0.0-20150726205930-009166a695a2 // indirect
28
29
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
29
30
github.com/chzyer/readline v1.5.1 // indirect
30
31
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tN
44
44
github.com/PuerkitoBio/purell v1.1.1 /go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0 =
45
45
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M =
46
46
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 /go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE =
47
+ github.com/andrew-d/go-termutil v0.0.0-20150726205930-009166a695a2 h1:axBiC50cNZOs7ygH5BgQp4N+aYrZ2DNpWZ1KG3VOSOM =
48
+ github.com/andrew-d/go-termutil v0.0.0-20150726205930-009166a695a2 /go.mod h1:jnzFpU88PccN/tPPhCpnNU8mZphvKxYM9lLNkd8e+os =
47
49
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef /go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw =
48
50
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ =
49
51
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d /go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw =
Original file line number Diff line number Diff line change 5
5
"fmt"
6
6
"os"
7
7
8
+ termutil "github.com/andrew-d/go-termutil"
8
9
"github.com/manifoldco/promptui"
9
10
homedir "github.com/mitchellh/go-homedir"
10
11
log "github.com/sirupsen/logrus"
@@ -26,6 +27,10 @@ func Login(cmd *cobra.Command, args []string) error {
26
27
}
27
28
viper .SetConfigFile (configPath )
28
29
30
+ if ! termutil .Isatty (os .Stdin .Fd ()) {
31
+ log .Fatalf ("Unable to read from stdin, please launch the command in interactive mode" )
32
+ }
33
+
29
34
writeFileMessage := fmt .Sprintf ("Do you want to create a new configuration file in (%s)" , configPath )
30
35
if _ , err := os .Stat (configPath ); ! errors .Is (err , os .ErrNotExist ) {
31
36
writeFileMessage = fmt .Sprintf ("Do you want to update configuration file (%s)" , configPath )
You can’t perform that action at this time.
0 commit comments