diff --git a/guide/src/cli/init.md b/guide/src/cli/init.md index a0a407c5..d3b82cc7 100644 --- a/guide/src/cli/init.md +++ b/guide/src/cli/init.md @@ -52,3 +52,8 @@ directory called `theme` in your source directory so that you can modify it. The theme is selectively overwritten, this means that if you don't want to overwrite a specific file, just delete it and the default file will be used. + +#### --theme-only + +Optionally you can use `--theme-only` flag, only the default theme will be copied into a +directory called `theme` in your source directory so that you can modify it. diff --git a/src/book/init.rs b/src/book/init.rs index 264c113d..d026fcf9 100644 --- a/src/book/init.rs +++ b/src/book/init.rs @@ -106,7 +106,9 @@ impl BookBuilder { Ok(()) } - fn copy_across_theme(&self) -> Result<()> { + /// Copies the theme to the generated book (so users can tweak + /// it)? + pub fn copy_across_theme(&self) -> Result<()> { debug!("Copying theme"); let html_config = self.config.html_config().unwrap_or_default(); diff --git a/src/cmd/init.rs b/src/cmd/init.rs index cccc1671..62ce971c 100644 --- a/src/cmd/init.rs +++ b/src/cmd/init.rs @@ -17,6 +17,7 @@ pub fn make_subcommand<'a, 'b>() -> App<'a, 'b> { (Defaults to the Current Directory when omitted)'", ) .arg_from_usage("--theme 'Copies the default theme into your source folder'") + .arg_from_usage("--theme-only 'Copies only the default theme into your source folder'") .arg_from_usage("--force 'Skips confirmation prompts'") } @@ -27,7 +28,10 @@ pub fn execute(args: &ArgMatches) -> Result<()> { let mut config = config::Config::default(); // If flag `--theme` is present, copy theme to src - if args.is_present("theme") { + if args.is_present("theme-only") { + builder.copy_across_theme(); + return Ok(()); + } else if args.is_present("theme") { let theme_dir = book_dir.join("theme"); println!(); println!("Copying the default theme to {}", theme_dir.display());