diff --git a/examples/README.md b/examples/README.md index e2f6b2a08c79..351c4a6b4c7c 100644 --- a/examples/README.md +++ b/examples/README.md @@ -16,13 +16,13 @@ deno https://deno.land/std/examples/echo_server.ts --allow-net Or ```shell -deno install echo_server https://deno.land/std/examples/echo_server.ts --allow-net +deno install --allow-net echo_server https://deno.land/std/examples/echo_server.ts ``` ### cat - print file to standard output ```shell -deno install deno_cat https://deno.land/std/examples/cat.ts --allow-read +deno install --allow-read 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 catj https://deno.land/std/examples/catj.ts --allow-read +deno install --allow-read catj 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://den ``` export GIST_TOKEN=ABC # Generate at https://github.com/settings/tokens -deno install gist https://deno.land/std/examples/gist.ts --allow-net --allow-env +deno install --allow-net --allow-env gist https://deno.land/std/examples/gist.ts gist --title "Example gist 1" script.ts gist --t "Example gist 2" script2.ts ``` diff --git a/examples/catj.ts b/examples/catj.ts index ef6fdb02f9a5..7951eeeb0f18 100644 --- a/examples/catj.ts +++ b/examples/catj.ts @@ -4,7 +4,7 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. // Install using `deno install` -// $ deno install catj https://deno.land/std/examples/catj.ts --allow-read +// $ deno install --allow-read catj https://deno.land/std/examples/catj.ts /* eslint-disable @typescript-eslint/no-use-before-define */ import { parse } from "../flags/mod.ts"; diff --git a/http/file_server.ts b/http/file_server.ts index 4510023f7efe..6ec10cd65b30 100755 --- a/http/file_server.ts +++ b/http/file_server.ts @@ -48,7 +48,7 @@ if (serverArgs.h || serverArgs.help) { Serves a local directory in HTTP. INSTALL: - deno install file_server https://deno.land/std/http/file_server.ts --allow-net --allow-read + deno install --allow-net --allow-read file_server https://deno.land/std/http/file_server.ts USAGE: file_server [path] [options] diff --git a/installer/README.md b/installer/README.md index f78c86e914cd..2fc7654ed2b5 100644 --- a/installer/README.md +++ b/installer/README.md @@ -1,89 +1 @@ -# deno_installer - -Install remote or local script as executables. - -## Installation - -`installer` can be installed using itself: - -```sh -deno -A https://deno.land/std/installer/mod.ts deno_installer https://deno.land/std/installer/mod.ts -A -``` - -## Usage - -Install script - -```sh -# remote script -$ deno_installer file_server https://deno.land/std/http/file_server.ts --allow-net --allow-read -> [1/1] Compiling https://deno.land/std/http/file_server.ts -> -> ✅ Successfully installed file_server. -> ~/.deno/bin/file_server - -# local script -$ deno_installer file_server ./deno_std/http/file_server.ts --allow-net --allow-read -> [1/1] Compiling file:///dev/deno_std/http/file_server.ts -> -> ✅ Successfully installed file_server. -> ~/.deno/bin/file_server -``` - -Run installed script: - -```sh -$ file_server -HTTP server listening on http://0.0.0.0:4500/ -``` - -## Custom installation directory - -By default installer uses `~/.deno/bin` to store installed scripts so make sure -it's in your `$PATH`. - -``` -echo 'export PATH="$HOME/.deno/bin:$PATH"' >> ~/.bashrc # change this to your shell -``` - -If you prefer to change installation directory use `-d` or `--dir` flag. - -``` -$ deno_installer --dir /usr/local/bin file_server ./deno_std/http/file_server.ts --allow-net --allow-read -> [1/1] Compiling file:///dev/deno_std/http/file_server.ts -> -> ✅ Successfully installed file_server. -> /usr/local/bin/file_server -``` - -## Update installed script - -```sh -$ deno_installer file_server https://deno.land/std/http/file_server.ts --allow-net --allow-read -> ⚠️ file_server is already installed, do you want to overwrite it? [yN] -> y -> -> [1/1] Compiling file:///dev/deno_std/http/file_server.ts -> -> ✅ Successfully installed file_server. -``` - -Show help - -```sh -$ deno_installer --help -> deno installer - Install remote or local script as executables. - -USAGE: - deno -A https://deno.land/std/installer/mod.ts [OPTIONS] EXE_NAME SCRIPT_URL [FLAGS...] - -ARGS: - EXE_NAME Name for executable - SCRIPT_URL Local or remote URL of script to install - [FLAGS...] List of flags for script, both Deno permission and script specific - flag can be used. - -OPTIONS: - -d, --dir Installation directory path (defaults to ~/.deno/bin) -``` +WARNING: This code is deprecated and std/installer will be removed soon. diff --git a/manual.md b/manual.md index d97e42705609..9ccd0a4fe244 100644 --- a/manual.md +++ b/manual.md @@ -285,7 +285,7 @@ await Deno.remove("request.log"); This one serves a local directory in HTTP. ```bash -deno install file_server https://deno.land/std/http/file_server.ts --allow-net --allow-read +deno install --allow-net --allow-read file_server https://deno.land/std/http/file_server.ts ``` Run it: @@ -821,8 +821,8 @@ Or you could import it into another ES module to consume: Deno provides ability to easily install and distribute executable code via `deno install` command. -`deno install [EXE_NAME] [URL] [FLAGS...]` will install script available at -`URL` with name `EXE_NAME`. +`deno install [FLAGS...] [EXE_NAME] [URL] [SCRIPT_ARGS...]` will install script +available at `URL` with name `EXE_NAME`. This command is a thin wrapper that creates executable shell scripts which invoke `deno` with specified permissions and CLI flags. @@ -830,15 +830,16 @@ invoke `deno` with specified permissions and CLI flags. Example: ```shell -$ deno install file_server https://deno.land/std/http/file_server.ts --allow-net --allow-read +$ deno install --allow-net --allow-read file_server 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 ``` -By default scripts are installed at `$HOME/.deno/bin` and that directory must be -added to the path manually. +By default scripts are installed at `$HOME/.deno/bin` or +`$USERPROFILE/.deno/bin` and one of that directories must be added to the path +manually. ```shell $ echo 'export PATH="$HOME/.deno/bin:$PATH"' >> ~/.bashrc @@ -847,17 +848,16 @@ $ echo 'export PATH="$HOME/.deno/bin:$PATH"' >> ~/.bashrc Installation directory can be changed using `-d/--dir` flag: ```shell -$ deno install --dir /usr/local/bin file_server https://deno.land/std/http/file_server.ts --allow-net --allow-read +$ deno install --allow-net --allow-read --dir /usr/local/bin file_server https://deno.land/std/http/file_server.ts ``` When installing a script you can specify permissions that will be used to run -the script. They are placed after the script URL and can be mixed with any -additional CLI flags you want to pass to the script. +the script. Example: ```shell -$ deno install file_server https://deno.land/std/http/file_server.ts --allow-net --allow-read 8080 +$ deno install --allow-net --allow-read file_server https://deno.land/std/http/file_server.ts 8080 ``` Above command creates an executable called `file_server` that runs with write