gr/cli/
trending.rs

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
use clap::Parser;

use crate::cmds::trending::TrendingCliArgs;

use super::common::GetArgs;

#[derive(Parser)]
pub struct TrendingCommand {
    #[clap()]
    pub language: String,
    #[clap(flatten)]
    get_args: GetArgs,
}

pub enum TrendingOptions {
    Get(TrendingCliArgs),
}

impl From<TrendingCommand> for TrendingOptions {
    fn from(options: TrendingCommand) -> Self {
        TrendingOptions::Get(TrendingCliArgs {
            language: options.language,
            get_args: options.get_args.into(),
            flush: false,
        })
    }
}

impl From<TrendingOptions> for TrendingCliArgs {
    fn from(options: TrendingOptions) -> Self {
        match options {
            TrendingOptions::Get(args) => args,
        }
    }
}