summaryrefslogtreecommitdiffstats
path: root/vendor/mdbook/src/cmd/clean.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /vendor/mdbook/src/cmd/clean.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/mdbook/src/cmd/clean.rs')
-rw-r--r--vendor/mdbook/src/cmd/clean.rs26
1 files changed, 7 insertions, 19 deletions
diff --git a/vendor/mdbook/src/cmd/clean.rs b/vendor/mdbook/src/cmd/clean.rs
index 0569726e1..3ec605fea 100644
--- a/vendor/mdbook/src/cmd/clean.rs
+++ b/vendor/mdbook/src/cmd/clean.rs
@@ -1,28 +1,16 @@
+use super::command_prelude::*;
use crate::get_book_dir;
use anyhow::Context;
-use clap::{arg, App, Arg, ArgMatches};
use mdbook::MDBook;
use std::fs;
+use std::path::PathBuf;
// Create clap subcommand arguments
-pub fn make_subcommand<'help>() -> App<'help> {
- App::new("clean")
+pub fn make_subcommand() -> Command {
+ Command::new("clean")
.about("Deletes a built book")
- .arg(
- Arg::new("dest-dir")
- .short('d')
- .long("dest-dir")
- .value_name("dest-dir")
- .help(
- "Output directory for the book{n}\
- Relative paths are interpreted relative to the book's root directory.{n}\
- If omitted, mdBook uses build.build-dir from book.toml or defaults to `./book`.",
- ),
- )
- .arg(arg!([dir]
- "Root directory for the book{n}\
- (Defaults to the Current Directory when omitted)"
- ))
+ .arg_dest_dir()
+ .arg_root_dir()
}
// Clean command implementation
@@ -30,7 +18,7 @@ pub fn execute(args: &ArgMatches) -> mdbook::errors::Result<()> {
let book_dir = get_book_dir(args);
let book = MDBook::load(&book_dir)?;
- let dir_to_remove = match args.value_of("dest-dir") {
+ let dir_to_remove = match args.get_one::<PathBuf>("dest-dir") {
Some(dest_dir) => dest_dir.into(),
None => book.root.join(&book.config.build.build_dir),
};