Kit (as in baby bunny) for Jira CLI.
Project description
Jira CLI Kit
A female rabbit is called a doe. A male rabbit is called a buck. A baby rabbit is called a kit.
This is a command-line tool to interact with Jira Cloud to create tickets and add comments to existing tickets.
It uses a configuration file (~/.jira.cfg
) for default settings and allows command-line arguments to override these defaults.
Setup
Install
git clone git@gitlab.com:q-os/security.git
pip install ./security/projects/jiracli # locally
pip install jiraclikit # from PyPI
1. Create a Jira API Token
To interact with Jira Cloud, you need to generate an API token:
- Go to Jira API Token page.
- Log in with your Jira account.
- Click on Create API token.
- Name the token and click Create.
- Copy the token and save it securely.
2. Set Environment Variables
Store the Jira API URL and token as environment variables for secure access:
export JC_JIRA_URL="https://yourdomain.atlassian.net" # Replace with your Jira domain
export JC_JIRA_TOKEN="your_jira_api_token" # Replace with the generated API token
3. Initial Run Configuration
When you run the tool for the first time, it will prompt you to enter:
- Default Project ID: The Jira project ID where tickets will be created.
- Default Parent Task ID (optional): A parent ticket ID if you often create subtasks under a specific epic or task.
These will be saved in the ~/.jira.cfg
file.
Examples
Creating a Ticket
To create a new ticket in Jira:
python jira_cli.py -s "Ticket Title" -m "Detailed description of the ticket" -p "PROJECT_ID" -e "PARENT_TASK_ID" -t "tag1,tag2"
- This will create a ticket with the specified title, message, project, parent task, and tags.
- If
-p
or-e
is not specified, the tool will fall back to the defaults in~/.jira.cfg
, unless-n
is used.
Adding a Comment to a Ticket
To add a comment to an existing ticket:
python jira_cli.py -c "TICKET_ID" -m "Your comment here"
- This will add the provided comment to the specified ticket.
Using "No Defaults" Mode
To ignore the .jira.cfg
settings and use only the provided CLI arguments:
python jira_cli.py -s "New Ticket Without Defaults" -p "ANOTHER_PROJECT_ID" -n
Configuration File (~/.jira.cfg
)
The configuration file will look like this:
[DEFAULT]
project_id = YOUR_DEFAULT_PROJECT_ID
parent_task = YOUR_DEFAULT_PARENT_TASK_ID
The settings here are automatically created on the first run if they don't already exist.
Notes
- Environment Variables: Ensure the
JIRA_URL
andJIRA_API_TOKEN
are set before running the tool. - Command-line Override: CLI arguments override the config file values.
- Error Handling: If any required parameter is missing, the script will raise an error and prompt for correction.
Publish
python -m pip install --upgrade pip build twine
python -m build --sdist && python -m build --wheel
twine upload ./dist/* -u __token__ -p $PYPI_API_KEY
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file jiraclikit-1.0.0.tar.gz
.
File metadata
- Download URL: jiraclikit-1.0.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72c090efaeb1a407d2c6edd248f7d62e1f0b740c06805ef6e331d01d8745455f |
|
MD5 | c8f936643e6b36395c33447a0aa02e09 |
|
BLAKE2b-256 | 86ad986ac91d10227e482f943d0620c9bc47de85a08c1b480262c20d016f6a0f |
File details
Details for the file jiraclikit-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: jiraclikit-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2983e9beb8a7b9c9830d142380cfca9f6665e5564ecf9f11b01d50fbf7de0ec |
|
MD5 | f51247e3b4800c1a064f7e108d37f436 |
|
BLAKE2b-256 | f8eb107c6d33fa3e3b0bfa2995dd1d0d2fc1a39e624806c22b1dfeb63f2b82be |