Use clap for git-edit-coauthor

This commit is contained in:
Martin Frost 2021-12-11 00:16:50 +01:00
parent 2009e9335a
commit 2a4bcd896e
1 changed files with 6 additions and 6 deletions

View File

@ -1,23 +1,23 @@
use clap::Parser;
use git_mob::{get_available_coauthors, write_coauthors_file, Author}; use git_mob::{get_available_coauthors, write_coauthors_file, Author};
use std::process; use std::process;
use structopt::StructOpt;
#[derive(StructOpt, Debug)] #[derive(Parser, Debug)]
#[structopt(name="git-edit-coauthor")] #[clap(name = "git-edit-coauthor", version)]
/// Edit a co-author in your .git-coauthors template /// Edit a co-author in your .git-coauthors template
struct Opt { struct Opt {
/// Co-author initials /// Co-author initials
initials: String, initials: String,
/// The name of the co-author, in quotes, e.g. "Foo Bar" /// The name of the co-author, in quotes, e.g. "Foo Bar"
#[structopt(long, required_unless("email"))] #[clap(long, required_unless_present("email"))]
name: Option<String>, name: Option<String>,
/// The email of the co-author /// The email of the co-author
#[structopt(long, required_unless("name"))] #[clap(long, required_unless_present("name"))]
email: Option<String>, email: Option<String>,
} }
fn main() { fn main() {
let opt = Opt::from_args(); let opt = Opt::parse();
let mut authors = get_available_coauthors(); let mut authors = get_available_coauthors();
let mut updated_author: Author; let mut updated_author: Author;