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(".", &Default::default()); //.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(),
    common: Default::default(),
});

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

You can also look at main.rs for reference.

Modules§

git
Low level integration with git
print
Printing utilities
status
Logic for getting the status of submodules
submodule
Submodule data and operations
version
Check git version

Structs§

InstallCommand
The install command
Magoo
The main entry point for the library
OtherOptions
Other common options
PrintOptions
Printing options for all commands
RemoveCommand
The remove command
StatusCommand
The status command
UpdateCommand
The update command

Enums§

Command
Subcommands