Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: Add `--verbose` flag to `init`
Alexis Sellier committed 3 years ago
commit be5c9c9258fe8fb8d283cd9d9a2f8b06d12bfa3e
parent c8c44c884cd58c1eff7597d02f1ccf36f70cddf3
4 files changed +12 -7
modified radicle-cli/examples/rad-init-sync.md
@@ -8,11 +8,6 @@ $ rad init --name heartwood --description "Radicle Heartwood Protocol & Stack" -
Initializing local 🌱 project in .

✓ Project heartwood created
-
{
-
  "name": "heartwood",
-
  "description": "Radicle Heartwood Protocol & Stack",
-
  "defaultBranch": "master"
-
}
✓ Syncing inventory..
✓ Announcing inventory..

modified radicle-cli/examples/rad-init.md
@@ -3,7 +3,7 @@ To create your first radicle project, navigate to a git repository, and run
the `init` command:

```
-
$ rad init --name heartwood --description "Radicle Heartwood Protocol & Stack" --no-confirm --no-track
+
$ rad init --name heartwood --description "Radicle Heartwood Protocol & Stack" --no-confirm --no-track -v

Initializing local 🌱 project in .

modified radicle-cli/src/commands/init.rs
@@ -35,6 +35,7 @@ Options
    --setup-signing      Setup the radicle key as a signing key for this repository
    --announce           Announce the new project to the network
    --no-confirm         Don't ask for confirmation during setup
+
    --verbose, -v        Verbose mode
    --help               Print help
"#,
};
@@ -49,6 +50,7 @@ pub struct Options {
    pub setup_signing: bool,
    pub set_upstream: bool,
    pub announce: bool,
+
    pub verbose: bool,
    pub track: bool,
}

@@ -67,6 +69,7 @@ impl Args for Options {
        let mut setup_signing = false;
        let mut announce = false;
        let mut track = true;
+
        let mut verbose = false;

        while let Some(arg) = parser.next()? {
            match arg {
@@ -117,6 +120,9 @@ impl Args for Options {
                Long("no-track") => {
                    track = false;
                }
+
                Long("verbose") | Short('v') => {
+
                    verbose = true;
+
                }
                Long("help") => {
                    return Err(Error::Help.into());
                }
@@ -138,6 +144,7 @@ impl Args for Options {
                setup_signing,
                announce,
                track,
+
                verbose,
            },
            vec![],
        ))
@@ -222,7 +229,9 @@ pub fn init(options: Options, profile: &profile::Profile) -> anyhow::Result<()>
            ));
            spinner.finish();

-
            term::blob(json::to_string_pretty(&proj)?);
+
            if options.verbose {
+
                term::blob(json::to_string_pretty(&proj)?);
+
            }

            if options.set_upstream || git::branch_remote(&repo, proj.default_branch()).is_err() {
                // Setup eg. `master` -> `rad/master`
modified radicle-httpd/src/test.rs
@@ -97,6 +97,7 @@ pub fn seed(dir: &Path) -> Context {
            set_upstream: false,
            announce: false,
            track: false,
+
            verbose: false,
        },
        &profile,
    )