-
-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Merged by Bors] - migrated to clap 3 #1957
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,8 +64,8 @@ use boa_interner::Interner; | |
use colored::{Color, Colorize}; | ||
use rustyline::{config::Config, error::ReadlineError, EditMode, Editor}; | ||
use std::{fs::read, io, path::PathBuf}; | ||
use structopt::{clap::arg_enum, StructOpt}; | ||
|
||
//use structopt::{clap::arg_enum, StructOpt}; | ||
use clap::{ArgEnum, Parser}; | ||
mod helper; | ||
|
||
#[cfg(all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"))] | ||
|
@@ -84,29 +84,29 @@ const READLINE_COLOR: Color = Color::Cyan; | |
// is an optional argument that optionally takes a value ([--opt=[val]]). | ||
// https://docs.rs/structopt/0.3.11/structopt/#type-magic | ||
#[allow(clippy::option_option)] | ||
#[derive(Debug, StructOpt)] | ||
#[structopt(author, about, name = "boa")] | ||
#[derive(Debug, Parser)] | ||
#[clap(author, about, name = "boa")] | ||
struct Opt { | ||
/// The JavaScript file(s) to be evaluated. | ||
#[structopt(name = "FILE", parse(from_os_str))] | ||
#[clap(name = "FILE", parse(from_os_str))] | ||
files: Vec<PathBuf>, | ||
|
||
/// Dump the AST to stdout with the given format. | ||
#[structopt( | ||
#[clap( | ||
long, | ||
short = "a", | ||
short = 'a', | ||
value_name = "FORMAT", | ||
possible_values = &DumpFormat::variants(), | ||
case_insensitive = true | ||
case_insensitive = true, | ||
arg_enum | ||
)] | ||
dump_ast: Option<Option<DumpFormat>>, | ||
|
||
/// Dump the AST to stdout with the given format. | ||
#[structopt(long = "trace", short = "t")] | ||
#[clap(long = "trace", short = 't')] | ||
trace: bool, | ||
|
||
/// Use vi mode in the REPL | ||
#[structopt(long = "vi")] | ||
#[clap(long = "vi")] | ||
vi_mode: bool, | ||
} | ||
|
||
|
@@ -117,6 +117,7 @@ impl Opt { | |
} | ||
} | ||
|
||
/* | ||
arg_enum! { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is no longer needed, can it be removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah i think it should be removed. |
||
/// The different types of format available for dumping. | ||
/// | ||
|
@@ -137,6 +138,14 @@ arg_enum! { | |
// This is a pretty printed json format. | ||
JsonPretty, | ||
} | ||
} **/ | ||
|
||
#[derive(Debug, Clone, ArgEnum)] | ||
#[clap(name = 'a')] | ||
enum DumpFormat { | ||
Debug, | ||
Json, | ||
JsonPretty, | ||
} | ||
|
||
/// Parses the the token stream into an AST and returns it. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is no longer needed, right?