Add documentation to the cli args

This commit is contained in:
Daan Boerlage 2025-01-21 17:05:29 +01:00
parent 63b1f33a0a
commit 43e32a303d
Signed by: daan
GPG key ID: FCE070E1E4956606
2 changed files with 26 additions and 11 deletions

View file

@ -24,9 +24,9 @@ cargo install jirac
Usage: jirac <COMMAND> Usage: jirac <COMMAND>
Commands: Commands:
create create Create a ticket
list list Find tickets currently assigned to you
init init Setup the configuration
help Print this message or the help of the given subcommand(s) help Print this message or the help of the given subcommand(s)
Options: Options:
@ -37,13 +37,16 @@ Options:
### Creating a ticket ### Creating a ticket
``` ```
Create a ticket
Usage: jirac create [OPTIONS] [MARKDOWN_FILE] Usage: jirac create [OPTIONS] [MARKDOWN_FILE]
Arguments: Arguments:
[MARKDOWN_FILE] [MARKDOWN_FILE] A markdown file
Options: Options:
--project <PROJECT> --project <PROJECT> The project key in which to create the ticket
--open Open the new ticket in a browser
-h, --help Print help -h, --help Print help
``` ```
@ -68,15 +71,15 @@ jirac create --project KEY
## Listing tickets ## Listing tickets
``` ```
Find tickets currently assigned to you
Usage: jirac list [OPTIONS] Usage: jirac list [OPTIONS]
Options: Options:
--json --json Print json rather than pretty print
-h, --help Print help -h, --help Print help
``` ```
For now this only lists tickets assigned to the calling user.
## Configuration ## Configuration
Get the following information: Get the following information:
@ -88,12 +91,14 @@ Get the following information:
Then run the the `jirac init` command Then run the the `jirac init` command
``` ```
Setup the configuration
Usage: jirac init --url <URL> --email <EMAIL> --token <TOKEN> Usage: jirac init --url <URL> --email <EMAIL> --token <TOKEN>
Options: Options:
--url <URL> --url <URL> Jira instance URL
--email <EMAIL> --email <EMAIL> User email
--token <TOKEN> --token <TOKEN> User Token
-h, --help Print help -h, --help Print help
``` ```

View file

@ -10,25 +10,35 @@ pub struct Cli {
#[derive(Subcommand)] #[derive(Subcommand)]
pub enum Commands { pub enum Commands {
/// Create a ticket
Create { Create {
/// The project key in which to create the ticket
#[arg(long)] #[arg(long)]
project: Option<String>, project: Option<String>,
/// Open the new ticket in a browser
#[arg(long)] #[arg(long)]
open: bool, open: bool,
/// A markdown file
#[arg(value_name = "MARKDOWN_FILE")] #[arg(value_name = "MARKDOWN_FILE")]
markdown_file: Option<PathBuf>, markdown_file: Option<PathBuf>,
}, },
/// Find tickets currently assigned to you
List { List {
/// Print json rather than pretty print
#[arg(long)] #[arg(long)]
json: bool, json: bool,
}, },
/// Setup the configuration
Init { Init {
/// Jira instance URL
#[arg(long)] #[arg(long)]
url: String, url: String,
/// User email
#[arg(long)] #[arg(long)]
email: String, email: String,
/// User Token
#[arg(long)] #[arg(long)]
token: String, token: String,
}, },