ankitpokhrel / jira-cli

🔥 Feature-rich interactive Jira command line.
MIT License
3.9k stars 197 forks source link

issue edit updating description with stdin content with --no-input parameter #727

Open vyprabhu opened 6 months ago

vyprabhu commented 6 months ago

Describe the bug

Please provide following details

  1. JiraCLI Version: (Version="v1.5.1", GitCommit="", CommitDate="", GoVersion="go1.20.12", Compiler="gc", Platform="linux/amd64") Please paste the output of jira version here.
  2. Are you using Jira cloud or on-premise jira server? cloud Please paste the output of jira serverinfo here. Version: 1001.0.0-SNAPSHOT Build Number: 100248 Deployment Type: Cloud Default Locale: en_US
  3. What operating system are you using? Also mention version. Windows 11 Please type your answer here. eg: macOS Big Sur 11.5.1
  4. What terminal are you using? Also mention version.
    
    Please type your answer here. eg: iTerm 2 Build 3.4.10
    WSL

To Reproduce

Steps to reproduce the behavior:

  1. run jira issue edit --label "abc" --no-input
  2. Since --no-input parameter is provided, the prompts for summary, description and metadata is hidden and not prompted. But still the description of the issue is replaced with content from stdin.

Expected behavior since no other parameter (be it summary / description / any other field) is not passed, the other fields should not be updated.

Screenshots

Additional context

ankitpokhrel commented 5 months ago

Hi @vyprabhu are you just running jira issue edit --label "abc" --no-input or you are streaming contents from stdin echo "something" | jira issue edit --label "abc" --no-input?

vyprabhu commented 5 months ago

So basically, i'm searching for some keys matching a particular criteria and then I am running "jira issue edit --label "abc" --no-input" thru bash script to update the label for each key. I'm not piping anything to this command.

vyprabhu commented 5 months ago

@ankitpokhrel

Not sure if you progressed on this one... I found a workaround in the meantime.

Research and Discovery : I observed that the command jira issue edit --label "abc" --no-input still follows the approach of jira issue edit --label "abc" and it waits for an "Enter" command for the description field even if you provide no-input parameter. And hence it pulls the previous output of stdin.

Workaround / Solution : The below workaround was discovered to add char code for "Enter" in the Description field alongwith --no-input to stop the command from piping in stdin:

jira issue edit -b$'\x0a' -l"$lbl" --no-input

Note that the $'\x0a' in the description field referred to as '-b' acts as an enter command without any input / amendment to the description field.