made offline-reveal a global argument (easier for me)*
This commit is contained in:
@@ -22,6 +22,11 @@ pub struct Args {
|
|||||||
/// The directory where the documentation will be built
|
/// The directory where the documentation will be built
|
||||||
#[arg(short, long, global = true)]
|
#[arg(short, long, global = true)]
|
||||||
pub output_dir: Option<String>,
|
pub output_dir: Option<String>,
|
||||||
|
|
||||||
|
/// When set to true, docki will download revealjs before building the documentation.
|
||||||
|
/// Otherwise it will use the cdn for revealjs
|
||||||
|
#[arg(long, global = true)]
|
||||||
|
pub offline_reveal: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
@@ -34,12 +39,7 @@ pub enum ShellArg {
|
|||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
pub enum CommandArg {
|
pub enum CommandArg {
|
||||||
/// Builds the documentation into the specified output_dir
|
/// Builds the documentation into the specified output_dir
|
||||||
Build {
|
Build,
|
||||||
/// When set to true, docki will download revealjs before building the documentation.
|
|
||||||
/// Otherwise it will use the cdn for revealjs
|
|
||||||
#[arg(long)]
|
|
||||||
offline_reveal: bool,
|
|
||||||
},
|
|
||||||
/// Checks if everything required for docki is installed
|
/// Checks if everything required for docki is installed
|
||||||
Health,
|
Health,
|
||||||
/// Deprecated: Helper command for installing asciidoctor-reveal-js
|
/// Deprecated: Helper command for installing asciidoctor-reveal-js
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ pub struct Config {
|
|||||||
pub port: u16,
|
pub port: u16,
|
||||||
pub input_dir: String,
|
pub input_dir: String,
|
||||||
pub offline_reveal: bool,
|
pub offline_reveal: bool,
|
||||||
pub output_dir: String
|
pub output_dir: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
@@ -26,14 +26,8 @@ impl Config {
|
|||||||
_ => self.port,
|
_ => self.port,
|
||||||
},
|
},
|
||||||
input_dir: args.input_dir.clone().unwrap_or(self.input_dir),
|
input_dir: args.input_dir.clone().unwrap_or(self.input_dir),
|
||||||
output_dir: args.output_dir.clone().unwrap_or(self.output_dir),
|
output_dir: args.output_dir.clone().unwrap_or(self.output_dir),
|
||||||
offline_reveal: {
|
offline_reveal: args.offline_reveal || self.offline_reveal,
|
||||||
if let CommandArg::Build { offline_reveal } = args.command {
|
|
||||||
offline_reveal
|
|
||||||
} else {
|
|
||||||
self.offline_reveal
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,7 +37,7 @@ impl Default for Config {
|
|||||||
Self {
|
Self {
|
||||||
port: 8080,
|
port: 8080,
|
||||||
input_dir: "./docs".to_string(),
|
input_dir: "./docs".to_string(),
|
||||||
output_dir: "./dist".to_string(),
|
output_dir: "./dist".to_string(),
|
||||||
offline_reveal: false,
|
offline_reveal: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user