mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
fix(docs): add missing "deno run" (#5126)
This commit is contained in:
parent
34ec3b2254
commit
761b7efb3b
8 changed files with 17 additions and 17 deletions
2
cli/js/lib.deno.ns.d.ts
vendored
2
cli/js/lib.deno.ns.d.ts
vendored
|
@ -1718,7 +1718,7 @@ declare namespace Deno {
|
|||
/** Returns the script arguments to the program. If for example we run a
|
||||
* program:
|
||||
*
|
||||
* deno --allow-read https://deno.land/std/examples/cat.ts /etc/passwd
|
||||
* deno run --allow-read https://deno.land/std/examples/cat.ts /etc/passwd
|
||||
*
|
||||
* Then `Deno.args` will contain:
|
||||
*
|
||||
|
|
|
@ -85,5 +85,5 @@ cargo build -vv
|
|||
cargo clean && cargo build -vv
|
||||
|
||||
# Run:
|
||||
./target/debug/deno cli/tests/002_hello.ts
|
||||
./target/debug/deno run cli/tests/002_hello.ts
|
||||
```
|
||||
|
|
|
@ -15,7 +15,7 @@ If you omit the out file, the bundle will be sent to `stdout`.
|
|||
The bundle can just be run as any other module in Deno would:
|
||||
|
||||
```
|
||||
deno colors.bundle.js
|
||||
deno run colors.bundle.js
|
||||
```
|
||||
|
||||
The output is a self contained ES Module, where any exports from the main module
|
||||
|
|
|
@ -10,7 +10,7 @@ bookmark to a program.)
|
|||
### A TCP echo server
|
||||
|
||||
```shell
|
||||
deno --allow-net https://deno.land/std/examples/echo_server.ts
|
||||
deno run --allow-net https://deno.land/std/examples/echo_server.ts
|
||||
```
|
||||
|
||||
Or
|
||||
|
@ -40,7 +40,7 @@ echo example.json | catj -
|
|||
### curl - print the contents of a url to standard output
|
||||
|
||||
```shell
|
||||
deno --allow-net=deno.land https://deno.land/std/examples/curl.ts https://deno.land/
|
||||
deno run --allow-net=deno.land https://deno.land/std/examples/curl.ts https://deno.land/
|
||||
```
|
||||
|
||||
### gist - easily create and upload Gists
|
||||
|
@ -55,7 +55,7 @@ gist --t "Example gist 2" script2.ts
|
|||
### chat - WebSocket chat server and browser client
|
||||
|
||||
```shell
|
||||
deno --allow-net --allow-read https://deno.land/std/examples/chat/server.ts
|
||||
deno run --allow-net --allow-read https://deno.land/std/examples/chat/server.ts
|
||||
```
|
||||
|
||||
Open http://localhost:8080 on the browser.
|
||||
|
|
|
@ -14,16 +14,16 @@ const HELP_MSG = `xeval
|
|||
Run a script for each new-line or otherwise delimited chunk of standard input.
|
||||
|
||||
Print all the usernames in /etc/passwd:
|
||||
cat /etc/passwd | deno -A https://deno.land/std/examples/xeval.ts "a = $.split(':'); if (a) console.log(a[0])"
|
||||
cat /etc/passwd | deno run -A https://deno.land/std/examples/xeval.ts "a = $.split(':'); if (a) console.log(a[0])"
|
||||
|
||||
A complicated way to print the current git branch:
|
||||
git branch | deno -A https://deno.land/std/examples/xeval.ts -I 'line' "if (line.startsWith('*')) console.log(line.slice(2))"
|
||||
git branch | deno run -A https://deno.land/std/examples/xeval.ts -I 'line' "if (line.startsWith('*')) console.log(line.slice(2))"
|
||||
|
||||
Demonstrates breaking the input up by space delimiter instead of by lines:
|
||||
cat LICENSE | deno -A https://deno.land/std/examples/xeval.ts -d " " "if ($ === 'MIT') console.log('MIT licensed')",
|
||||
cat LICENSE | deno run -A https://deno.land/std/examples/xeval.ts -d " " "if ($ === 'MIT') console.log('MIT licensed')",
|
||||
|
||||
USAGE:
|
||||
deno -A https://deno.land/std/examples/xeval.ts [OPTIONS] <code>
|
||||
deno run -A https://deno.land/std/examples/xeval.ts [OPTIONS] <code>
|
||||
OPTIONS:
|
||||
-d, --delim <delim> Set delimiter, defaults to newline
|
||||
-I, --replvar <replvar> Set variable name to be used in eval, defaults to $
|
||||
|
|
|
@ -12,12 +12,12 @@ console.dir(parse(args));
|
|||
```
|
||||
|
||||
```
|
||||
$ deno example.ts -a beep -b boop
|
||||
$ deno run example.ts -a beep -b boop
|
||||
{ _: [], a: 'beep', b: 'boop' }
|
||||
```
|
||||
|
||||
```
|
||||
$ deno example.ts -x 3 -y 4 -n5 -abc --beep=boop foo bar baz
|
||||
$ deno run example.ts -x 3 -y 4 -n5 -abc --beep=boop foo bar baz
|
||||
{ _: [ 'foo', 'bar', 'baz' ],
|
||||
x: 3,
|
||||
y: 4,
|
||||
|
@ -60,11 +60,11 @@ options can be:
|
|||
import { parse } from "https://deno.land/std/flags/mod.ts";
|
||||
// options['--'] is now set to false
|
||||
console.dir(parse(args, { "--": false }));
|
||||
// $ deno example.ts -- a arg1
|
||||
// $ deno run example.ts -- a arg1
|
||||
// output: { _: [ "example.ts", "a", "arg1" ] }
|
||||
// options['--'] is now set to true
|
||||
console.dir(parse(args, { "--": true }));
|
||||
// $ deno example.ts -- a arg1
|
||||
// $ deno run example.ts -- a arg1
|
||||
// output: { _: [ "example.ts" ], --: [ "a", "arg1" ] }
|
||||
```
|
||||
- `options.unknown` - a function which is invoked with a command line parameter
|
||||
|
|
|
@ -18,11 +18,11 @@ export interface ArgParsingOptions {
|
|||
* import { parse } from "https://deno.land/std/flags/mod.ts";
|
||||
* // options['--'] is now set to false
|
||||
* console.dir(parse(args, { "--": false }));
|
||||
* // $ deno example.ts -- a arg1
|
||||
* // $ deno run example.ts -- a arg1
|
||||
* // output: { _: [ "example.ts", "a", "arg1" ] }
|
||||
* // options['--'] is now set to true
|
||||
* console.dir(parse(args, { "--": true }));
|
||||
* // $ deno example.ts -- a arg1
|
||||
* // $ deno run example.ts -- a arg1
|
||||
* // output: { _: [ "example.ts" ], --: [ "a", "arg1" ] }
|
||||
*
|
||||
* Defaults to `false`.
|
||||
|
|
|
@ -14,7 +14,7 @@ for await (const req of s) {
|
|||
A small program for serving local files over HTTP
|
||||
|
||||
```sh
|
||||
deno --allow-net --allow-read https://deno.land/std/http/file_server.ts
|
||||
deno run --allow-net --allow-read https://deno.land/std/http/file_server.ts
|
||||
> HTTP server listening on http://0.0.0.0:4500/
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in a new issue