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

Feature: add original estimate option to issue creation #748

Conversation

rodcloutier
Copy link
Contributor

This PR intends to add the possibility of specifying the original estimate when creating an issue.

  • New option is called -e, --original-estimate
  • Will set the { timetracking: { originalEstimate: "" } value in the payload.
❯ ./jira issue create --help
Create an issue in a given project with minimal information.

USAGE
  jira issue create [flags]

FLAGS
  -t, --type string                   Issue type
  -P, --parent string                 Parent issue key can be used to attach epic to an issue.
                                      And, this field is mandatory when creating a sub-task.
  -s, --summary string                Issue summary or title
  -b, --body string                   Issue description
  -y, --priority string               Issue priority
  -r, --reporter string               Issue reporter (username, email or display name)
  -a, --assignee string               Issue assignee (username, email or display name)
  -l, --label stringArray             Issue labels
  -C, --component stringArray         Issue components
      --fix-version stringArray       Release info (fixVersions)
      --affects-version stringArray   Release info (affectsVersions)
  -e, --original-estimate string      Issue Original estimate
      --custom stringToString         Set custom fields (default [])
  -T, --template string               Path to a file to read body/description from
      --web                           Open in web browser after successful creation
      --no-input                      Disable prompt for non-required fields
  -h, --help                          help for create

INHERITED FLAGS
  -c, --config string    Config file (default is /Users/rcloutier/.config/.jira/.config.yml)
      --debug            Turn on debug output
  -p, --project string   Jira project to look into (defaults to /Users/rcloutier/.config/.jira/.config.yml)

EXAMPLES
  $ jira issue create

  # Create issue in the configured project
  $ jira issue create -tBug -s"New Bug" -yHigh -lbug -lurgent -b"Bug description"

  # Create issue in another project
  $ jira issue create -pPRJ -tBug -yHigh -s"New Bug" -b$'Bug description\n\nSome more text'

  # Create issue and set custom fields
  # See https://github.com/ankitpokhrel/jira-cli/discussions/346
  $ jira issue create -tStory -s"Issue with custom fields" --custom story-points=3

  # Load description from template file
  $ jira issue create --template /path/to/template.tmpl

  # Get description from standard input
  $ jira issue create --template -

  # Or, use pipe to read input directly from standard input
  $ echo "Description from stdin" | jira issue create -s"Summary" -tTask

  # For issue description, the flag --body/-b takes precedence over the --template flag
  # The example below will add "Body from flag" as an issue description
  $ jira issue create -tTask -sSummary -b"Body from flag" --template /path/to/template.tpl

LEARN MORE
  Use 'jira <command> <subcommand> --help' for more information about a command.
  Read the doc or get help at https://github.com/ankitpokhrel/jira-cli

Copy link
Owner

@ankitpokhrel ankitpokhrel left a comment

Choose a reason for hiding this comment

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

This works great 🎉

Thank you @rodcloutier

@ankitpokhrel ankitpokhrel merged commit 527d3cd into ankitpokhrel:main Jul 27, 2024
4 checks passed
fabio42 added a commit to fabio42/jira-cli that referenced this pull request Aug 26, 2024
The recent changes in PR ankitpokhrel#748 caused issues with jira-cli when used with Jira Enterprise On-Prem (now referred to as DataCenter). All requests started failing with the following error message:

```
Error:
  - timetracking: Field 'timetracking' cannot be set. It is not on the appropriate screen, or unknown.
```

The issue arises because, even if the `--original-estimate` option is not specified, the timetracking field is included in the JSON query.
This PR addresses the issue by ensuring that the timetracking field is only included in the JSON query if the `--original-estimate` option is set.
I have tested the fix, and all tests are passing.

Please review the changes and let me know if there are any concerns.
ankitpokhrel pushed a commit that referenced this pull request Aug 30, 2024
* fix: regression introduced by new OriginalEstimate attribute

The recent changes in PR #748 caused issues with jira-cli when used with Jira Enterprise On-Prem (now referred to as DataCenter). All requests started failing with the following error message:

```
Error:
  - timetracking: Field 'timetracking' cannot be set. It is not on the appropriate screen, or unknown.
```

The issue arises because, even if the `--original-estimate` option is not specified, the timetracking field is included in the JSON query.
This PR addresses the issue by ensuring that the timetracking field is only included in the JSON query if the `--original-estimate` option is set.
I have tested the fix, and all tests are passing.

Please review the changes and let me know if there are any concerns.

* Fix test that don't include timetracking cli option
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Sep 23, 2024
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [ankitpokhrel/jira-cli](https://github.com/ankitpokhrel/jira-cli) | patch | `v1.5.1` -> `v1.5.2` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>ankitpokhrel/jira-cli (ankitpokhrel/jira-cli)</summary>

### [`v1.5.2`](https://github.com/ankitpokhrel/jira-cli/releases/tag/v1.5.2)

[Compare Source](ankitpokhrel/jira-cli@v1.5.1...v1.5.2)

#### What's Changed

-   feat: issue view: Raw response option by [@&#8203;mpalahuta](https://github.com/mpalahuta) in ankitpokhrel/jira-cli#720
-   feat: Add original estimate option to issue creation by [@&#8203;rodcloutier](https://github.com/rodcloutier) in ankitpokhrel/jira-cli#748
-   feat: Allow updating parent on edit by [@&#8203;ankitpokhrel](https://github.com/ankitpokhrel) in ankitpokhrel/jira-cli#765
-   feat: Add cli method for close sprint with supporting jira client … by [@&#8203;cworsnup13](https://github.com/cworsnup13) in ankitpokhrel/jira-cli#756 ankitpokhrel/jira-cli#778
-   fix: Epic description overridden in no-input mode by [@&#8203;ankitpokhrel](https://github.com/ankitpokhrel) in ankitpokhrel/jira-cli#728
-   fix: Regression introduced by new OriginalEstimate attribute by [@&#8203;fabio42](https://github.com/fabio42) in ankitpokhrel/jira-cli#767
-   fix: Consider Windows Terminal as non-dumb terminal by [@&#8203;beatbrot](https://github.com/beatbrot) in ankitpokhrel/jira-cli#706
-   fix: Improve zsh autocomplete directions by [@&#8203;omair-inam](https://github.com/omair-inam) in ankitpokhrel/jira-cli#739

#### New Contributors

-   [@&#8203;mpalahuta](https://github.com/mpalahuta) made their first contribution in ankitpokhrel/jira-cli#720
-   [@&#8203;omair-inam](https://github.com/omair-inam) made their first contribution in ankitpokhrel/jira-cli#739
-   [@&#8203;rodcloutier](https://github.com/rodcloutier) made their first contribution in ankitpokhrel/jira-cli#748
-   [@&#8203;fabio42](https://github.com/fabio42) made their first contribution in ankitpokhrel/jira-cli#767
-   [@&#8203;cworsnup13](https://github.com/cworsnup13) made their first contribution in ankitpokhrel/jira-cli#756

**Full Changelog**: ankitpokhrel/jira-cli@v1.5.1...v1.5.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants