1
1
use std:: path:: PathBuf ;
2
2
3
3
use clap:: { Parser , Subcommand } ;
4
+ use serde:: { Deserialize , Serialize } ;
4
5
5
6
use crate :: ts:: package_reference:: PackageReference ;
6
7
use crate :: ts:: version:: Version ;
7
8
use crate :: util:: os:: OS ;
8
9
9
- #[ derive( Parser , Debug ) ]
10
+ #[ derive( Parser , Serialize , Deserialize , Debug ) ]
10
11
#[ command( author, version, about, long_about = None ) ]
11
12
pub struct Args {
12
13
#[ clap( subcommand) ]
14
+ #[ serde( flatten) ]
13
15
pub commands : Commands ,
14
16
}
15
17
16
18
const DEFAULT_MANIFEST : & str = "./" ;
17
19
18
- #[ derive( Subcommand , Debug , Clone ) ]
20
+ #[ derive( Subcommand , Debug , Clone , Serialize , Deserialize ) ]
21
+ #[ serde( rename_all = "snake_case" ) ]
19
22
pub enum InitSubcommand {
20
23
/// Creates a tcli project which can be used to build and publish a package.
21
24
Project {
@@ -35,7 +38,8 @@ pub enum InitSubcommand {
35
38
Profile ,
36
39
}
37
40
38
- #[ derive( Subcommand , Debug , Clone ) ]
41
+ #[ derive( Subcommand , Serialize , Deserialize , Debug , Clone ) ]
42
+ #[ serde( rename_all = "snake_case" ) ]
39
43
pub enum ListSubcommand {
40
44
/// List the platforms tcli supports.
41
45
Platforms {
@@ -67,7 +71,7 @@ pub enum ListSubcommand {
67
71
} ,
68
72
}
69
73
70
- #[ derive( Subcommand , Debug ) ]
74
+ #[ derive( Subcommand , Serialize , Deserialize , Debug ) ]
71
75
pub enum ExternSubcommand {
72
76
/// Get the path of a game with the specified label.
73
77
GameData {
@@ -79,7 +83,8 @@ pub enum ExternSubcommand {
79
83
} ,
80
84
}
81
85
82
- #[ derive( Subcommand , Debug ) ]
86
+ #[ derive( Subcommand , Serialize , Deserialize , Debug ) ]
87
+ #[ serde( rename_all = "snake_case" ) ]
83
88
pub enum Commands {
84
89
/// Initialize a new project configuration.
85
90
Init {
0 commit comments