mirror of
https://github.com/Threnklyn/jira.git
synced 2026-06-07 05:23:33 +02:00
only prompt on logout if stdin is an active terminal
This commit is contained in:
+3
-1
@@ -2,10 +2,12 @@ package jiracmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
"github.com/coryb/figtree"
|
"github.com/coryb/figtree"
|
||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
"github.com/mgutz/ansi"
|
"github.com/mgutz/ansi"
|
||||||
|
"golang.org/x/crypto/ssh/terminal"
|
||||||
survey "gopkg.in/AlecAivazis/survey.v1"
|
survey "gopkg.in/AlecAivazis/survey.v1"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
"gopkg.in/Netflix-Skunkworks/go-jira.v1"
|
||||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiracli"
|
||||||
@@ -30,7 +32,7 @@ func CmdLogoutRegistry() *jiracli.CommandRegistryEntry {
|
|||||||
func CmdLogout(o *oreo.Client, globals *jiracli.GlobalOptions, opts *jiracli.CommonOptions) error {
|
func CmdLogout(o *oreo.Client, globals *jiracli.GlobalOptions, opts *jiracli.CommonOptions) error {
|
||||||
if globals.AuthMethod() == "api-token" {
|
if globals.AuthMethod() == "api-token" {
|
||||||
log.Noticef("No need to logout when using api-token authentication method")
|
log.Noticef("No need to logout when using api-token authentication method")
|
||||||
if globals.GetPass() != "" {
|
if globals.GetPass() != "" && terminal.IsTerminal(syscall.Stdin) {
|
||||||
delete := false
|
delete := false
|
||||||
err := survey.AskOne(
|
err := survey.AskOne(
|
||||||
&survey.Confirm{
|
&survey.Confirm{
|
||||||
|
|||||||
Reference in New Issue
Block a user