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
**Main changes**:
1. `cli` renamed to `$`
1. `style` (`ansi-colors`) removed in favour of using “CSS” in `echo`
1. `exit` removed in favour of `$.exit`
1. `$.stdin` (`$.no*`)
* - use {@link echo} instead of `s.echo`, this was changed to `s.ShellString` for easy file writing without logging to console `s.echo("Data").to("file.txt")`.
43
49
* - use {@link s.RunFunction 'run()'}/{@link s.RunAsyncFunction 'runA()'} instead of `s.exec`, because of options for passing arguments in secure way.
44
-
* - use {@link s.DollarFunction '$()'} instead of `s.set()`, because `$()` allows chaining (you can also access config with {@link cli}s `.is_*` keys).
45
-
* - use {@link cli.xdg}`.temp` instead of `s.tempdir()` – the `cli.xdg.*` provides more paths than just temp directory.
50
+
* - use {@link s.DollarFunction '$()'} instead of `s.set()`, because `$()` allows chaining (you can also access config with {@link $}s `.is_*` keys).
51
+
* - use {@link $.xdg}`.temp` instead of `s.tempdir()` – the `$.xdg.*` provides more paths than just temp directory.
46
52
* @category Public
47
53
*/
48
54
export*assfrom'./src/shelljs.d';
49
55
50
-
import*asstylefrom'ansi-colors';
51
-
/**
52
-
* The [doowb/ansi-colors](https://github.com/doowb/ansi-colors) package as `style` namespace.
53
-
* ```js
54
-
* style.theme({ info: style.blue });
55
-
* echo(style.info('Hello world!'));
56
-
* ```
57
-
* @category Public
58
-
*/
59
-
export{style};
60
-
61
56
import*as__fetchfrom'node-fetch';
62
57
/**
63
58
* A wrapper around the [node-fetch](https://www.npmjs.com/package/node-fetch) package.
--global-jsconfig [add] woraround for type checking of non-package scripts
45
-
${style.info('Examples')}:
46
-
${n} script.js
47
-
${n} --help
48
-
${style.info('Usage in scripts')}:
49
-
Just start the file with: ${style.code('#!/usr/bin/env nodejsscript')}
50
-
`);
51
-
exit(0);
61
+
constcss=echo.css(
62
+
"* { margin-left: 2; }",
63
+
".n { color: lightblue; }",
64
+
".v { color: lightgreen; margin-left: 0; }",
65
+
".code { font-style: italic; margin-left: 0; }",
66
+
".H { color: yellow; }",
67
+
".T { margin-left: 4; }"
68
+
);
69
+
echo(`%c${n}@%c${v}`,css.n,css.v);
70
+
echo(`%c${d}`,css.T);
71
+
echo(`%cUsage%c:`,css.H);
72
+
echo(`%c${n} [options] <script>`,css.T);
73
+
echo(`%cOptions%c:`,css.H);
74
+
echo(`%c --version, -v print current ${n} version`,css.T);
75
+
echo("%c --help, -h print help",css.T);
76
+
echo("%c --eval, -e similar to `node -e …`",css.T);
77
+
echo("%c --print, -p similar to `node -p …`, infact (for now?) it wraps argument by `echo` function (splits givent string by ';' and wraps last non-empty part)",css.T);
78
+
echo("%c--global-jsconfig [add] woraround for type checking of non-package scripts",css.T);
0 commit comments