-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(debug): Generalize debug commands
This is making room for more debug commands to be added while making them selective disclosure. BREAKING CHANGES: Debug flags have been relocated - `cobalt --list-syntax-themes` -> `cobalt debug highlight themes` - `cobalt --list-syntaxes` -> `cobalt debug highlight syntaxes`
- Loading branch information
Showing
2 changed files
with
41 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use clap; | ||
use cobalt; | ||
|
||
use error::*; | ||
|
||
pub fn debug_command_args() -> clap::App<'static, 'static> { | ||
clap::SubCommand::with_name("debug") | ||
.about("Print site debug information") | ||
.subcommand(clap::SubCommand::with_name("highlight") | ||
.about("Print syntax-highlight information") | ||
.subcommand(clap::SubCommand::with_name("themes")) | ||
.subcommand(clap::SubCommand::with_name("syntaxes"))) | ||
} | ||
|
||
pub fn debug_command(matches: &clap::ArgMatches) -> Result<()> { | ||
match matches.subcommand() { | ||
("highlight", Some(matches)) => { | ||
match matches.subcommand() { | ||
("themes", _) => { | ||
for name in cobalt::list_syntax_themes() { | ||
println!("{}", name); | ||
} | ||
} | ||
("syntaxes", _) => { | ||
for name in cobalt::list_syntaxes() { | ||
println!("{}", name); | ||
} | ||
} | ||
_ => bail!(matches.usage()), | ||
} | ||
} | ||
_ => bail!(matches.usage()), | ||
} | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters