mirror of
https://github.com/denoland/deno.git
synced 2025-02-08 07:16:56 -05:00
BREAKING: remove --ts
flag (#25338)
This commit is contained in:
parent
4c35668d90
commit
503f95a54f
1 changed files with 32 additions and 52 deletions
|
@ -2094,8 +2094,9 @@ Show documentation for runtime built-ins:
|
||||||
}
|
}
|
||||||
|
|
||||||
fn eval_subcommand() -> Command {
|
fn eval_subcommand() -> Command {
|
||||||
command("eval",
|
command(
|
||||||
"Evaluate JavaScript from the command line.
|
"eval",
|
||||||
|
"Evaluate JavaScript from the command line.
|
||||||
|
|
||||||
deno eval \"console.log('hello world')\"
|
deno eval \"console.log('hello world')\"
|
||||||
|
|
||||||
|
@ -2103,39 +2104,29 @@ To evaluate as TypeScript:
|
||||||
deno eval --ext=ts \"const v: string = 'hello'; console.log(v)\"
|
deno eval --ext=ts \"const v: string = 'hello'; console.log(v)\"
|
||||||
|
|
||||||
This command has implicit access to all permissions (--allow-all).",
|
This command has implicit access to all permissions (--allow-all).",
|
||||||
UnstableArgsConfig::ResolutionAndRuntime,
|
UnstableArgsConfig::ResolutionAndRuntime,
|
||||||
)
|
)
|
||||||
.defer(|cmd| {
|
.defer(|cmd| {
|
||||||
runtime_args(cmd, false, true)
|
runtime_args(cmd, false, true)
|
||||||
.arg(check_arg(false))
|
.arg(check_arg(false))
|
||||||
.arg(
|
.arg(executable_ext_arg())
|
||||||
// TODO(@satyarohith): remove this argument in 2.0.
|
.arg(
|
||||||
Arg::new("ts")
|
Arg::new("print")
|
||||||
.conflicts_with("ext")
|
.long("print")
|
||||||
.long("ts")
|
.short('p')
|
||||||
.short('T')
|
.help("print result to stdout")
|
||||||
.help("deprecated: Use `--ext=ts` instead. The `--ts` and `-T` flags are deprecated and will be removed in Deno 2.0.")
|
.action(ArgAction::SetTrue),
|
||||||
.action(ArgAction::SetTrue)
|
)
|
||||||
.hide(true),
|
.arg(
|
||||||
)
|
Arg::new("code_arg")
|
||||||
.arg(executable_ext_arg())
|
.num_args(1..)
|
||||||
.arg(
|
.action(ArgAction::Append)
|
||||||
Arg::new("print")
|
.help("Code to evaluate")
|
||||||
.long("print")
|
.value_name("CODE_ARG")
|
||||||
.short('p')
|
.required_unless_present("help"),
|
||||||
.help("print result to stdout")
|
)
|
||||||
.action(ArgAction::SetTrue),
|
.arg(env_file_arg())
|
||||||
)
|
})
|
||||||
.arg(
|
|
||||||
Arg::new("code_arg")
|
|
||||||
.num_args(1..)
|
|
||||||
.action(ArgAction::Append)
|
|
||||||
.help("Code to evaluate")
|
|
||||||
.value_name("CODE_ARG")
|
|
||||||
.required_unless_present("help"),
|
|
||||||
)
|
|
||||||
.arg(env_file_arg())
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fmt_subcommand() -> Command {
|
fn fmt_subcommand() -> Command {
|
||||||
|
@ -4302,21 +4293,6 @@ fn eval_parse(flags: &mut Flags, matches: &mut ArgMatches) {
|
||||||
|
|
||||||
ext_arg_parse(flags, matches);
|
ext_arg_parse(flags, matches);
|
||||||
|
|
||||||
// TODO(@satyarohith): remove this flag in 2.0.
|
|
||||||
let as_typescript = matches.get_flag("ts");
|
|
||||||
|
|
||||||
#[allow(clippy::print_stderr)]
|
|
||||||
if as_typescript {
|
|
||||||
eprintln!(
|
|
||||||
"⚠️ {}",
|
|
||||||
crate::colors::yellow(
|
|
||||||
"Use `--ext=ts` instead. The `--ts` and `-T` flags are deprecated and will be removed in Deno 2.0."
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
flags.ext = Some("ts".to_string());
|
|
||||||
}
|
|
||||||
|
|
||||||
let print = matches.get_flag("print");
|
let print = matches.get_flag("print");
|
||||||
let mut code_args = matches.remove_many::<String>("code_arg").unwrap();
|
let mut code_args = matches.remove_many::<String>("code_arg").unwrap();
|
||||||
let code = code_args.next().unwrap();
|
let code = code_args.next().unwrap();
|
||||||
|
@ -6994,8 +6970,12 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn eval_typescript() {
|
fn eval_typescript() {
|
||||||
let r =
|
let r = flags_from_vec(svec![
|
||||||
flags_from_vec(svec!["deno", "eval", "-T", "'console.log(\"hello\")'"]);
|
"deno",
|
||||||
|
"eval",
|
||||||
|
"--ext=ts",
|
||||||
|
"'console.log(\"hello\")'"
|
||||||
|
]);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
r.unwrap(),
|
r.unwrap(),
|
||||||
Flags {
|
Flags {
|
||||||
|
|
Loading…
Add table
Reference in a new issue