image-convert-cli 1.1.0 → 1.1.1
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/README.md +4 -0
- package/bin/index.ts +7 -0
- package/dist/index.js +15 -1
- package/package.json +1 -1
- package/src/cli.ts +6 -0
- package/src/prompts.ts +5 -1
- package/src/types.ts +1 -0
package/README.md
CHANGED
package/bin/index.ts
CHANGED
|
@@ -12,11 +12,18 @@ if (args[0] === "update") {
|
|
|
12
12
|
process.exit(0);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
// Check for version command (positional argument)
|
|
16
|
+
if (args[0] === "version") {
|
|
17
|
+
options.version = true;
|
|
18
|
+
}
|
|
19
|
+
|
|
15
20
|
// Parse arguments
|
|
16
21
|
for (let i = 0; i < args.length; i++) {
|
|
17
22
|
const arg = args[i];
|
|
18
23
|
if (arg === "--help" || arg === "-h") {
|
|
19
24
|
options.help = true;
|
|
25
|
+
} else if (arg === "--version" || arg === "-v") {
|
|
26
|
+
options.version = true;
|
|
20
27
|
} else if (arg === "--yes" || arg === "-y") {
|
|
21
28
|
options.yes = true;
|
|
22
29
|
} else if (arg === "--source" || arg === "-s") {
|
package/dist/index.js
CHANGED
|
@@ -8454,21 +8454,25 @@ Usage:
|
|
|
8454
8454
|
imgc --source <path> --format <format> [options]
|
|
8455
8455
|
imgc -y --source <path> --format <format>
|
|
8456
8456
|
imgc update # Check for updates
|
|
8457
|
+
imgc version # Show version
|
|
8457
8458
|
|
|
8458
8459
|
Options:
|
|
8459
8460
|
--help, -h Show this help message
|
|
8461
|
+
--version, -v Show version number
|
|
8460
8462
|
--yes, -y Non-interactive mode (use defaults for optional prompts)
|
|
8461
8463
|
--source, -s Source file path (required with -y)
|
|
8462
8464
|
--format, -f Target format: webp, jpeg, jpg, or png (required with -y)
|
|
8463
8465
|
--dest, -d Destination path (optional, auto-generated if not provided)
|
|
8464
|
-
--compress, -c
|
|
8466
|
+
--compress, -c Enable compression (optional, default: false)
|
|
8465
8467
|
|
|
8466
8468
|
Commands:
|
|
8467
8469
|
update Check for the latest version on npm
|
|
8470
|
+
version Show version number
|
|
8468
8471
|
|
|
8469
8472
|
Examples:
|
|
8470
8473
|
imgc # Interactive mode
|
|
8471
8474
|
imgc --help # Show help
|
|
8475
|
+
imgc --version # Show version
|
|
8472
8476
|
imgc -y --source photo.png --format webp
|
|
8473
8477
|
imgc -y --source photo.jpg --format jpeg --compress
|
|
8474
8478
|
imgc update # Check for updates
|
|
@@ -8532,6 +8536,11 @@ async function runCli(options, promptService) {
|
|
|
8532
8536
|
prompts.showHelp();
|
|
8533
8537
|
return;
|
|
8534
8538
|
}
|
|
8539
|
+
if (options.version) {
|
|
8540
|
+
const version = process.env.npm_package_version || "1.1.0";
|
|
8541
|
+
console.log(`image-convert-cli v${version}`);
|
|
8542
|
+
return;
|
|
8543
|
+
}
|
|
8535
8544
|
if (options.yes && (!options.source || !options.format)) {
|
|
8536
8545
|
console.error("Error: -y mode requires --source and --format arguments");
|
|
8537
8546
|
prompts.showHelp();
|
|
@@ -8569,10 +8578,15 @@ if (args[0] === "update") {
|
|
|
8569
8578
|
await handleUpdate();
|
|
8570
8579
|
process.exit(0);
|
|
8571
8580
|
}
|
|
8581
|
+
if (args[0] === "version") {
|
|
8582
|
+
options.version = true;
|
|
8583
|
+
}
|
|
8572
8584
|
for (let i = 0;i < args.length; i++) {
|
|
8573
8585
|
const arg = args[i];
|
|
8574
8586
|
if (arg === "--help" || arg === "-h") {
|
|
8575
8587
|
options.help = true;
|
|
8588
|
+
} else if (arg === "--version" || arg === "-v") {
|
|
8589
|
+
options.version = true;
|
|
8576
8590
|
} else if (arg === "--yes" || arg === "-y") {
|
|
8577
8591
|
options.yes = true;
|
|
8578
8592
|
} else if (arg === "--source" || arg === "-s") {
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -45,6 +45,12 @@ export async function runCli(
|
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
if (options.version) {
|
|
49
|
+
const version = process.env.npm_package_version || "1.1.0";
|
|
50
|
+
console.log(`image-convert-cli v${version}`);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
48
54
|
if (options.yes && (!options.source || !options.format)) {
|
|
49
55
|
console.error("Error: -y mode requires --source and --format arguments");
|
|
50
56
|
prompts.showHelp();
|
package/src/prompts.ts
CHANGED
|
@@ -152,21 +152,25 @@ Usage:
|
|
|
152
152
|
imgc --source <path> --format <format> [options]
|
|
153
153
|
imgc -y --source <path> --format <format>
|
|
154
154
|
imgc update # Check for updates
|
|
155
|
+
imgc version # Show version
|
|
155
156
|
|
|
156
157
|
Options:
|
|
157
158
|
--help, -h Show this help message
|
|
159
|
+
--version, -v Show version number
|
|
158
160
|
--yes, -y Non-interactive mode (use defaults for optional prompts)
|
|
159
161
|
--source, -s Source file path (required with -y)
|
|
160
162
|
--format, -f Target format: webp, jpeg, jpg, or png (required with -y)
|
|
161
163
|
--dest, -d Destination path (optional, auto-generated if not provided)
|
|
162
|
-
--compress, -c
|
|
164
|
+
--compress, -c Enable compression (optional, default: false)
|
|
163
165
|
|
|
164
166
|
Commands:
|
|
165
167
|
update Check for the latest version on npm
|
|
168
|
+
version Show version number
|
|
166
169
|
|
|
167
170
|
Examples:
|
|
168
171
|
imgc # Interactive mode
|
|
169
172
|
imgc --help # Show help
|
|
173
|
+
imgc --version # Show version
|
|
170
174
|
imgc -y --source photo.png --format webp
|
|
171
175
|
imgc -y --source photo.jpg --format jpeg --compress
|
|
172
176
|
imgc update # Check for updates
|