1+ //! Clap definitions for the Gitlane command-line interface.
2+
13use std:: path:: PathBuf ;
24
35use clap:: { Args , Parser , Subcommand , ValueEnum } ;
46
7+ /// Top-level Gitlane CLI arguments.
58#[ derive( Debug , Parser ) ]
69#[ command(
710 name = "gitlane" ,
@@ -10,93 +13,135 @@ use clap::{Args, Parser, Subcommand, ValueEnum};
1013 long_about = None
1114) ]
1215pub struct Cli {
16+ /// Project directory or nested path used to locate `.gitlane`.
1317 #[ arg( long, global = true , value_name = "PATH" ) ]
1418 pub project : Option < PathBuf > ,
1519
20+ /// Command to execute.
1621 #[ command( subcommand) ]
1722 pub command : Command ,
1823}
1924
25+ /// Supported top-level Gitlane commands.
2026#[ derive( Debug , Subcommand ) ]
2127pub enum Command {
28+ /// Initialize a new Gitlane project scaffold.
2229 Init ( InitArgs ) ,
30+ /// Validate project configuration and data.
2331 Validate ,
32+ /// Manage issues.
2433 Issue {
34+ /// Issue subcommand to execute.
2535 #[ command( subcommand) ]
2636 command : IssueCommand ,
2737 } ,
38+ /// Inspect workflow configuration.
2839 Workflow {
40+ /// Workflow subcommand to execute.
2941 #[ command( subcommand) ]
3042 command : WorkflowCommand ,
3143 } ,
44+ /// Inspect labels.
3245 Label {
46+ /// Label subcommand to execute.
3347 #[ command( subcommand) ]
3448 command : LabelCommand ,
3549 } ,
3650}
3751
52+ /// Arguments for `gitlane init`.
3853#[ derive( Debug , Args ) ]
3954pub struct InitArgs {
55+ /// Project name to write into the generated config.
4056 #[ arg( long) ]
4157 pub name : Option < String > ,
4258
59+ /// Optional project description for the generated config.
4360 #[ arg( long) ]
4461 pub description : Option < String > ,
4562
63+ /// Optional homepage URL for the generated config.
4664 #[ arg( long) ]
4765 pub homepage : Option < String > ,
4866
67+ /// Config file format to use for generated files.
4968 #[ arg( long, value_enum) ]
5069 pub format : Option < InitFormatArg > ,
5170}
5271
72+ /// Supported values for `gitlane init --format`.
5373#[ derive( Clone , Copy , Debug , ValueEnum ) ]
5474pub enum InitFormatArg {
75+ /// Generate TOML config files.
5576 Toml ,
77+ /// Generate JSON config files.
5678 Json ,
79+ /// Generate YAML config files using `.yaml`.
5780 Yaml ,
81+ /// Generate YAML config files using `.yml`.
5882 Yml ,
5983}
6084
85+ /// Supported `gitlane issue` subcommands.
6186#[ derive( Debug , Subcommand ) ]
6287pub enum IssueCommand {
88+ /// Create a new issue.
6389 Create ,
90+ /// List issues.
6491 List ,
92+ /// Show one issue by id.
6593 Show ( IssueShowArgs ) ,
94+ /// Apply a workflow transition to an issue.
6695 Transition ( IssueTransitionArgs ) ,
6796}
6897
98+ /// Arguments for `gitlane issue show`.
6999#[ derive( Debug , Args ) ]
70100pub struct IssueShowArgs {
101+ /// Issue identifier to display.
71102 pub id : String ,
72103}
73104
105+ /// Arguments for `gitlane issue transition`.
74106#[ derive( Debug , Args ) ]
75107pub struct IssueTransitionArgs {
108+ /// Issue identifier to transition.
76109 pub id : String ,
110+ /// Transition identifier to apply.
77111 pub transition_id : String ,
78112}
79113
114+ /// Supported `gitlane workflow` subcommands.
80115#[ derive( Debug , Subcommand ) ]
81116pub enum WorkflowCommand {
117+ /// Show the full workflow configuration.
82118 Show ,
119+ /// List workflow states.
83120 States ,
121+ /// List transitions, optionally filtered by source state.
84122 Transitions ( WorkflowTransitionsArgs ) ,
85123}
86124
125+ /// Arguments for `gitlane workflow transitions`.
87126#[ derive( Debug , Args ) ]
88127pub struct WorkflowTransitionsArgs {
128+ /// Optional source state id to filter transitions.
89129 #[ arg( long = "from" , value_name = "STATE_ID" ) ]
90130 pub from_state : Option < String > ,
91131}
92132
133+ /// Supported `gitlane label` subcommands.
93134#[ derive( Debug , Subcommand ) ]
94135pub enum LabelCommand {
136+ /// List labels.
95137 List ,
138+ /// Show one label by id.
96139 Show ( LabelShowArgs ) ,
97140}
98141
142+ /// Arguments for `gitlane label show`.
99143#[ derive( Debug , Args ) ]
100144pub struct LabelShowArgs {
145+ /// Label identifier to display.
101146 pub id : String ,
102147}
0 commit comments