diff options
Diffstat (limited to 'std')
| -rw-r--r-- | std/examples/README.md | 8 | ||||
| -rw-r--r-- | std/examples/catj.ts | 2 | ||||
| -rwxr-xr-x | std/http/file_server.ts | 2 | ||||
| -rw-r--r-- | std/manual.md | 28 |
4 files changed, 27 insertions, 13 deletions
diff --git a/std/examples/README.md b/std/examples/README.md index ea85da542..1c47d258e 100644 --- a/std/examples/README.md +++ b/std/examples/README.md @@ -16,13 +16,13 @@ deno --allow-net https://deno.land/std/examples/echo_server.ts Or ```shell -deno install --allow-net echo_server https://deno.land/std/examples/echo_server.ts +deno install --allow-net https://deno.land/std/examples/echo_server.ts ``` ### cat - print file to standard output ```shell -deno install --allow-read deno_cat https://deno.land/std/examples/cat.ts +deno install --allow-read -n deno_cat https://deno.land/std/examples/cat.ts deno_cat file.txt ``` @@ -31,7 +31,7 @@ deno_cat file.txt A very useful command by Soheil Rashidi ported to Deno. ```shell -deno install --allow-read catj https://deno.land/std/examples/catj.ts +deno install --allow-read https://deno.land/std/examples/catj.ts catj example.json catj file1.json file2.json echo example.json | catj - @@ -47,7 +47,7 @@ deno --allow-net=deno.land https://deno.land/std/examples/curl.ts https://deno.l ``` export GIST_TOKEN=ABC # Generate at https://github.com/settings/tokens -deno install --allow-net --allow-env gist https://deno.land/std/examples/gist.ts +deno install --allow-net --allow-env https://deno.land/std/examples/gist.ts gist --title "Example gist 1" script.ts gist --t "Example gist 2" script2.ts ``` diff --git a/std/examples/catj.ts b/std/examples/catj.ts index 3ef14ce0b..bb2e9051b 100644 --- a/std/examples/catj.ts +++ b/std/examples/catj.ts @@ -4,7 +4,7 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. // Install using `deno install` -// $ deno install --allow-read catj https://deno.land/std/examples/catj.ts +// $ deno install --allow-read https://deno.land/std/examples/catj.ts /* eslint-disable @typescript-eslint/no-use-before-define */ import { parse } from "../flags/mod.ts"; diff --git a/std/http/file_server.ts b/std/http/file_server.ts index cc92e0d47..ded930db5 100755 --- a/std/http/file_server.ts +++ b/std/http/file_server.ts @@ -63,7 +63,7 @@ if (serverArgs.h ?? serverArgs.help) { Serves a local directory in HTTP. INSTALL: - deno install --allow-net --allow-read file_server https://deno.land/std/http/file_server.ts + deno install --allow-net --allow-read https://deno.land/std/http/file_server.ts USAGE: file_server [path] [options] diff --git a/std/manual.md b/std/manual.md index d1cd56e79..29abe2c66 100644 --- a/std/manual.md +++ b/std/manual.md @@ -289,7 +289,7 @@ await Deno.remove("request.log"); This one serves a local directory in HTTP. ```bash -deno install --allow-net --allow-read file_server https://deno.land/std/http/file_server.ts +deno install --allow-net --allow-read https://deno.land/std/http/file_server.ts ``` Run it: @@ -876,8 +876,8 @@ Or you could import it into another ES module to consume: Deno provides `deno install` to easily install and distribute executable code. -`deno install [FLAGS...] [EXE_NAME] [URL] [SCRIPT_ARGS...]` will install the -script available at `URL` under the name `EXE_NAME`. +`deno install [OPTIONS...] [URL] [SCRIPT_ARGS...]` will install the script +available at `URL` under the name `EXE_NAME`. This command creates a thin, executable shell script which invokes `deno` using the specified CLI flags and main module. It is place in the installation root's @@ -886,17 +886,31 @@ the specified CLI flags and main module. It is place in the installation root's Example: ```shell -$ deno install --allow-net --allow-read file_server https://deno.land/std/http/file_server.ts +$ deno install --allow-net --allow-read https://deno.land/std/http/file_server.ts [1/1] Compiling https://deno.land/std/http/file_server.ts ✅ Successfully installed file_server. /Users/deno/.deno/bin/file_server ``` +To change the executable name, use `-n`/`--name`: + +```shell + deno install --allow-net --allow-read -n serve https://deno.land/std/http/file_server.ts +``` + +The executable name is inferred by default: + +- Attempt to take the file stem of the URL path. The above example would become + 'file_server'. +- If the file stem is something generic like 'main', 'mod', 'index' or 'cli', + and the path has no parent, take the file name of the parent path. Otherwise + settle with the generic name. + To change the installation root, use `--root`: ```shell -$ deno install --allow-net --allow-read --root /usr/local file_server https://deno.land/std/http/file_server.ts +$ deno install --allow-net --allow-read --root /usr/local https://deno.land/std/http/file_server.ts ``` The installation root is determined, in order of precedence: @@ -915,7 +929,7 @@ You must specify permissions that will be used to run the script at installation time. ```shell -$ deno install --allow-net --allow-read file_server https://deno.land/std/http/file_server.ts 8080 +$ deno install --allow-net --allow-read https://deno.land/std/http/file_server.ts 8080 ``` The above command creates an executable called `file_server` that runs with @@ -944,7 +958,7 @@ example installation command to your repository: ```shell # Install using deno install -$ deno install awesome_cli https://example.com/awesome/cli.ts +$ deno install -n awesome_cli https://example.com/awesome/cli.ts ``` ## Proxies |
