Fix build error on no default features
This commit is contained in:
parent
cf2b2af54c
commit
5efaec85b1
|
@ -1,4 +1,4 @@
|
||||||
use clap::{App, ArgMatches, SubCommand};
|
use clap::{arg, App, ArgMatches};
|
||||||
use mdbook::errors::Result;
|
use mdbook::errors::Result;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
|
@ -9,29 +9,29 @@ use syntect::html::ClassStyle;
|
||||||
use syntect::parsing::{SyntaxSet, SyntaxSetBuilder};
|
use syntect::parsing::{SyntaxSet, SyntaxSetBuilder};
|
||||||
|
|
||||||
// Create clap subcommand arguments
|
// Create clap subcommand arguments
|
||||||
pub fn make_subcommand<'a, 'b>() -> App<'a, 'b> {
|
pub fn make_subcommand<'help>() -> App<'help> {
|
||||||
SubCommand::with_name("gen-syntax-cache")
|
App::new("gen-syntax-cache")
|
||||||
.about("Generate syntaxes.bin and css/syntax")
|
.about("Generate syntaxes.bin and css/syntax")
|
||||||
.arg_from_usage(
|
.arg(arg!(-d --"dest-dir" <dir>
|
||||||
"-d, --dest-dir=[dir] 'Output directory for the syntax cache{n}\
|
"Output directory for the syntax cache{n}\
|
||||||
Relative paths are interpreted relative to the current working directory.{n}\
|
Relative paths are interpreted relative to the current working directory.{n}\
|
||||||
If omitted, mdBook uses `.`.
|
If omitted, mdBook uses `.`.
|
||||||
This command outputs files [dir]/syntaxes.bin and [dir]/css/syntax/*.css'",
|
This command outputs files [dir]/syntaxes.bin and [dir]/css/syntax/*.css"
|
||||||
)
|
).required(false))
|
||||||
.arg_from_usage("--syntaxes-only 'Only generate syntaxes.bin, not css/syntax/*.css.'")
|
.arg(arg!(--syntaxes-only "Only generate syntaxes.bin, not css/syntax/*.css."))
|
||||||
.arg_from_usage(
|
.arg(arg!(--no-default-syntaxes
|
||||||
"--no-default-syntaxes 'Don't include Sublime Text's default open source syntaxes{n}\
|
"Don't include Sublime Text's default open source syntaxes{n}\
|
||||||
If included, only syntaxes from [dir] are used.'",
|
If included, only syntaxes from [dir] are used."
|
||||||
)
|
))
|
||||||
.arg_from_usage("--themes-only 'Only generate themes, not syntaxes.bin.'")
|
.arg(arg!(--themes-only "Only generate themes, not syntaxes.bin."))
|
||||||
.arg_from_usage(
|
.arg(arg!(--no-default-themes
|
||||||
"--no-default-themes 'Don't include mdbook's default light, dark, and ayu themes{n}\
|
"Don't include mdbook's default light, dark, and ayu themes{n}\
|
||||||
If included, only themes from [dir] are used.'",
|
If included, only themes from [dir] are used.'"
|
||||||
)
|
))
|
||||||
.arg_from_usage(
|
.arg(arg!([dir]
|
||||||
"[dir] 'Root directory for the syntax sources{n}\
|
"Root directory for the syntax sources{n}\
|
||||||
(Defaults to the Current Directory when omitted)'",
|
(Defaults to the Current Directory when omitted)"
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate Syntax Cache command implementation
|
// Generate Syntax Cache command implementation
|
||||||
|
|
|
@ -34,10 +34,9 @@ fn main() {
|
||||||
#[cfg(feature = "serve")]
|
#[cfg(feature = "serve")]
|
||||||
Some(("serve", sub_matches)) => cmd::serve::execute(sub_matches),
|
Some(("serve", sub_matches)) => cmd::serve::execute(sub_matches),
|
||||||
Some(("test", sub_matches)) => cmd::test::execute(sub_matches),
|
Some(("test", sub_matches)) => cmd::test::execute(sub_matches),
|
||||||
|
#[cfg(feature = "gen-syntax-cache")]
|
||||||
|
Some(("gen-syntax-cache", sub_matches)) => cmd::gen_syntax_cache::execute(sub_matches),
|
||||||
Some(("completions", sub_matches)) => (|| {
|
Some(("completions", sub_matches)) => (|| {
|
||||||
#[cfg(feature = "gen_syntax_cache")]
|
|
||||||
("gen-syntax-cache", Some(sub_matches)) => cmd::gen_syntax_cache::execute(sub_matches),
|
|
||||||
("completions", Some(sub_matches)) => (|| {
|
|
||||||
let shell: Shell = sub_matches
|
let shell: Shell = sub_matches
|
||||||
.value_of("shell")
|
.value_of("shell")
|
||||||
.ok_or_else(|| anyhow!("Shell name missing."))?
|
.ok_or_else(|| anyhow!("Shell name missing."))?
|
||||||
|
|
Loading…
Reference in New Issue