Add --flip flag to path command

This commit is contained in:
Joscha 2022-10-22 20:46:26 +02:00
parent d5f55d2855
commit a7b9849183

View file

@ -19,6 +19,9 @@ enum Command {
Path { Path {
from: String, from: String,
to: String, to: String,
/// Flip start and end article.
#[clap(short, long)]
flip: bool,
}, },
// Print all page titles. // Print all page titles.
ListPages, ListPages,
@ -36,7 +39,13 @@ fn main() -> io::Result<()> {
match args.command { match args.command {
Command::Ingest => commands::ingest::ingest(&args.datafile), Command::Ingest => commands::ingest::ingest(&args.datafile),
Command::Reexport { to } => commands::reexport::reexport(&args.datafile, &to), Command::Reexport { to } => commands::reexport::reexport(&args.datafile, &to),
Command::Path { from, to } => commands::path::path(&args.datafile, &from, &to), Command::Path { from, to, flip } => {
if flip {
commands::path::path(&args.datafile, &to, &from)
} else {
commands::path::path(&args.datafile, &from, &to)
}
}
Command::ListPages => commands::list_pages::run(&args.datafile), Command::ListPages => commands::list_pages::run(&args.datafile),
} }
} }