Add option for new page to not add the page to config.toml

This commit is contained in:
Sofia 2018-04-17 00:50:28 +03:00
parent 52b2bab5fd
commit 5f2b40ad43
3 changed files with 32 additions and 27 deletions

View File

@ -12,10 +12,10 @@ items = ["about", "other", "google"]
title = "Google!" title = "Google!"
link = "https://google.com" link = "https://google.com"
[navbar.item.about]
title = "About"
link = "/"
[navbar.item.other] [navbar.item.other]
title = "Other" title = "Other"
link = "/other" link = "/other"
[navbar.item.about]
title = "About"
link = "/"

View File

@ -109,6 +109,7 @@ pub fn generate_new_page(ops: NewOps, logger: &Logger) -> Result<(), Error> {
file_writer::write_file(markdown_path, PLACEHOLDER_MARKDOWN, ops.overwrite)?; file_writer::write_file(markdown_path, PLACEHOLDER_MARKDOWN, ops.overwrite)?;
if !ops.no_modify_config {
logger.log( logger.log(
LogLevel::INFO, LogLevel::INFO,
format!("Adding page config path to config.toml"), format!("Adding page config path to config.toml"),
@ -136,6 +137,7 @@ pub fn generate_new_page(ops: NewOps, logger: &Logger) -> Result<(), Error> {
)) ))
} }
} }
}
Ok(()) Ok(())
} }

View File

@ -50,4 +50,7 @@ pub struct NewOps {
/// Overwrites existing .toml / .md files /// Overwrites existing .toml / .md files
#[structopt(short = "o", long = "overwrite")] #[structopt(short = "o", long = "overwrite")]
pub overwrite: bool, pub overwrite: bool,
/// Don't modify config.toml automatically
#[structopt(short = "n", long = "no-modify-config")]
pub no_modify_config: bool,
} }