From bb304af930d890c926377a0cbc8c7c627075880e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 10 Jul 2019 09:06:31 +0200 Subject: [PATCH 1/6] Rename catjson.ts to catj.ts --- examples/{catjson.ts => catj.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename examples/{catjson.ts => catj.ts} (100%) diff --git a/examples/catjson.ts b/examples/catj.ts similarity index 100% rename from examples/catjson.ts rename to examples/catj.ts From bc16daf042c3e542c55e907bf2071a13459140b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 10 Jul 2019 09:11:25 +0200 Subject: [PATCH 2/6] Update catj.ts --- examples/catj.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/catj.ts b/examples/catj.ts index 010a3506a53c..82fec5ff9eba 100644 --- a/examples/catj.ts +++ b/examples/catj.ts @@ -4,7 +4,7 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // Install using `deno install` -// $ deno install catjson https://deno.land/std/examples/catjson.ts --allow-read +// $ deno install catj https://deno.land/std/examples/catj.ts --allow-read /* eslint-disable @typescript-eslint/no-use-before-define */ import { parse } from "../flags/mod.ts"; @@ -83,15 +83,15 @@ async function main(): Promise { const parsedArgs = parse(Deno.args.slice(1)); if (parsedArgs.h || parsedArgs.help || parsedArgs._.length === 0) { - console.log("Usage: catjson [-h|--help] [file...]"); + console.log("Usage: catj [-h|--help] [file...]"); console.log(); console.log("Examples:"); console.log(); - console.log("// print file:\n catjson file.json"); + console.log("// print file:\n catj file.json"); console.log(); - console.log("// print multiple files:\n catjson file1.json file2.json"); + console.log("// print multiple files:\n catj file1.json file2.json"); console.log(); - console.log("// print from stdin:\n cat file.json | catjson -"); + console.log("// print from stdin:\n cat file.json | catj -"); } if (parsedArgs._[0] === "-") { From b765b5599835ee3fd40a1cbe8b8a54559687f991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 11 Jul 2019 00:44:06 +0200 Subject: [PATCH 3/6] Update README.md --- examples/README.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/examples/README.md b/examples/README.md index c4def7b7cac1..e9948e53bfb0 100644 --- a/examples/README.md +++ b/examples/README.md @@ -5,14 +5,21 @@ These files are accessible for import via "https://deno.land/std/examples/". Try it: ``` -> deno https://deno.land/std/examples/gist.ts README.md +> deno https://deno.land/std/examples/cat.ts README.md ``` -## Alias Based Installation - -Add this to your `.bash_profile` +## Install as executable ``` +deno install gist https://deno.land/examples/gist.ts --allow-net --allow-env export GIST_TOKEN=ABC # Generate at https://github.com/settings/tokens -alias gist="deno --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 +``` + +``` +deno install catj https://deno.land/examples/catj.ts --allow-read +catj example.json +catj file1.json file2.json +echo example.json | catj - ``` From 1c3807e8f7592ea4ee43e72e8c0dd729c3695182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 11 Jul 2019 00:54:18 +0200 Subject: [PATCH 4/6] Update README.md --- examples/README.md | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/examples/README.md b/examples/README.md index e9948e53bfb0..17ec2af58b2a 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,25 +1,34 @@ -# Deno Example Programs +# Deno example programs -These files are accessible for import via "https://deno.land/std/examples/". - -Try it: +This module contains small scripts that demonstrate use of Deno and its standard library. You can run these examples by importing them via `deno` command: ``` -> deno https://deno.land/std/examples/cat.ts README.md +> deno https://deno.land/std/examples/echo_server.ts --allow-net ``` -## Install as executable +Some of them are useful CLI programs that can be installed as executables: +`cat.ts` - print file to standard output ``` -deno install gist https://deno.land/examples/gist.ts --allow-net --allow-env -export GIST_TOKEN=ABC # Generate at https://github.com/settings/tokens -gist --title "Example gist 1" script.ts -gist --t "Example gist 2" script2.ts +deno install deno_cat https://deno.land/examples.cat.ts --allow-read +deno_cat file.txt ``` +`catj.ts` - pretty print JSON to standard output ``` deno install catj https://deno.land/examples/catj.ts --allow-read catj example.json catj file1.json file2.json echo example.json | catj - ``` + + +`gist.ts` - easily create and upload Gists + +``` +deno install gist https://deno.land/examples/gist.ts --allow-net --allow-env +export GIST_TOKEN=ABC # Generate at https://github.com/settings/tokens +gist --title "Example gist 1" script.ts +gist --t "Example gist 2" script2.ts +``` + From a85fa1c7da6d4879973d2edc97584b60200ad3de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 11 Jul 2019 11:31:32 +0200 Subject: [PATCH 5/6] Update README.md --- examples/README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/README.md b/examples/README.md index 17ec2af58b2a..f89a7725c2de 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,6 +1,8 @@ # Deno example programs -This module contains small scripts that demonstrate use of Deno and its standard library. You can run these examples by importing them via `deno` command: +This module contains small scripts that demonstrate use of Deno and its standard library. + +You can run these examples by importing them via `deno` command: ``` > deno https://deno.land/std/examples/echo_server.ts --allow-net @@ -9,12 +11,14 @@ This module contains small scripts that demonstrate use of Deno and its standard Some of them are useful CLI programs that can be installed as executables: `cat.ts` - print file to standard output + ``` deno install deno_cat https://deno.land/examples.cat.ts --allow-read deno_cat file.txt ``` -`catj.ts` - pretty print JSON to standard output +`catj.ts` - print flattened JSON to standard output + ``` deno install catj https://deno.land/examples/catj.ts --allow-read catj example.json @@ -22,7 +26,6 @@ catj file1.json file2.json echo example.json | catj - ``` - `gist.ts` - easily create and upload Gists ``` From cf2a30b48279c7c6bd275da22058893f5d27adff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 11 Jul 2019 11:35:27 +0200 Subject: [PATCH 6/6] fmt --- examples/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/README.md b/examples/README.md index f89a7725c2de..6a4924f5d20d 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,6 +1,6 @@ # Deno example programs -This module contains small scripts that demonstrate use of Deno and its standard library. +This module contains small scripts that demonstrate use of Deno and its standard library. You can run these examples by importing them via `deno` command: @@ -13,7 +13,7 @@ Some of them are useful CLI programs that can be installed as executables: `cat.ts` - print file to standard output ``` -deno install deno_cat https://deno.land/examples.cat.ts --allow-read +deno install deno_cat https://deno.land/examples.cat.ts --allow-read deno_cat file.txt ``` @@ -34,4 +34,3 @@ export GIST_TOKEN=ABC # Generate at https://github.com/settings/tokens gist --title "Example gist 1" script.ts gist --t "Example gist 2" script2.ts ``` -