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
55

use argh::FromArgs;

#[derive(FromArgs, PartialEq, Debug)]
/// Top-level command.
pub struct LaunchOptions {
    #[argh(subcommand)]
    pub command: LaunchCommand,
}

/// The various kinds of commands that `wasm-pack` can execute.
#[derive(FromArgs, PartialEq, Debug)]
#[argh(subcommand)]
pub enum LaunchCommand {
    Develop(DevelopOptions),
    Build(BuildOptions),
    Test(TestOptions),
    Publish(PublishOptions),
}

/// Publish your yew application to Github Pages, Netlify, or S3
#[derive(FromArgs, PartialEq, Debug)]
#[argh(subcommand, name = "publish")]
pub struct PublishOptions {}

/// 🔬 test your yew application!
#[derive(FromArgs, PartialEq, Debug)]
#[argh(subcommand, name = "test")]
pub struct TestOptions {
    /// an example in the crate
    #[argh(option)]
    pub example: Option<String>,
}

/// 🏗️  Build your yew application
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "build")]
pub struct BuildOptions {
    /// an optional direction which is "up" by default
    #[argh(option, short = 'o', default = "String::from(\"public\")")]
    pub outdir: String,

    /// an example in the crate
    #[argh(option)]
    pub example: Option<String>,
}

/// 🛠 Start a development server
#[derive(FromArgs, PartialEq, Debug)]
#[argh(subcommand, name = "develop")]
pub struct DevelopOptions {
    /// an example in the crate
    #[argh(option)]
    pub example: Option<String>,
}