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

tamada / gibo-wrapper / 8978182317

07 May 2024 01:22AM UTC coverage: 57.68% (-13.5%) from 71.2%
8978182317

push

github

web-flow
Merge pull request #13 from tamada/releases/v0.7.0

Releases/v0.7.0

71 of 151 new or added lines in 4 files covered. (47.02%)

6 existing lines in 1 file now uncovered.

184 of 319 relevant lines covered (57.68%)

6.12 hits per line

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

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

22
    #[clap(short, long, help = "Show verbose output")]
NEW
23
    pub(crate) verbose: bool,
×
24
}
25

26
#[derive(Debug, Subcommand, PartialEq)]
27
pub(crate) enum GiboCommand {
28
    #[command(about = "Dump a boilerplate")]
29
    Dump {
30
        #[clap(
31
            short,
32
            long,
33
            default_value_t = false,
1✔
34
            help = "Keep the prologue of the .gitignore"
35
        )]
36
        keep_prologue: bool,
×
37

38
        #[clap(
39
            short,
40
            long = "remove-duplication",
41
            default_value_t = false,
1✔
42
            help = "Remove the duplicated boilerplate names"
43
        )]
44
        remove_duplication: bool,
×
45

46
        #[clap(short, long = "in-place", help = "Update .gitignore files in-place")]
NEW
47
        in_place: bool,
×
48

49
        #[clap(short, long, help = "Show verbose output")]
NEW
50
        verbose: bool,
×
51

52
        #[clap(help = "the boilerplate names to dump")]
53
        args: Vec<String>,
1✔
54
    },
55
    #[command(about = "List available boilerplates")]
56
    List,
57
    #[command(about = "List the current boilerplates in the .gitignore file")]
58
    CurrentList,
59
    #[command(about = "Show the directory where gibo stores its boilerplates")]
60
    Root,
61
    #[command(about = "Search for boilerplates")]
62
    Search,
63
    #[command(about = "Update the gitignore boilerplate repository")]
64
    Update,
65
    #[command(about = "Show the current version number of gibo")]
66
    Version,
67
}
68

69
impl Display for GiboCommand {
70
    fn fmt(&self, f: &mut Formatter) -> Result {
×
71
        match self {
×
72
            GiboCommand::Dump { .. } => write!(f, "dump"),
×
73
            GiboCommand::List => write!(f, "list"),
×
74
            GiboCommand::CurrentList => write!(f, "current-list"),
×
75
            GiboCommand::Root => write!(f, "root"),
×
76
            GiboCommand::Search => write!(f, "search"),
×
77
            GiboCommand::Update => write!(f, "update"),
×
78
            GiboCommand::Version => write!(f, "version"),
×
79
        }
80
    }
×
81
}
82

83
#[cfg(test)]
84
mod tests {
85
    use super::*;
86

87
    #[test]
88
    fn test_gibo_command() {
1✔
89
        let cli1 = CliOpts::parse_from(&["gibo-wrapper", "dump", "+macos", "linux", "-k", "-r"]);
1✔
90
        assert_eq!(
1✔
91
            cli1.command,
1✔
92
            GiboCommand::Dump {
1✔
93
                keep_prologue: true,
1✔
94
                remove_duplication: true,
1✔
95
                in_place: false,
1✔
96
                verbose: false,
1✔
97
                args: vec!["+macos".to_string(), "linux".to_string()],
1✔
98
            }
1✔
99
        );
1✔
100
    }
1✔
101
}
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