diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2020-05-01 20:33:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-01 15:33:11 -0400 |
commit | 96fd0f4692126516239d61784caf6599aa884844 (patch) | |
tree | 8ebeafc5562297104390da4d0c159940006fc28f /std/manual.md | |
parent | 6661e7e287aa595eccdc8d49940c40953b1f69bc (diff) |
BREAKING: feat(cli/installer): Support guessing the executable name (#5036)
Diffstat (limited to 'std/manual.md')
-rw-r--r-- | std/manual.md | 28 |
1 files changed, 21 insertions, 7 deletions
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 |