11use std:: path:: PathBuf ;
22
33use clap:: { Parser , Subcommand } ;
4+ use serde:: { Deserialize , Serialize } ;
45
56use crate :: ts:: package_reference:: PackageReference ;
67use crate :: ts:: version:: Version ;
78use crate :: util:: os:: OS ;
89
9- #[ derive( Parser , Debug ) ]
10+ #[ derive( Parser , Serialize , Deserialize , Debug ) ]
1011#[ command( author, version, about, long_about = None ) ]
1112pub struct Args {
1213 #[ clap( subcommand) ]
14+ #[ serde( flatten) ]
1315 pub commands : Commands ,
1416}
1517
1618const DEFAULT_MANIFEST : & str = "./" ;
1719
18- #[ derive( Subcommand , Debug , Clone ) ]
20+ #[ derive( Subcommand , Debug , Clone , Serialize , Deserialize ) ]
21+ #[ serde( rename_all = "snake_case" ) ]
1922pub enum InitSubcommand {
2023 /// Creates a tcli project which can be used to build and publish a package.
2124 Project {
@@ -35,7 +38,8 @@ pub enum InitSubcommand {
3538 Profile ,
3639}
3740
38- #[ derive( Subcommand , Debug , Clone ) ]
41+ #[ derive( Subcommand , Serialize , Deserialize , Debug , Clone ) ]
42+ #[ serde( rename_all = "snake_case" ) ]
3943pub enum ListSubcommand {
4044 /// List the platforms tcli supports.
4145 Platforms {
@@ -67,7 +71,7 @@ pub enum ListSubcommand {
6771 } ,
6872}
6973
70- #[ derive( Subcommand , Debug ) ]
74+ #[ derive( Subcommand , Serialize , Deserialize , Debug ) ]
7175pub enum ExternSubcommand {
7276 /// Get the path of a game with the specified label.
7377 GameData {
@@ -79,7 +83,8 @@ pub enum ExternSubcommand {
7983 } ,
8084}
8185
82- #[ derive( Subcommand , Debug ) ]
86+ #[ derive( Subcommand , Serialize , Deserialize , Debug ) ]
87+ #[ serde( rename_all = "snake_case" ) ]
8388pub enum Commands {
8489 /// Initialize a new project configuration.
8590 Init {
0 commit comments