mirror of
https://github.com/fluencelabs/lalrpop
synced 2025-03-28 06:01:02 +00:00
feat: Allow setting out_dir on the command line
This commit is contained in:
parent
82aa6387bd
commit
9c26e5177e
@ -8,6 +8,7 @@ use docopt::Docopt;
|
|||||||
use lalrpop::Configuration;
|
use lalrpop::Configuration;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
|
use std::path::PathBuf;
|
||||||
use std::process;
|
use std::process;
|
||||||
|
|
||||||
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
||||||
@ -62,6 +63,10 @@ fn main1() -> io::Result<()> {
|
|||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(out_dir) = args.arg_out_dir {
|
||||||
|
config.set_out_dir(out_dir);
|
||||||
|
}
|
||||||
|
|
||||||
for arg in args.arg_inputs {
|
for arg in args.arg_inputs {
|
||||||
match config.process_file(&arg) {
|
match config.process_file(&arg) {
|
||||||
Ok(()) => {}
|
Ok(()) => {}
|
||||||
@ -88,6 +93,7 @@ Options:
|
|||||||
-V, --version Print version.
|
-V, --version Print version.
|
||||||
-l, --level LEVEL Set the debug level. (Default: info)
|
-l, --level LEVEL Set the debug level. (Default: info)
|
||||||
Valid values: quiet, info, verbose, debug.
|
Valid values: quiet, info, verbose, debug.
|
||||||
|
-o, --out-dir DIR Sets the directory in which to output the .rs file(s).
|
||||||
-f, --force Force execution, even if the .lalrpop file is older than the .rs file.
|
-f, --force Force execution, even if the .lalrpop file is older than the .rs file.
|
||||||
-c, --color Force colorful output, even if this is not a TTY.
|
-c, --color Force colorful output, even if this is not a TTY.
|
||||||
--comments Enable comments in the generated code.
|
--comments Enable comments in the generated code.
|
||||||
@ -97,6 +103,7 @@ Options:
|
|||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
struct Args {
|
struct Args {
|
||||||
arg_inputs: Vec<String>,
|
arg_inputs: Vec<String>,
|
||||||
|
arg_out_dir: Option<PathBuf>,
|
||||||
flag_level: Option<LevelFlag>,
|
flag_level: Option<LevelFlag>,
|
||||||
flag_force: bool,
|
flag_force: bool,
|
||||||
flag_color: bool,
|
flag_color: bool,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user