@sanohiro/casty 0.5.6 → 0.5.7
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/bin/casty.js +8 -0
- package/package.json +1 -1
package/bin/casty.js
CHANGED
|
@@ -2,9 +2,17 @@
|
|
|
2
2
|
// casty - TTY web browser using raw CDP and Kitty graphics protocol
|
|
3
3
|
|
|
4
4
|
import { execFileSync } from 'node:child_process';
|
|
5
|
+
import { readFileSync } from 'node:fs';
|
|
5
6
|
import { fileURLToPath } from 'node:url';
|
|
6
7
|
import { dirname, join } from 'node:path';
|
|
7
8
|
|
|
9
|
+
// --version / -v
|
|
10
|
+
if (process.argv[2] === '--version' || process.argv[2] === '-v') {
|
|
11
|
+
const pkg = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json'), 'utf8'));
|
|
12
|
+
console.log(`casty ${pkg.version}`);
|
|
13
|
+
process.exit(0);
|
|
14
|
+
}
|
|
15
|
+
|
|
8
16
|
// Ensure Chrome is installed (skip if launched from bin/casty shell script)
|
|
9
17
|
if (!process.env.CASTY_ENSURE_CHROME) {
|
|
10
18
|
const __bin = dirname(fileURLToPath(import.meta.url));
|