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§
- Low level integration with git
- Printing utilities
- Logic for getting the status of submodules
- Submodule data and operations
- Check git version
Structs§
- The
install
command - The main entry point for the library
- Other common options
- Printing options for all commands
- The
remove
command - The
status
command - The
update
command
Enums§
- Subcommands