mirror of
https://framagit.org/veretcle/tootube.git
synced 2025-07-21 13:24:19 +02:00
feat: add register command
This commit is contained in:
22
src/main.rs
22
src/main.rs
@@ -17,8 +17,30 @@ fn main() {
|
||||
.default_value(DEFAULT_CONFIG_PATH)
|
||||
.display_order(1),
|
||||
)
|
||||
.subcommand(
|
||||
Command::new("register")
|
||||
.version(env!("CARGO_PKG_VERSION"))
|
||||
.about("Command to register to YouTube OAuth2.0")
|
||||
.arg(
|
||||
Arg::new("config")
|
||||
.short('c')
|
||||
.long("config")
|
||||
.value_name("CONFIG_FILE")
|
||||
.help("TOML config file for tootube")
|
||||
.num_args(1)
|
||||
.default_value(DEFAULT_CONFIG_PATH)
|
||||
.display_order(1),
|
||||
),
|
||||
)
|
||||
.get_matches();
|
||||
|
||||
if let Some(("register", sub_m)) = matches.subcommand() {
|
||||
let config = parse_toml(sub_m.get_one::<String>("config").unwrap());
|
||||
register(&config.youtube)
|
||||
.unwrap_or_else(|e| panic!("Cannot register to YouTube API: {}", e));
|
||||
return;
|
||||
}
|
||||
|
||||
let config = parse_toml(matches.get_one::<String>("config").unwrap());
|
||||
|
||||
env_logger::init();
|
||||
|
Reference in New Issue
Block a user