1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-26 16:09:27 -05:00

document "deno run -" (#6256)

This commit is contained in:
Jaap Aarts 2020-06-12 16:59:51 +02:00 committed by GitHub
parent 93573afe82
commit 3eee961473
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 3 deletions

View file

@ -1037,9 +1037,9 @@ fn run_subcommand<'a, 'b>() -> App<'a, 'b> {
run_test_args(SubCommand::with_name("run")) run_test_args(SubCommand::with_name("run"))
.setting(AppSettings::TrailingVarArg) .setting(AppSettings::TrailingVarArg)
.arg(script_arg()) .arg(script_arg())
.about("Run a program given a filename or url to the module") .about("Run a program given a filename or url to the module. Use '-' as a filename to read from stdin.")
.long_about( .long_about(
"Run a program given a filename or url to the module. "Run a program given a filename or url to the module.
By default all programs are run in sandbox without access to disk, network or By default all programs are run in sandbox without access to disk, network or
ability to spawn subprocesses. ability to spawn subprocesses.
@ -1052,7 +1052,10 @@ Grant permission to read from disk and listen to network:
deno run --allow-read --allow-net https://deno.land/std/http/file_server.ts deno run --allow-read --allow-net https://deno.land/std/http/file_server.ts
Grant permission to read whitelisted files from disk: Grant permission to read whitelisted files from disk:
deno run --allow-read=/etc https://deno.land/std/http/file_server.ts", deno run --allow-read=/etc https://deno.land/std/http/file_server.ts
Deno allows specifying the filename '-' to read the file from stdin.
curl https://deno.land/std/examples/welcome.ts | target/debug/deno run -",
) )
} }

View file

@ -29,6 +29,18 @@ deno bundle --help
Detailed guides to each subcommand can be found [here](../tools.md). Detailed guides to each subcommand can be found [here](../tools.md).
### Script source
Deno can grab the scripts from multiple sources, a filename, a url, and '-' to
read the file from stdin. The later is useful for integration with other
applications.
```shell
deno run main.ts
deno run https://mydomain.com/main.ts
cat main.ts | deno run -
```
### Script arguments ### Script arguments
Separately from the Deno runtime flags, you can pass user-space arguments to the Separately from the Deno runtime flags, you can pass user-space arguments to the