• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tamada / gibo-wrapper / 8949864526

04 May 2024 10:28AM UTC coverage: 65.385% (+21.4%) from 44.014%
8949864526

push

github

web-flow
Merge pull request #10 from tamada/releases/v0.6.0

Releases/v0.6.0

136 of 208 new or added lines in 4 files covered. (65.38%)

136 of 208 relevant lines covered (65.38%)

9.11 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

47.83
/src/cli.rs
1
use clap::{Parser, Subcommand};
2
use std::fmt::{Display, Formatter, Result};
3

4
#[derive(Parser, Debug, PartialEq)]
5
#[clap(
6
    version, author, about,
7
    arg_required_else_help = true,
8
    long_about = "gibo-wrapper acts like gibo and improves gibo by adding the following features.
9
    1. current-list command for dumping the boilerplates while keeping the prologue of .gitignore file.
10
    2. dump command improvements
11
       * append mode: appending the boilerplates into the .gitignore file.
12
       * remove mode: removing the boilerplates from the .gitignore file.
13
       * remove-duplication option removes the duplicated boilerplates names by dumping (-r option).
14
       * keep-prologue option keeps the prologue in the .gitignore (-k option)."
15
)]
16
pub struct CliOpts {
17
    #[clap(subcommand)]
18
    pub(crate) command: GiboCommand,
19
}
20

21
#[derive(Debug, Subcommand, PartialEq)]
22
pub(crate) enum GiboCommand {
23
    #[command(about = "Dump a boilerplate")]
24
    Dump {
25
        #[clap(short, long, default_value_t = false, help = "keep the prologue of the .gitignore")]
1✔
NEW
26
        keep_prologue: bool,
×
27

28
        #[clap(short, long = "remove-duplication", default_value_t = false, help = "remove the duplicated boilerplate names")]
1✔
NEW
29
        remove_duplication: bool,
×
30

31
        #[clap(help = "the boilerplate names to dump")]
32
        args: Vec<String>,
1✔
33
    },
34
    #[command(about = "List available boilerplates")]
35
    List,
36
    #[command(about = "List the current boilerplates in the .gitignore file")]
37
    CurrentList,
38
    #[command(about = "Show the directory where gibo stores its boilerplates")]
39
    Root,
40
    #[command(about = "Search for boilerplates")]
41
    Search,
42
    #[command(about = "Update the gitignore boilerplate repository")]
43
    Update,
44
    #[command(about = "Show the current version number of gibo")]
45
    Version,
46
}
47

48
impl Display for GiboCommand {
NEW
49
    fn fmt(&self, f: &mut Formatter) -> Result {
×
NEW
50
        match self {
×
NEW
51
            GiboCommand::Dump { .. } => write!(f, "dump"),
×
NEW
52
            GiboCommand::List => write!(f, "list"),
×
NEW
53
            GiboCommand::CurrentList => write!(f, "current-list"),
×
NEW
54
            GiboCommand::Root => write!(f, "root"),
×
NEW
55
            GiboCommand::Search => write!(f, "search"),
×
NEW
56
            GiboCommand::Update => write!(f, "update"),
×
NEW
57
            GiboCommand::Version => write!(f, "version"),
×
58
        }
NEW
59
    }
×
60
}
61

62
#[cfg(test)]
63
mod tests {
64
    use super::*;
65

66
    #[test]
67
    fn test_gibo_command() {
1✔
68
        let cli1 = CliOpts::parse_from(&["gibo-wrapper", "dump", "+macos", "linux", "-k", "-r"]);
1✔
69
        assert_eq!(cli1.command, GiboCommand::Dump {
1✔
70
            keep_prologue: true,
1✔
71
            remove_duplication: true,
1✔
72
            args: vec!["+macos".to_string(), "linux".to_string()],
1✔
73
        });
1✔
74
    }
1✔
75
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc