1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

Rename CLI flags to subcommands (#2212)

This commit is contained in:
Bartek Iwańczuk 2019-04-25 20:59:49 +02:00 committed by Ryan Dahl
parent b426ecce80
commit aa85a4d288
2 changed files with 6 additions and 9 deletions

View file

@ -34,14 +34,9 @@ pub fn create_cli_app<'a, 'b>() -> App<'a, 'b> {
.global_settings(&[AppSettings::ColorNever]) .global_settings(&[AppSettings::ColorNever])
.settings(&[ .settings(&[
AppSettings::AllowExternalSubcommands, AppSettings::AllowExternalSubcommands,
AppSettings::DisableHelpSubcommand, AppSettings::DisableVersion,
]).after_help(ENV_VARIABLES_HELP) ]).after_help(ENV_VARIABLES_HELP)
.arg( .arg(
Arg::with_name("version")
.short("v")
.long("version")
.help("Print the version"),
).arg(
Arg::with_name("allow-read") Arg::with_name("allow-read")
.long("allow-read") .long("allow-read")
.help("Allow file system read access"), .help("Allow file system read access"),
@ -95,7 +90,8 @@ pub fn create_cli_app<'a, 'b>() -> App<'a, 'b> {
.use_delimiter(true) .use_delimiter(true)
.require_equals(true) .require_equals(true)
.help("Set V8 command line options"), .help("Set V8 command line options"),
).subcommand( ).subcommand(SubCommand::with_name("version").about("Print the version"))
.subcommand(
SubCommand::with_name("fetch") SubCommand::with_name("fetch")
.setting(AppSettings::DisableVersion) .setting(AppSettings::DisableVersion)
.about("Fetch the dependencies") .about("Fetch the dependencies")
@ -205,7 +201,7 @@ mod tests {
#[test] #[test]
fn test_set_flags_1() { fn test_set_flags_1() {
let flags = flags_from_vec(svec!["deno", "--version"]); let flags = flags_from_vec(svec!["deno", "version"]);
assert_eq!( assert_eq!(
flags, flags,
DenoFlags { DenoFlags {

View file

@ -553,7 +553,6 @@ FLAGS:
--no-prompt Do not use prompts --no-prompt Do not use prompts
-r, --reload Reload source code cache (recompile TypeScript) -r, --reload Reload source code cache (recompile TypeScript)
--v8-options Print V8 command line options --v8-options Print V8 command line options
-v, --version Print the version
OPTIONS: OPTIONS:
--v8-flags=<v8-flags> Set V8 command line options --v8-flags=<v8-flags> Set V8 command line options
@ -563,8 +562,10 @@ SUBCOMMANDS:
eval Eval script eval Eval script
fetch Fetch the dependencies fetch Fetch the dependencies
fmt Format files fmt Format files
help Prints this message or the help of the given subcommand(s)
info Show source file related info info Show source file related info
types Print runtime TypeScript declarations types Print runtime TypeScript declarations
version Print the version
ENVIRONMENT VARIABLES: ENVIRONMENT VARIABLES:
DENO_DIR Set deno's base directory DENO_DIR Set deno's base directory