Crate magoo

source ·
Expand description

§Magoo

A wrapper for git submodule commands.

§CLI Usage

cargo install magoo
magoo --help

See README for more information.

§Library Usage

cargo add magoo

If you don’t need clap for parsing arguments, you can add --no-default-features to exclude the dependency.

§Examples

§Run a command
use magoo::{StatusCommand, PrintOptions};

let command = magoo::StatusCommand {
    git: true,
    fix: false,
    long: false,
    options: PrintOptions {
        verbose: false,
        quiet: false,
        color: None,
    },
    delete: false,
};

// don't need this if you don't need output to stdout
command.set_print_options();
// runs `magoo status --git` in the current directory
command.run("."); //.unwrap();
§Use clap to parse arguments
use magoo::Magoo;
use clap::Parser;

// for assertion below only
use magoo::{Command, StatusCommand, PrintOptions};

let magoo = Magoo::try_parse_from(["magoo", "--dir", "my/repo", "status", "--long", "--verbose"]).unwrap();

assert_eq!(magoo, Magoo {
    subcmd: Command::Status(StatusCommand {
        git: false,
        fix: false,
        long: true,
        options: PrintOptions {
            verbose: true,
            quiet: false,
            color: None,
        },
        delete: false,
    }),
    dir: "my/repo".to_string(),
});

magoo.set_print_options();
magoo.run(); //.unwrap();

You can also look at main.rs for reference.

Re-exports§

Modules§

  • Low level integration with git
  • Printing utilities
  • Logic for getting the status of submodules
  • Submodule data and operations

Structs§

Enums§