feat(export): CLI, data structures

This commit is contained in:
steven-omaha
2023-06-06 15:30:24 +02:00
parent 3e2a76cae0
commit f527125e59
5 changed files with 34 additions and 7 deletions
+13 -2
View File
@@ -29,7 +29,18 @@ fn get_group_cmd() -> Command {
.required(true)
.help("a previously imported group"),
)
.visible_alias("e");
.visible_alias("ed");
let export = Command::new("export")
.about("export one or more group files")
.arg_required_else_help(true)
.arg(
Arg::new("groups")
.num_args(1..)
.required(true)
.help("the file to export as group"),
)
.visible_alias("ex");
let import = Command::new("import")
.about("import one or more group files")
@@ -86,7 +97,7 @@ fn get_group_cmd() -> Command {
.about("manage groups")
.visible_alias("g")
.subcommand_required(true)
.subcommands([edit, import, list, new, remove, show])
.subcommands([edit, export, import, list, new, remove, show])
}
/// Build the `pacdef package` subcommand.
@@ -8,6 +8,7 @@ pub enum Arguments {
#[derive(Debug)]
pub enum GroupAction {
Edit(Groups),
Export(Groups),
Import(Groups),
List,
New(Groups, Edit),
+1
View File
@@ -17,6 +17,7 @@ fn parse_group_args(args: &clap::ArgMatches) -> GroupAction {
match args.subcommand() {
Some(("edit", args)) => Edit(get_groups(args)),
Some(("export", args)) => Export(get_groups(args)),
Some(("import", args)) => Import(get_groups(args)),
Some(("list", _)) => List,
Some(("new", args)) => New(get_groups(args), get_edit(args)),