File tree Expand file tree Collapse file tree 3 files changed +22
-24
lines changed
gitoxide-core/src/repository Expand file tree Collapse file tree 3 files changed +22
-24
lines changed Original file line number Diff line number Diff line change 1
1
use crate :: OutputFormat ;
2
2
3
- pub enum Kind {
4
- Local ,
5
- All ,
6
- }
3
+ pub mod list {
4
+ pub enum Kind {
5
+ Local ,
6
+ All ,
7
+ }
7
8
8
- pub struct Options {
9
- pub kind : Kind ,
9
+ pub struct Options {
10
+ pub kind : Kind ,
11
+ }
10
12
}
11
13
12
14
pub fn list (
13
15
repo : gix:: Repository ,
14
16
out : & mut dyn std:: io:: Write ,
15
17
format : OutputFormat ,
16
- options : Options ,
18
+ options : list :: Options ,
17
19
) -> anyhow:: Result < ( ) > {
18
20
if format != OutputFormat :: Human {
19
21
anyhow:: bail!( "JSON output isn't supported" ) ;
@@ -22,8 +24,8 @@ pub fn list(
22
24
let platform = repo. references ( ) ?;
23
25
24
26
let ( show_local, show_remotes) = match options. kind {
25
- Kind :: Local => ( true , false ) ,
26
- Kind :: All => ( true , true ) ,
27
+ list :: Kind :: Local => ( true , false ) ,
28
+ list :: Kind :: All => ( true , true ) ,
27
29
} ;
28
30
29
31
if show_local {
Original file line number Diff line number Diff line change @@ -509,16 +509,12 @@ pub fn main() -> Result<()> {
509
509
)
510
510
} ,
511
511
) ,
512
- Subcommands :: Branch ( platform) => match platform. cmds {
513
- Some ( branch:: Subcommands :: List ) | None => {
514
- use core:: repository:: branch;
512
+ Subcommands :: Branch ( platform) => match platform. cmd {
513
+ branch:: Subcommands :: List { all } => {
514
+ use core:: repository:: branch:: list ;
515
515
516
- let kind = if platform. all {
517
- branch:: Kind :: All
518
- } else {
519
- branch:: Kind :: Local
520
- } ;
521
- let options = branch:: Options { kind } ;
516
+ let kind = if all { list:: Kind :: All } else { list:: Kind :: Local } ;
517
+ let options = list:: Options { kind } ;
522
518
523
519
prepare_and_run (
524
520
"branch-list" ,
Original file line number Diff line number Diff line change @@ -243,17 +243,17 @@ pub mod branch {
243
243
#[ derive( Debug , clap:: Parser ) ]
244
244
pub struct Platform {
245
245
#[ clap( subcommand) ]
246
- pub cmds : Option < Subcommands > ,
247
-
248
- /// List remote-tracking as well as local branches.
249
- #[ clap( long, short = 'a' ) ]
250
- pub all : bool ,
246
+ pub cmd : Subcommands ,
251
247
}
252
248
253
249
#[ derive( Debug , clap:: Subcommand ) ]
254
250
pub enum Subcommands {
255
251
/// List all tags.
256
- List ,
252
+ List {
253
+ /// List remote-tracking as well as local branches.
254
+ #[ clap( long, short = 'a' ) ]
255
+ all : bool ,
256
+ } ,
257
257
}
258
258
}
259
259
You can’t perform that action at this time.
0 commit comments