1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
use clap::{Args, Parser, Subcommand, ValueEnum};
/// A fictional versioning CLI
#[derive(Debug, Parser)] // requires `derive` feature
#[command(name = "rnacos")]
#[command(version, about = "rnacos cli", long_about = None)]
pub struct Cli {
#[command(subcommand)]
pub command: Option<Commands>,
/// env file path
#[arg(short, long, default_value = "")]
pub env_file: String,
}
#[derive(Debug, Subcommand)]
pub enum Commands {
/// transfer middle data to sqlite
#[command(arg_required_else_help = true)]
DataToSqlite {
/// the transfer middle data file
file: String,
/// out to sqlite db file
out: String,
},
/// sqlite to transfer middle data
#[command(arg_required_else_help = true)]
SqliteToData {
/// the sqlite db file
file: String,
/// out to transfer middle data file
out: String,
},
/// nacos mysql to transfer middle data
#[command(arg_required_else_help = true)]
MysqlToData {
/// the nacos mysql db uri; example: mysql://user:password@localhost:3306/nacos
uri: String,
/// out to transfer middle data file
out: String,
},
#[command(arg_required_else_help = true)]
OpenapiToData {
/// nacos auth username,default is empty
#[arg(short, long, default_value = "")]
username: String,
/// nacos auth password,default is empty
#[arg(short, long, default_value = "")]
password: String,
/// nacos host ip:port; example: 127.0.0.1:8848
host: String,
/// out to transfer middle data file
out: String,
},
}