terminal-image-cli 1.1.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +23 -21
- package/package.json +12 -11
- package/readme.md +4 -4
package/cli.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import process from 'node:process';
|
|
3
|
+
import meow from 'meow';
|
|
4
|
+
import getStdin from 'get-stdin';
|
|
5
|
+
import terminalImage from 'terminal-image';
|
|
6
|
+
import {fileTypeFromFile, fileTypeFromBuffer} from 'file-type';
|
|
7
7
|
|
|
8
8
|
const cli = meow(`
|
|
9
9
|
Usage
|
|
@@ -13,7 +13,9 @@ const cli = meow(`
|
|
|
13
13
|
Examples
|
|
14
14
|
$ image unicorn.jpg
|
|
15
15
|
$ cat unicorn.jpg | image
|
|
16
|
-
|
|
16
|
+
`, {
|
|
17
|
+
importMeta: import.meta,
|
|
18
|
+
});
|
|
17
19
|
|
|
18
20
|
const [input] = cli.input;
|
|
19
21
|
|
|
@@ -22,21 +24,21 @@ if (!input && process.stdin.isTTY) {
|
|
|
22
24
|
process.exit(1);
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} else {
|
|
31
|
-
console.log(await terminalImage.file(input));
|
|
32
|
-
}
|
|
27
|
+
if (input) {
|
|
28
|
+
const {ext} = await fileTypeFromFile(input);
|
|
29
|
+
|
|
30
|
+
if (ext === 'gif') {
|
|
31
|
+
terminalImage.gifFile(input);
|
|
33
32
|
} else {
|
|
34
|
-
|
|
33
|
+
console.log(await terminalImage.file(input));
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
const stdin = await getStdin.buffer();
|
|
37
|
+
const {ext} = await fileTypeFromBuffer(stdin);
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
39
|
+
if (ext === 'gif') {
|
|
40
|
+
terminalImage.gifBuffer(stdin);
|
|
41
|
+
} else {
|
|
42
|
+
console.log(await terminalImage.buffer(stdin));
|
|
41
43
|
}
|
|
42
|
-
}
|
|
44
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "terminal-image-cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Display images in the terminal",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "sindresorhus/terminal-image-cli",
|
|
@@ -10,11 +10,12 @@
|
|
|
10
10
|
"email": "sindresorhus@gmail.com",
|
|
11
11
|
"url": "https://sindresorhus.com"
|
|
12
12
|
},
|
|
13
|
+
"type": "module",
|
|
13
14
|
"bin": {
|
|
14
|
-
"image": "cli.js"
|
|
15
|
+
"image": "./cli.js"
|
|
15
16
|
},
|
|
16
17
|
"engines": {
|
|
17
|
-
"node": ">=
|
|
18
|
+
"node": ">=18"
|
|
18
19
|
},
|
|
19
20
|
"scripts": {
|
|
20
21
|
"test": "xo && FORCE_COLOR=1 ava"
|
|
@@ -37,15 +38,15 @@
|
|
|
37
38
|
"animation"
|
|
38
39
|
],
|
|
39
40
|
"dependencies": {
|
|
40
|
-
"file-type": "^
|
|
41
|
-
"get-stdin": "^
|
|
42
|
-
"meow": "^
|
|
43
|
-
"terminal-image": "^
|
|
41
|
+
"file-type": "^19.3.0",
|
|
42
|
+
"get-stdin": "^9.0.0",
|
|
43
|
+
"meow": "^13.2.0",
|
|
44
|
+
"terminal-image": "^3.0.0"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"ava": "^
|
|
47
|
-
"execa": "^
|
|
48
|
-
"has-ansi": "^
|
|
49
|
-
"xo": "^0.
|
|
47
|
+
"ava": "^6.1.3",
|
|
48
|
+
"execa": "^9.3.0",
|
|
49
|
+
"has-ansi": "^6.0.0",
|
|
50
|
+
"xo": "^0.59.2"
|
|
50
51
|
}
|
|
51
52
|
}
|
package/readme.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# terminal-image-cli
|
|
1
|
+
# terminal-image-cli
|
|
2
2
|
|
|
3
3
|
> Display images in the terminal
|
|
4
4
|
|
|
@@ -10,8 +10,8 @@ Works in any terminal that supports colors. Supports animated GIFs.
|
|
|
10
10
|
|
|
11
11
|
## Install
|
|
12
12
|
|
|
13
|
-
```
|
|
14
|
-
|
|
13
|
+
```sh
|
|
14
|
+
npm install --global terminal-image-cli
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
@@ -30,5 +30,5 @@ $ image --help
|
|
|
30
30
|
|
|
31
31
|
## Related
|
|
32
32
|
|
|
33
|
-
- [terminal-image](https://github.com/sindresorhus/terminal-image) - API for this
|
|
33
|
+
- [terminal-image](https://github.com/sindresorhus/terminal-image) - API for this package
|
|
34
34
|
- [terminal-link-cli](https://github.com/sindresorhus/terminal-link-cli) - Create clickable links in the terminal
|