Skip to content

Commit 5e8c607

Browse files
committed
add a manual contact add command
1 parent 914465b commit 5e8c607

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/main.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ fn main() -> Result<()> {
3434
)
3535
.subcommand(
3636
Command::new("add")
37+
.about("Manually add a contacts email id and full name.")
38+
.arg(Arg::new("email").required(true))
39+
.arg(Arg::new("fullname")),
40+
)
41+
.subcommand(
42+
Command::new("add-email")
3743
.about("Take mail from stdin, add sender to contacts. Print filename."),
3844
)
3945
.subcommand(
@@ -73,7 +79,14 @@ fn main() -> Result<()> {
7379
cli::email_query(&config, value)?
7480
}
7581
}
76-
Some(("add", _)) => {
82+
Some(("add", args)) => {
83+
let contact = utils::Contact::generate(
84+
args.value_of("fullname"),
85+
args.value_of("email"),
86+
&config.vdir_path);
87+
contact.write_create()?;
88+
}
89+
Some(("add-email", _)) => {
7790
let stdin = io::stdin();
7891
let mut email = String::new();
7992
stdin.lock().read_to_string(&mut email)?;

0 commit comments

Comments
 (0)