2023-02-19 16:17:49 +03:00
|
|
|
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
2021-09-28 02:15:17 +03:00
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
2022-02-27 23:35:43 +03:00
|
|
|
use clap::{Parser, Subcommand};
|
2021-09-28 02:15:17 +03:00
|
|
|
|
2021-12-09 18:21:33 +03:00
|
|
|
use crate::Result;
|
2021-09-28 02:15:17 +03:00
|
|
|
|
2023-02-16 18:24:49 +03:00
|
|
|
mod android;
|
2021-12-09 18:21:33 +03:00
|
|
|
mod init;
|
2023-02-16 18:24:49 +03:00
|
|
|
mod ios;
|
2021-09-28 02:15:17 +03:00
|
|
|
|
2021-12-09 18:21:33 +03:00
|
|
|
#[derive(Parser)]
|
2022-02-27 23:35:43 +03:00
|
|
|
#[clap(
|
|
|
|
author,
|
|
|
|
version,
|
|
|
|
about = "Manage Tauri plugins",
|
|
|
|
subcommand_required(true),
|
|
|
|
arg_required_else_help(true)
|
|
|
|
)]
|
2021-12-09 18:21:33 +03:00
|
|
|
pub struct Cli {
|
|
|
|
#[clap(subcommand)]
|
|
|
|
command: Commands,
|
2021-09-28 02:15:17 +03:00
|
|
|
}
|
|
|
|
|
2021-12-09 18:21:33 +03:00
|
|
|
#[derive(Subcommand)]
|
|
|
|
enum Commands {
|
|
|
|
Init(init::Options),
|
2023-02-16 18:24:49 +03:00
|
|
|
Android(android::Cli),
|
|
|
|
Ios(ios::Cli),
|
2021-09-28 02:15:17 +03:00
|
|
|
}
|
|
|
|
|
2021-12-09 18:21:33 +03:00
|
|
|
pub fn command(cli: Cli) -> Result<()> {
|
|
|
|
match cli.command {
|
|
|
|
Commands::Init(options) => init::command(options)?,
|
2023-02-16 18:24:49 +03:00
|
|
|
Commands::Android(cli) => android::command(cli)?,
|
|
|
|
Commands::Ios(cli) => ios::command(cli)?,
|
2021-09-28 02:15:17 +03:00
|
|
|
}
|
|
|
|
|
2021-12-09 18:21:33 +03:00
|
|
|
Ok(())
|
2021-09-28 02:15:17 +03:00
|
|
|
}
|