Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add --passwordsource global option #442

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ require (
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473
gopkg.in/yaml.v2 v2.2.2 // indirect
)

replace github.com/go-jira/jira => github.com/chuckliu1979/jira v1.0.30 //indirect
Copy link
Contributor

@catskul catskul Nov 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, this probably shouldn't stay in.

Suggested change
replace github.com/go-jira/jira => github.com/chuckliu1979/jira v1.0.30 //indirect

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 we can't merge with this in

1 change: 1 addition & 0 deletions jiracli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ func register(app *kingpin.Application, o *oreo.Client, fig *figtree.FigTree) {
app.Flag("socksproxy", "Address for a socks proxy").SetValue(&globals.SocksProxy)
app.Flag("user", "user name used within the Jira service").Short('u').SetValue(&globals.User)
app.Flag("login", "login name that corresponds to the user used for authentication").SetValue(&globals.Login)
app.Flag("passwordsource", "Method to fetch the password").SetValue(&globals.PasswordSource)

o = o.WithPreCallback(func(req *http.Request) (*http.Request, error) {
if globals.AuthMethod() == "api-token" {
Expand Down
6 changes: 3 additions & 3 deletions jiracli/password.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package jiracli
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"os/exec"
"strings"
Expand Down Expand Up @@ -118,11 +117,12 @@ func (o *GlobalOptions) GetPass() string {
}
} else if o.PasswordSource.Value == "stdin" {
log.Info("Reading password from stdin.")
allBytes, err := ioutil.ReadAll(os.Stdin)
var buffer [512]byte
nBytes, err := os.Stdin.Read(buffer[:])
if err != nil {
panic(fmt.Sprintf("unable to read bytes from stdin: %s", err))
}
o.cachedPassword = string(allBytes)
o.cachedPassword = string(buffer[:nBytes-1])
} else {
log.Warningf("Unknown password-source: %s", o.PasswordSource)
}
Expand Down