-
Notifications
You must be signed in to change notification settings - Fork 623
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
67641b8
commit 2f4846f
Showing
2 changed files
with
30 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,36 @@ | ||
# Deno Example Programs | ||
# Deno example programs | ||
|
||
These files are accessible for import via "https://deno.land/std/examples/". | ||
This module contains small scripts that demonstrate use of Deno and its standard library. | ||
|
||
Try it: | ||
You can run these examples by importing them via `deno` command: | ||
|
||
``` | ||
> deno https://deno.land/std/examples/gist.ts README.md | ||
> deno https://deno.land/std/examples/echo_server.ts --allow-net | ||
``` | ||
|
||
## Alias Based Installation | ||
Some of them are useful CLI programs that can be installed as executables: | ||
|
||
Add this to your `.bash_profile` | ||
`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` - print flattened 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 | ||
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters