@@ -54,29 +54,41 @@ await $`mkdir /tmp/${name}`; // <-- string will be safly quoted to: /tmp/'foo ba
54
54
deno install --allow-all -r -f https://deno.land/x/dzx/dzx.ts
55
55
```
56
56
57
- ## Documentation
57
+ ## Usage
58
58
59
59
To start writing a dzx script, add next shebang at the beginning of your script:
60
60
61
61
```
62
62
#!/usr/bin/env dzx
63
63
```
64
64
65
+ ### Javascript
66
+
65
67
Now you will be able to run your script as:
66
68
67
69
``` shell
68
70
chmod +x ./script.js
69
71
./script.js
70
72
```
71
73
72
- If you want to use typescript you need to add a tripple slash reference for the
73
- typings at the top of the file, but not before the shebang line.
74
+ ### Typescript
75
+
76
+ If you want to use typescript you need to add a tripple slash reference to get
77
+ global typings working.
74
78
75
79
```
76
80
#!/usr/bin/env dzx
77
81
/// <reference path="https://deno.land/x/dzx/types.d.ts" />
78
82
```
79
83
84
+ Or you can import all symbol directly from ` dzx/mod.ts ` instead of using
85
+ globals.
86
+
87
+ ``` ts
88
+ #! / usr / bin / env dzx
89
+ import { $ , cd , parseFlags } from " https://deno.land/x/dzx/mod.ts" ;
90
+ ```
91
+
80
92
Now you will be able to run your typescript script the same way as your js
81
93
script:
82
94
@@ -85,14 +97,20 @@ chmod +x ./script.ts
85
97
./script.ts
86
98
```
87
99
88
- You can also import all symbol directly from ` dzx/mod.ts ` instead of using
89
- globals.
100
+ ## Remote usage
90
101
91
- ``` ts
92
- #! / usr / bin / env dzx
93
- import { $ } from " https://deno.land/x/dzx/mod.ts" ;
102
+ You can also use ` dzx ` directly without installation by using the following
103
+ shebang. This also allows you to explicitly set the permissions.
104
+
105
+ ``` typescript
106
+ #! / usr / bin / env deno run -- allow - run -- allow - read -- allow - env https :// deno.land/x/dzx/dzx.ts
107
+ /// <reference path = " https://deno.land/x/dzx/types.d.ts" />
108
+
109
+ console .log (` Hello ${$ .blue .bold (" world" )}! ` );
94
110
```
95
111
112
+ ## API
113
+
96
114
### ` $.verbose `
97
115
98
116
Enable debugging output.
@@ -182,15 +200,6 @@ Deno's `std/flags` module for parsing command-line arguments.
182
200
The quote methods quotes safly a string. by default the ` shq ` package is used.
183
201
Can be overidden with ` $.quote ` .
184
202
185
- ## Remote usage
186
-
187
- ``` typescript
188
- #! / usr / bin / env deno run -- allow - run -- allow - read -- allow - env https :// deno.land/x/dzx/dzx.ts
189
- /// <reference path = " https://deno.land/x/dzx/types.d.ts" />
190
-
191
- console .log (` Hello ${$ .blue .bold (" world" )}! ` );
192
- ```
193
-
194
203
## Contributing
195
204
196
205
Any kind of contribution is welcome!
0 commit comments