Skip to content
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
4 changes: 4 additions & 0 deletions internal/cmd/issue/delete/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ func (mc *deleteCmd) setIssueKey(project string) error {
return nil
}

if cmdutil.StdinHasData() {
return fmt.Errorf("ISSUE-KEY argument is required in non-interactive mode")
}

var ans string

qs := &survey.Question{
Expand Down
3 changes: 3 additions & 0 deletions internal/cmd/issue/edit/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ func edit(cmd *cobra.Command, args []string) {
project := viper.GetString("project.key")

params := parseArgsAndFlags(cmd.Flags(), args, project)
if !params.noInput && cmdutil.StdinHasData() {
params.noInput = true
}
Comment on lines +63 to +65
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unless, I'm wrong it means this

Suggested change
if !params.noInput && cmdutil.StdinHasData() {
params.noInput = true
}
params.noInput = cmdutil.StdinHasData()

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I don't want to blindly overwrite. If the user (or coding agent) sends --no-input, that should be retained regardless of cmdutil.StdinHasData(). There may be an argument to simplify to what you've proposed, since piping something could indicate programmatic usage, but I don't think we can guarantee that. Changing that would be more than a bug fix, which is the intended purpose here.

It could become params.noInput = params.noInput || cmdutil.StdinHasData(), but I think that obscures readability for no tangible benefit.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for your detailed reply. You are right 😅👍

I missed the fact we don't want to reset noInput to false depending on the value of the stdin.

client := api.DefaultClient(params.debug)
ec := editCmd{
client: client,
Expand Down
8 changes: 8 additions & 0 deletions internal/cmd/issue/move/move.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ func (mc *moveCmd) setIssueKey(project string) error {
return nil
}

if cmdutil.StdinHasData() {
return fmt.Errorf("ISSUE-KEY argument is required in non-interactive mode")
}

var ans string

qs := &survey.Question{
Expand All @@ -200,6 +204,10 @@ func (mc *moveCmd) setDesiredState(it string) error {
return nil
}

if cmdutil.StdinHasData() {
return fmt.Errorf("desired state argument is required in non-interactive mode")
}

var (
options = make([]string, 0, len(mc.transitions))
ans string
Expand Down
Loading