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 11use crate :: OutputFormat ;
22
3- pub enum Kind {
4- Local ,
5- All ,
6- }
3+ pub mod list {
4+ pub enum Kind {
5+ Local ,
6+ All ,
7+ }
78
8- pub struct Options {
9- pub kind : Kind ,
9+ pub struct Options {
10+ pub kind : Kind ,
11+ }
1012}
1113
1214pub fn list (
1315 repo : gix:: Repository ,
1416 out : & mut dyn std:: io:: Write ,
1517 format : OutputFormat ,
16- options : Options ,
18+ options : list :: Options ,
1719) -> anyhow:: Result < ( ) > {
1820 if format != OutputFormat :: Human {
1921 anyhow:: bail!( "JSON output isn't supported" ) ;
@@ -22,8 +24,8 @@ pub fn list(
2224 let platform = repo. references ( ) ?;
2325
2426 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 ) ,
2729 } ;
2830
2931 if show_local {
Original file line number Diff line number Diff line change @@ -509,16 +509,12 @@ pub fn main() -> Result<()> {
509509 )
510510 } ,
511511 ) ,
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 ;
515515
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 } ;
522518
523519 prepare_and_run (
524520 "branch-list" ,
Original file line number Diff line number Diff line change @@ -243,17 +243,17 @@ pub mod branch {
243243 #[ derive( Debug , clap:: Parser ) ]
244244 pub struct Platform {
245245 #[ 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 ,
251247 }
252248
253249 #[ derive( Debug , clap:: Subcommand ) ]
254250 pub enum Subcommands {
255251 /// 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+ } ,
257257 }
258258}
259259
You can’t perform that action at this time.
0 commit comments