Skip to content

Commit d542389

Browse files
committed
src/bin/tectonic/main.rs: -X option in CLI docs
1 parent 734cb66 commit d542389

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/bin/tectonic/main.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::{env, process, str::FromStr};
66
use structopt::StructOpt;
77
use tectonic_status_base::plain::PlainStatusBackend;
88

9+
use structopt::clap;
910
use tectonic::{
1011
config::PersistentConfig,
1112
errors::SyncError,
@@ -36,6 +37,10 @@ mod v2cli {
3637
#[derive(Debug, StructOpt)]
3738
#[structopt(name = "Tectonic", about = "Process a (La)TeX document")]
3839
struct CliOptions {
40+
/// Use experimental V2 interface (see `tectonic -X --help`); must be the first argument
41+
#[structopt(short = "X")]
42+
use_v2: bool,
43+
3944
/// How much chatter to print when running
4045
#[structopt(long = "chatter", short, name = "level", default_value = "default", possible_values(&["default", "minimal"]))]
4146
chatter_level: String,
@@ -127,6 +132,15 @@ fn main() {
127132
Box::new(PlainStatusBackend::new(chatter_level)) as Box<dyn StatusBackend>
128133
};
129134

135+
if args.use_v2 {
136+
let err = clap::Error::with_description(
137+
"-X option must be the first argument if given",
138+
clap::ErrorKind::ArgumentConflict,
139+
);
140+
status.report_error(&err.into());
141+
process::exit(1)
142+
}
143+
130144
// Now that we've got colorized output, pass off to the inner function ...
131145
// all so that we can print out the word "error:" in red. This code
132146
// parallels various bits of the `error_chain` crate.

0 commit comments

Comments
 (0)