You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1.you need nodejs >=v17.0.1 ⇒ follow [nvm-sh/nvm: Node Version Manager](https://github.com/nvm-sh/nvm)[^node]
27
+
1.tested/used on *NodeJS*: `node@v16.13.0` and `node@v17.9.1` ⇒ for installation follow [nvm-sh/nvm: Node Version Manager](https://github.com/nvm-sh/nvm)[^OR]
Function similar to [Ramda `R.pipe`](https://ramdajs.com/docs/#pipe)). Provides functional way to combine commands/functions.
96
-
97
-
```js
98
-
pipe(
99
-
Number,
100
-
v=>style.greenBright(v+1),
101
-
v=>`Result is: ${v}`,
102
-
echo
103
-
)(awaitquestion("Choose number:"));
104
-
```
105
-
106
-
### `cli()`
107
-
A wrapper around the [lukeed/sade: Smooth (CLI) Operator 🎶](https://github.com/lukeed/sade) package.
108
-
In addition to the origin, `cli()` supports to fill script name from script file name.
109
-
This should be good balance between [commander - npm](https://www.npmjs.com/package/commander) and parsing arguments and writing help texts by hand.
110
-
For more complex scripts just create full npm package.
111
-
112
-
```js
113
-
cli("", true)
114
-
.version("0.1.0")
115
-
.describe("NodeJS Script cli test")
116
-
.action(echo);
117
-
```
118
-
119
-
### `fetch()`
120
-
A wrapper around the [node-fetch](https://www.npmjs.com/package/node-fetch) package.
121
-
122
-
```js
123
-
constresp=awaitfetch('https://medv.io')
124
-
```
125
-
126
-
### `question()`
127
-
A wrapper around the [readline](https://nodejs.org/api/readline.html) package.
128
-
129
-
```js
130
-
constbear=awaitquestion('What kind of bear is best? ')
131
-
```
132
-
133
-
### `echo()`
134
-
A `console.log()` alternative optimized for scripting.
135
-
136
-
```js
137
-
constbranch=exec$("git branch --show-current");
138
-
echo('Current branch is', branch);
139
-
```
140
-
141
-
### `stdin()`
142
-
Returns the stdin as a string.
143
-
144
-
```js
145
-
constcontent=JSON.parse(awaitstdin());
146
-
```
147
-
148
-
### `config`
149
-
Read/write global configuration.
150
-
151
-
-`silent`[`false`]: Suppresses all command output if `true`, except for `echo()` call.
152
-
-`verbose`[`false`]: Will print each executed command to the screen.
153
-
-`fatal`[`false`]: If `true`, the script will throw a JavaScript error when any `shell.js` command encounters an error. This is analogous to Bash's `set -e`.
0 commit comments