diff options
author | Kevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com> | 2019-05-01 16:15:37 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-05-01 19:15:36 -0400 |
commit | 1dd30f658fc031dd1d3cdb5b4c435ff0e48740c9 (patch) | |
tree | 097793658d0ddc945834b449f286a9e46b9c48a6 | |
parent | c171813e894f0759abb1b80413aa2a24dbad079b (diff) |
doc: add long about messages for subcommands (#2264)
Type deno <subcommand> -h to view descriptions.
-rw-r--r-- | cli/flags.rs | 69 |
1 files changed, 63 insertions, 6 deletions
diff --git a/cli/flags.rs b/cli/flags.rs index 54a294b2a..b5a3afdab 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -103,31 +103,88 @@ pub fn create_cli_app<'a, 'b>() -> App<'a, 'b> { ).subcommand( SubCommand::with_name("version") .setting(AppSettings::DisableVersion) - .about("Print the version"), + .about("Print the version") + .long_about( + " +Print current version of Deno. + +Includes versions of Deno, V8 JavaScript Engine, and the TypeScript +compiler. +", + ), ).subcommand( SubCommand::with_name("fetch") .setting(AppSettings::DisableVersion) .about("Fetch the dependencies") - .arg(Arg::with_name("file").takes_value(true).required(true)), + .long_about( + " +Fetch and compile remote dependencies recursively. + +Downloads all statically imported scripts and save them in local +cache, without running the code. No future import network requests +would be made unless --reload is specified. + + # Downloads all dependencies + deno fetch https://deno.land/std/http/file_server.ts + # Once cached, static imports no longer send network requests + deno https://deno.land/std/http/file_server.ts +", + ).arg(Arg::with_name("file").takes_value(true).required(true)), ).subcommand( SubCommand::with_name("types") .setting(AppSettings::DisableVersion) - .about("Print runtime TypeScript declarations"), + .about("Print runtime TypeScript declarations") + .long_about( + " +Print runtime TypeScript declarations. + +The declaration file could be saved and used for typing information. + + deno types > lib.deno_runtime.d.ts +", + ), ).subcommand( SubCommand::with_name("info") .setting(AppSettings::DisableVersion) .about("Show source file related info") - .arg(Arg::with_name("file").takes_value(true).required(true)), + .long_about( + " +Show source file related info. + +The following information is shown: + +local: local path of the file. +type: type of script (e.g. JavaScript/TypeScript/JSON) +compiled: (TypeScript only) shown local path of compiled source code. +map: (TypeScript only) shown local path of source map. +deps: dependency tree of the source file. + + deno info myfile.ts +", + ).arg(Arg::with_name("file").takes_value(true).required(true)), ).subcommand( SubCommand::with_name("eval") .setting(AppSettings::DisableVersion) .about("Eval script") - .arg(Arg::with_name("code").takes_value(true).required(true)), + .long_about( + " +Evaluate provided script. + + deno eval 'console.log(\"hello world\")' +", + ).arg(Arg::with_name("code").takes_value(true).required(true)), ).subcommand( SubCommand::with_name("fmt") .setting(AppSettings::DisableVersion) .about("Format files") - .arg( + .long_about( + " +Format given list of files using Prettier. Automatically downloads +Prettier dependencies on first run. + + deno fmt myfile1.ts myfile2.ts +", + ).arg( Arg::with_name("files") .takes_value(true) .multiple(true) |