@spark-apps/piclet 1.0.5 → 1.0.6
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/dist/cli.js +131 -131
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
|
-
import
|
|
4
|
+
import chalk18 from "chalk";
|
|
5
5
|
|
|
6
6
|
// src/cli/index.ts
|
|
7
|
-
import
|
|
7
|
+
import chalk17 from "chalk";
|
|
8
8
|
import { Command } from "commander";
|
|
9
9
|
|
|
10
10
|
// src/lib/banner.ts
|
|
11
|
+
import chalk from "chalk";
|
|
11
12
|
import figlet from "figlet";
|
|
12
13
|
import gradient from "gradient-string";
|
|
13
14
|
var GRADIENT_COLORS = ["#22c55e", "#84cc16", "#eab308", "#fcd34d"];
|
|
@@ -18,26 +19,26 @@ function renderLogo() {
|
|
|
18
19
|
});
|
|
19
20
|
return gradient(GRADIENT_COLORS)(ascii);
|
|
20
21
|
}
|
|
22
|
+
var SUBTITLE_COLOR = "#eab308";
|
|
21
23
|
function showBanner(subtitle = "Image manipulation utility toolkit with Windows shell integration") {
|
|
22
24
|
try {
|
|
23
25
|
console.log(`
|
|
24
26
|
${renderLogo()}`);
|
|
25
27
|
if (subtitle) {
|
|
26
|
-
|
|
27
|
-
console.log(subtleGradient(` ${subtitle}
|
|
28
|
+
console.log(chalk.hex(SUBTITLE_COLOR)(`${subtitle}
|
|
28
29
|
`));
|
|
29
30
|
}
|
|
30
31
|
} catch {
|
|
31
32
|
console.log("\n\x1B[1mPicLet\x1B[0m");
|
|
32
33
|
if (subtitle) {
|
|
33
|
-
console.log(`\x1B[
|
|
34
|
+
console.log(`\x1B[38;2;234;179;8m${subtitle}\x1B[0m
|
|
34
35
|
`);
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
// src/cli/commands/border.ts
|
|
40
|
-
import
|
|
41
|
+
import chalk3 from "chalk";
|
|
41
42
|
|
|
42
43
|
// src/tools/border.ts
|
|
43
44
|
import { existsSync as existsSync5, readFileSync as readFileSync3 } from "fs";
|
|
@@ -4290,7 +4291,7 @@ function getToolsForExtension(extension) {
|
|
|
4290
4291
|
import { extname as extname4 } from "path";
|
|
4291
4292
|
import { dirname as dirname9 } from "path";
|
|
4292
4293
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
4293
|
-
import
|
|
4294
|
+
import chalk2 from "chalk";
|
|
4294
4295
|
function getDistDir() {
|
|
4295
4296
|
const currentFile = fileURLToPath2(import.meta.url);
|
|
4296
4297
|
return dirname9(currentFile);
|
|
@@ -4314,17 +4315,17 @@ function validateExtensions(files, allowedExtensions) {
|
|
|
4314
4315
|
async function runToolOnFiles(toolId, files, useYes) {
|
|
4315
4316
|
const tool = getTool(toolId);
|
|
4316
4317
|
if (!tool) {
|
|
4317
|
-
console.error(
|
|
4318
|
+
console.error(chalk2.red(`Tool not found: ${toolId}`));
|
|
4318
4319
|
return false;
|
|
4319
4320
|
}
|
|
4320
4321
|
const { valid, invalid } = validateExtensions(files, tool.config.extensions);
|
|
4321
4322
|
if (invalid.length > 0) {
|
|
4322
|
-
console.error(
|
|
4323
|
+
console.error(chalk2.red("Invalid file types:"));
|
|
4323
4324
|
for (const file of invalid) {
|
|
4324
|
-
console.error(
|
|
4325
|
+
console.error(chalk2.red(` \u2717 ${file}`));
|
|
4325
4326
|
}
|
|
4326
4327
|
console.error(
|
|
4327
|
-
|
|
4328
|
+
chalk2.yellow(
|
|
4328
4329
|
`
|
|
4329
4330
|
Supported extensions: ${tool.config.extensions.join(", ")}`
|
|
4330
4331
|
)
|
|
@@ -4339,7 +4340,7 @@ Supported extensions: ${tool.config.extensions.join(", ")}`
|
|
|
4339
4340
|
for (let i = 0; i < valid.length; i++) {
|
|
4340
4341
|
const file = valid[i];
|
|
4341
4342
|
if (valid.length > 1) {
|
|
4342
|
-
console.log(
|
|
4343
|
+
console.log(chalk2.cyan(`
|
|
4343
4344
|
[${i + 1}/${valid.length}] ${file}`));
|
|
4344
4345
|
}
|
|
4345
4346
|
const success2 = await tool.run(file);
|
|
@@ -4354,9 +4355,9 @@ function registerBorderCommand(program2) {
|
|
|
4354
4355
|
if (options.gui) {
|
|
4355
4356
|
const { valid, invalid } = validateExtensions(files, config.extensions);
|
|
4356
4357
|
if (invalid.length > 0) {
|
|
4357
|
-
console.error(
|
|
4358
|
+
console.error(chalk3.red("Invalid file types:"));
|
|
4358
4359
|
for (const file of invalid) {
|
|
4359
|
-
console.error(
|
|
4360
|
+
console.error(chalk3.red(` - ${file}`));
|
|
4360
4361
|
}
|
|
4361
4362
|
}
|
|
4362
4363
|
if (valid.length === 0) {
|
|
@@ -4375,32 +4376,32 @@ function registerBorderCommand(program2) {
|
|
|
4375
4376
|
}
|
|
4376
4377
|
|
|
4377
4378
|
// src/cli/commands/config.ts
|
|
4378
|
-
import
|
|
4379
|
+
import chalk4 from "chalk";
|
|
4379
4380
|
function registerConfigCommand(program2) {
|
|
4380
4381
|
const configCmd = program2.command("config").description("Display current settings").action(() => {
|
|
4381
4382
|
const config12 = loadConfig();
|
|
4382
|
-
console.log(
|
|
4383
|
-
console.log(
|
|
4383
|
+
console.log(chalk4.white.bold("\n PicLet Configuration"));
|
|
4384
|
+
console.log(chalk4.gray(` ${getConfigPath()}
|
|
4384
4385
|
`));
|
|
4385
4386
|
console.log(JSON.stringify(config12, null, 2));
|
|
4386
4387
|
console.log();
|
|
4387
4388
|
});
|
|
4388
4389
|
configCmd.command("reset").description("Restore defaults").action(() => {
|
|
4389
4390
|
resetConfig();
|
|
4390
|
-
console.log(
|
|
4391
|
+
console.log(chalk4.green("Configuration reset to defaults."));
|
|
4391
4392
|
});
|
|
4392
4393
|
}
|
|
4393
4394
|
|
|
4394
4395
|
// src/cli/commands/extract-frames.ts
|
|
4395
|
-
import
|
|
4396
|
+
import chalk5 from "chalk";
|
|
4396
4397
|
function registerExtractFramesCommand(program2) {
|
|
4397
|
-
program2.command("extract-frames <files...>").alias("frames").description("Extract frames from animated GIF").option("-y, --yes", "Use defaults, skip prompts").option("-g, --gui", "Use GUI for options").action(async (files, options) => {
|
|
4398
|
+
program2.command("extract-frames <files...>").alias("frames").alias("gif").description("Extract frames from animated GIF").option("-y, --yes", "Use defaults, skip prompts").option("-g, --gui", "Use GUI for options").action(async (files, options) => {
|
|
4398
4399
|
if (options.gui) {
|
|
4399
4400
|
const { valid, invalid } = validateExtensions(files, config2.extensions);
|
|
4400
4401
|
if (invalid.length > 0) {
|
|
4401
|
-
console.error(
|
|
4402
|
+
console.error(chalk5.red("Invalid file types:"));
|
|
4402
4403
|
for (const file of invalid) {
|
|
4403
|
-
console.error(
|
|
4404
|
+
console.error(chalk5.red(` - ${file}`));
|
|
4404
4405
|
}
|
|
4405
4406
|
}
|
|
4406
4407
|
if (valid.length === 0) {
|
|
@@ -4419,15 +4420,15 @@ function registerExtractFramesCommand(program2) {
|
|
|
4419
4420
|
}
|
|
4420
4421
|
|
|
4421
4422
|
// src/cli/commands/filter.ts
|
|
4422
|
-
import
|
|
4423
|
+
import chalk6 from "chalk";
|
|
4423
4424
|
function registerFilterCommand(program2) {
|
|
4424
4425
|
program2.command("filter <files...>").description("Apply color filters (grayscale, sepia, etc.)").option("-y, --yes", "Use defaults, skip prompts").option("-g, --gui", "Use GUI for options").action(async (files, options) => {
|
|
4425
4426
|
if (options.gui) {
|
|
4426
4427
|
const { valid, invalid } = validateExtensions(files, config3.extensions);
|
|
4427
4428
|
if (invalid.length > 0) {
|
|
4428
|
-
console.error(
|
|
4429
|
+
console.error(chalk6.red("Invalid file types:"));
|
|
4429
4430
|
for (const file of invalid) {
|
|
4430
|
-
console.error(
|
|
4431
|
+
console.error(chalk6.red(` - ${file}`));
|
|
4431
4432
|
}
|
|
4432
4433
|
}
|
|
4433
4434
|
if (valid.length === 0) {
|
|
@@ -4453,15 +4454,15 @@ function registerHelpCommand(program2) {
|
|
|
4453
4454
|
}
|
|
4454
4455
|
|
|
4455
4456
|
// src/cli/commands/iconpack.ts
|
|
4456
|
-
import
|
|
4457
|
+
import chalk7 from "chalk";
|
|
4457
4458
|
function registerIconpackCommand(program2) {
|
|
4458
4459
|
program2.command("iconpack <files...>").description("Generate icon sets for Web, Android, iOS").option("-y, --yes", "Use defaults, skip prompts").option("-g, --gui", "Use GUI for options").action(async (files, options) => {
|
|
4459
4460
|
if (options.gui) {
|
|
4460
4461
|
const { valid, invalid } = validateExtensions(files, config4.extensions);
|
|
4461
4462
|
if (invalid.length > 0) {
|
|
4462
|
-
console.error(
|
|
4463
|
+
console.error(chalk7.red("Invalid file types:"));
|
|
4463
4464
|
for (const file of invalid) {
|
|
4464
|
-
console.error(
|
|
4465
|
+
console.error(chalk7.red(` - ${file}`));
|
|
4465
4466
|
}
|
|
4466
4467
|
}
|
|
4467
4468
|
if (valid.length === 0) {
|
|
@@ -4480,7 +4481,7 @@ function registerIconpackCommand(program2) {
|
|
|
4480
4481
|
}
|
|
4481
4482
|
|
|
4482
4483
|
// src/cli/commands/install.ts
|
|
4483
|
-
import
|
|
4484
|
+
import chalk8 from "chalk";
|
|
4484
4485
|
|
|
4485
4486
|
// src/lib/registry.ts
|
|
4486
4487
|
import { exec as exec2 } from "child_process";
|
|
@@ -4702,80 +4703,89 @@ async function generateUninstallRegFile() {
|
|
|
4702
4703
|
// src/cli/commands/install.ts
|
|
4703
4704
|
function registerInstallCommand(program2) {
|
|
4704
4705
|
program2.command("install").description("Install Windows shell context menu integration").action(async () => {
|
|
4706
|
+
console.log(chalk8.bold("Installing...\n"));
|
|
4705
4707
|
showBanner();
|
|
4706
|
-
console.log(chalk7.bold("Installing...\n"));
|
|
4707
4708
|
if (!isWSL()) {
|
|
4708
4709
|
console.log(
|
|
4709
|
-
|
|
4710
|
+
chalk8.yellow("! Not running in WSL. Registry integration skipped.")
|
|
4710
4711
|
);
|
|
4711
4712
|
console.log(
|
|
4712
|
-
|
|
4713
|
+
chalk8.yellow('! Run "piclet install" from WSL to add context menu.')
|
|
4713
4714
|
);
|
|
4714
4715
|
return;
|
|
4715
4716
|
}
|
|
4716
4717
|
if (!isWSLInteropEnabled()) {
|
|
4717
|
-
console.log(
|
|
4718
|
+
console.log(chalk8.yellow("WSL Interop not available. Generating registry file...\n"));
|
|
4718
4719
|
const regPath = await generateRegFile();
|
|
4719
4720
|
const winPath = wslToWindows(regPath);
|
|
4720
|
-
console.log(
|
|
4721
|
-
console.log(
|
|
4721
|
+
console.log(chalk8.green("\u2713 Generated registry file:"));
|
|
4722
|
+
console.log(chalk8.cyan(` ${winPath}
|
|
4722
4723
|
`));
|
|
4723
|
-
console.log(
|
|
4724
|
-
console.log(
|
|
4725
|
-
console.log(
|
|
4726
|
-
console.log();
|
|
4724
|
+
console.log(chalk8.bold("To install, either:"));
|
|
4725
|
+
console.log(chalk8.dim(" 1. Double-click the .reg file in Windows Explorer"));
|
|
4726
|
+
console.log(chalk8.dim(` 2. Run in elevated PowerShell: reg import "${winPath}"`));
|
|
4727
4727
|
return;
|
|
4728
4728
|
}
|
|
4729
|
-
console.log(chalk7.dim("Removing old entries..."));
|
|
4730
4729
|
await unregisterAllTools();
|
|
4731
|
-
|
|
4732
|
-
const
|
|
4733
|
-
const
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
console.log();
|
|
4739
|
-
if (allSuccess) {
|
|
4740
|
-
console.log(
|
|
4741
|
-
chalk7.green(`\u2713 Registered ${tools.length} tools for context menu.`)
|
|
4742
|
-
);
|
|
4743
|
-
} else {
|
|
4744
|
-
const successCount = results.filter((r) => r.success).length;
|
|
4745
|
-
console.log(
|
|
4746
|
-
chalk7.yellow(`! Registered ${successCount}/${results.length} entries.`)
|
|
4747
|
-
);
|
|
4748
|
-
}
|
|
4749
|
-
console.log(chalk7.bold("\nContext Menu Usage:"));
|
|
4730
|
+
await registerAllTools();
|
|
4731
|
+
const dim = chalk8.gray;
|
|
4732
|
+
const cmd = chalk8.cyan;
|
|
4733
|
+
const arg = chalk8.hex("#cc8800");
|
|
4734
|
+
const opt = chalk8.green;
|
|
4735
|
+
const head = chalk8.white.bold;
|
|
4736
|
+
console.log(chalk8.bold("\nContext Menu Usage:"));
|
|
4750
4737
|
console.log(" Right-click any supported image in Windows Explorer.");
|
|
4751
4738
|
console.log(" Multi-select supported for batch processing.");
|
|
4752
|
-
console.log(
|
|
4753
|
-
console.log(
|
|
4754
|
-
console.log(
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
console.log(
|
|
4758
|
-
console.log(
|
|
4759
|
-
console.log(
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
console.log(
|
|
4763
|
-
console.log(
|
|
4764
|
-
console.log(
|
|
4739
|
+
console.log(arg(" Supported image types: [.png, .jpg, .jpeg, .gif, .bmp, .ico]"));
|
|
4740
|
+
console.log(head("\nCLI Usage:"));
|
|
4741
|
+
console.log(
|
|
4742
|
+
` ${head("Usage:")} piclet ${cmd("<command>")} ${arg("<file>")} ${opt("[options]")}`
|
|
4743
|
+
);
|
|
4744
|
+
console.log();
|
|
4745
|
+
console.log(head(" GUI"));
|
|
4746
|
+
console.log(
|
|
4747
|
+
` ${cmd("piclet")} ${arg("<file>")} Opens PicLet GUI window with all tools`
|
|
4748
|
+
);
|
|
4749
|
+
console.log();
|
|
4750
|
+
console.log(head(" Setup"));
|
|
4751
|
+
console.log(` ${cmd("install")} Add Windows right-click menu`);
|
|
4752
|
+
console.log(` ${cmd("uninstall")} Remove right-click menu`);
|
|
4753
|
+
console.log();
|
|
4754
|
+
console.log(head(" Config"));
|
|
4755
|
+
console.log(` ${cmd("config")} Display current settings`);
|
|
4756
|
+
console.log(` ${cmd("config reset")} Restore defaults`);
|
|
4757
|
+
console.log();
|
|
4758
|
+
console.log(head(" Prerequisites"));
|
|
4759
|
+
console.log(" - WSL (Windows Subsystem for Linux)");
|
|
4760
|
+
console.log(" - ImageMagick: sudo apt install imagemagick");
|
|
4761
|
+
console.log();
|
|
4762
|
+
console.log(head(" Examples"));
|
|
4763
|
+
console.log(` ${dim("$")} piclet ${cmd("piclet")} ${arg("image.png")} ${dim("# All tools in one window")}`);
|
|
4764
|
+
console.log(` ${dim("$")} piclet ${cmd("makeicon")} ${arg("logo.png")} ${dim("# Interactive")}`);
|
|
4765
|
+
console.log(` ${dim("$")} piclet ${cmd("makeicon")} ${arg("*.png")} ${opt("-y")} ${dim("# Batch with defaults")}`);
|
|
4766
|
+
console.log(` ${dim("$")} piclet ${cmd("remove-bg")} ${arg("photo.png")} ${dim("# Interactive prompts")}`);
|
|
4767
|
+
console.log(` ${dim("$")} piclet ${cmd("scale")} ${arg("image.jpg")} ${dim("# Interactive resize")}`);
|
|
4768
|
+
console.log(` ${dim("$")} piclet ${cmd("gif")} ${arg("anim.gif")} ${dim("# Extract GIF frames")}`);
|
|
4769
|
+
console.log(` ${dim("$")} piclet ${cmd("iconpack")} ${arg("icon.png")} ${opt("-y")} ${dim("# All platforms")}`);
|
|
4770
|
+
console.log(` ${dim("$")} piclet ${cmd("storepack")} ${arg("image.png")} ${opt("-g")} ${dim("# GUI for store assets")}`);
|
|
4771
|
+
console.log(
|
|
4772
|
+
`
|
|
4773
|
+
Run "piclet ${opt("--help")}" for full documentation.`
|
|
4774
|
+
);
|
|
4765
4775
|
console.log();
|
|
4766
4776
|
});
|
|
4767
4777
|
}
|
|
4768
4778
|
|
|
4769
4779
|
// src/cli/commands/makeicon.ts
|
|
4770
|
-
import
|
|
4780
|
+
import chalk9 from "chalk";
|
|
4771
4781
|
function registerMakeiconCommand(program2) {
|
|
4772
4782
|
program2.command("makeicon <files...>").description("Convert PNG to multi-resolution ICO file").option("-y, --yes", "Use defaults, skip prompts").option("-g, --gui", "Use GUI for confirmation").action(async (files, options) => {
|
|
4773
4783
|
if (options.gui) {
|
|
4774
4784
|
const { valid, invalid } = validateExtensions(files, config5.extensions);
|
|
4775
4785
|
if (invalid.length > 0) {
|
|
4776
|
-
console.error(
|
|
4786
|
+
console.error(chalk9.red("Invalid file types:"));
|
|
4777
4787
|
for (const file of invalid) {
|
|
4778
|
-
console.error(
|
|
4788
|
+
console.error(chalk9.red(` - ${file}`));
|
|
4779
4789
|
}
|
|
4780
4790
|
}
|
|
4781
4791
|
if (valid.length === 0) {
|
|
@@ -4794,13 +4804,13 @@ function registerMakeiconCommand(program2) {
|
|
|
4794
4804
|
}
|
|
4795
4805
|
|
|
4796
4806
|
// src/cli/commands/piclet.ts
|
|
4797
|
-
import
|
|
4807
|
+
import chalk10 from "chalk";
|
|
4798
4808
|
function registerPicletCommand(program2) {
|
|
4799
4809
|
program2.command("piclet <file>").description("Open unified PicLet window with all tools").option("-g, --gui", "Use GUI (default)").action(async (file) => {
|
|
4800
4810
|
const { valid, invalid } = validateExtensions([file], picletTool.config.extensions);
|
|
4801
4811
|
if (invalid.length > 0) {
|
|
4802
|
-
console.error(
|
|
4803
|
-
console.error(
|
|
4812
|
+
console.error(chalk10.red(`Invalid file type: ${file}`));
|
|
4813
|
+
console.error(chalk10.yellow(`Supported: ${picletTool.config.extensions.join(", ")}`));
|
|
4804
4814
|
process.exit(1);
|
|
4805
4815
|
}
|
|
4806
4816
|
const result = await picletTool.runGUI(valid[0]);
|
|
@@ -4809,15 +4819,15 @@ function registerPicletCommand(program2) {
|
|
|
4809
4819
|
}
|
|
4810
4820
|
|
|
4811
4821
|
// src/cli/commands/recolor.ts
|
|
4812
|
-
import
|
|
4822
|
+
import chalk11 from "chalk";
|
|
4813
4823
|
function registerRecolorCommand(program2) {
|
|
4814
4824
|
program2.command("recolor <files...>").alias("replace-color").description("Replace one color with another").option("-y, --yes", "Use defaults, skip prompts").option("-g, --gui", "Use GUI for options").action(async (files, options) => {
|
|
4815
4825
|
if (options.gui) {
|
|
4816
4826
|
const { valid, invalid } = validateExtensions(files, config7.extensions);
|
|
4817
4827
|
if (invalid.length > 0) {
|
|
4818
|
-
console.error(
|
|
4828
|
+
console.error(chalk11.red("Invalid file types:"));
|
|
4819
4829
|
for (const file of invalid) {
|
|
4820
|
-
console.error(
|
|
4830
|
+
console.error(chalk11.red(` - ${file}`));
|
|
4821
4831
|
}
|
|
4822
4832
|
}
|
|
4823
4833
|
if (valid.length === 0) {
|
|
@@ -4836,15 +4846,15 @@ function registerRecolorCommand(program2) {
|
|
|
4836
4846
|
}
|
|
4837
4847
|
|
|
4838
4848
|
// src/cli/commands/remove-bg.ts
|
|
4839
|
-
import
|
|
4849
|
+
import chalk12 from "chalk";
|
|
4840
4850
|
function registerRemoveBgCommand(program2) {
|
|
4841
4851
|
program2.command("remove-bg <files...>").alias("removebg").description("Remove solid background from image").option("-y, --yes", "Use defaults, skip prompts").option("-g, --gui", "Use TUI (terminal GUI) for options").option("-f, --fuzz <percent>", "Fuzz tolerance 0-100 (default: 10)").option("-t, --trim", "Trim transparent edges (default: true)").option("--no-trim", "Do not trim transparent edges").option("-p, --preserve-inner", "Preserve inner areas of same color").option("-s, --square", "Make output square with padding").action(async (files, options) => {
|
|
4842
4852
|
if (options.gui) {
|
|
4843
4853
|
const { valid, invalid } = validateExtensions(files, config8.extensions);
|
|
4844
4854
|
if (invalid.length > 0) {
|
|
4845
|
-
console.error(
|
|
4855
|
+
console.error(chalk12.red("Invalid file types:"));
|
|
4846
4856
|
for (const file of invalid) {
|
|
4847
|
-
console.error(
|
|
4857
|
+
console.error(chalk12.red(` - ${file}`));
|
|
4848
4858
|
}
|
|
4849
4859
|
}
|
|
4850
4860
|
if (valid.length === 0) {
|
|
@@ -4876,15 +4886,15 @@ function registerRemoveBgCommand(program2) {
|
|
|
4876
4886
|
}
|
|
4877
4887
|
|
|
4878
4888
|
// src/cli/commands/scale.ts
|
|
4879
|
-
import
|
|
4889
|
+
import chalk13 from "chalk";
|
|
4880
4890
|
function registerScaleCommand(program2) {
|
|
4881
4891
|
program2.command("scale <files...>").alias("rescale").description("Resize image with optional padding").option("-y, --yes", "Use defaults, skip prompts").option("-g, --gui", "Use GUI for options").action(async (files, options) => {
|
|
4882
4892
|
if (options.gui) {
|
|
4883
4893
|
const { valid, invalid } = validateExtensions(files, config9.extensions);
|
|
4884
4894
|
if (invalid.length > 0) {
|
|
4885
|
-
console.error(
|
|
4895
|
+
console.error(chalk13.red("Invalid file types:"));
|
|
4886
4896
|
for (const file of invalid) {
|
|
4887
|
-
console.error(
|
|
4897
|
+
console.error(chalk13.red(` - ${file}`));
|
|
4888
4898
|
}
|
|
4889
4899
|
}
|
|
4890
4900
|
if (valid.length === 0) {
|
|
@@ -4903,15 +4913,15 @@ function registerScaleCommand(program2) {
|
|
|
4903
4913
|
}
|
|
4904
4914
|
|
|
4905
4915
|
// src/cli/commands/storepack.ts
|
|
4906
|
-
import
|
|
4916
|
+
import chalk14 from "chalk";
|
|
4907
4917
|
function registerStorepackCommand(program2) {
|
|
4908
4918
|
program2.command("storepack <files...>").description("Generate assets for app stores (Windows, Unity, Steam, etc.)").option("-y, --yes", "Use defaults, skip prompts").option("-g, --gui", "Use GUI for options").action(async (files, options) => {
|
|
4909
4919
|
if (options.gui) {
|
|
4910
4920
|
const { valid, invalid } = validateExtensions(files, config10.extensions);
|
|
4911
4921
|
if (invalid.length > 0) {
|
|
4912
|
-
console.error(
|
|
4922
|
+
console.error(chalk14.red("Invalid file types:"));
|
|
4913
4923
|
for (const file of invalid) {
|
|
4914
|
-
console.error(
|
|
4924
|
+
console.error(chalk14.red(` - ${file}`));
|
|
4915
4925
|
}
|
|
4916
4926
|
}
|
|
4917
4927
|
if (valid.length === 0) {
|
|
@@ -4930,15 +4940,15 @@ function registerStorepackCommand(program2) {
|
|
|
4930
4940
|
}
|
|
4931
4941
|
|
|
4932
4942
|
// src/cli/commands/transform.ts
|
|
4933
|
-
import
|
|
4943
|
+
import chalk15 from "chalk";
|
|
4934
4944
|
function registerTransformCommand(program2) {
|
|
4935
4945
|
program2.command("transform <files...>").alias("flip").description("Flip or rotate images").option("-y, --yes", "Use defaults, skip prompts").option("-g, --gui", "Use GUI for options").action(async (files, options) => {
|
|
4936
4946
|
if (options.gui) {
|
|
4937
4947
|
const { valid, invalid } = validateExtensions(files, config11.extensions);
|
|
4938
4948
|
if (invalid.length > 0) {
|
|
4939
|
-
console.error(
|
|
4949
|
+
console.error(chalk15.red("Invalid file types:"));
|
|
4940
4950
|
for (const file of invalid) {
|
|
4941
|
-
console.error(
|
|
4951
|
+
console.error(chalk15.red(` - ${file}`));
|
|
4942
4952
|
}
|
|
4943
4953
|
}
|
|
4944
4954
|
if (valid.length === 0) {
|
|
@@ -4957,41 +4967,41 @@ function registerTransformCommand(program2) {
|
|
|
4957
4967
|
}
|
|
4958
4968
|
|
|
4959
4969
|
// src/cli/commands/uninstall.ts
|
|
4960
|
-
import
|
|
4970
|
+
import chalk16 from "chalk";
|
|
4961
4971
|
function registerUninstallCommand(program2) {
|
|
4962
4972
|
program2.command("uninstall").description("Remove Windows shell context menu integration").action(async () => {
|
|
4963
4973
|
showBanner();
|
|
4964
|
-
console.log(
|
|
4974
|
+
console.log(chalk16.bold("Uninstalling...\n"));
|
|
4965
4975
|
if (!isWSL()) {
|
|
4966
4976
|
console.log(
|
|
4967
|
-
|
|
4977
|
+
chalk16.yellow("! Not running in WSL. Registry cleanup skipped.")
|
|
4968
4978
|
);
|
|
4969
4979
|
console.log(
|
|
4970
|
-
|
|
4980
|
+
chalk16.yellow(
|
|
4971
4981
|
'! Run "piclet uninstall" from WSL to remove context menu.'
|
|
4972
4982
|
)
|
|
4973
4983
|
);
|
|
4974
4984
|
return;
|
|
4975
4985
|
}
|
|
4976
4986
|
if (!isWSLInteropEnabled()) {
|
|
4977
|
-
console.log(
|
|
4987
|
+
console.log(chalk16.yellow("WSL Interop not available. Generating registry file...\n"));
|
|
4978
4988
|
const regPath = await generateUninstallRegFile();
|
|
4979
4989
|
const winPath = wslToWindows(regPath);
|
|
4980
|
-
console.log(
|
|
4981
|
-
console.log(
|
|
4990
|
+
console.log(chalk16.green("\u2713 Generated uninstall registry file:"));
|
|
4991
|
+
console.log(chalk16.cyan(` ${winPath}
|
|
4982
4992
|
`));
|
|
4983
|
-
console.log(
|
|
4984
|
-
console.log(
|
|
4985
|
-
console.log(
|
|
4993
|
+
console.log(chalk16.bold("To uninstall, either:"));
|
|
4994
|
+
console.log(chalk16.dim(" 1. Double-click the .reg file in Windows Explorer"));
|
|
4995
|
+
console.log(chalk16.dim(` 2. Run in elevated PowerShell: reg import "${winPath}"`));
|
|
4986
4996
|
console.log();
|
|
4987
4997
|
return;
|
|
4988
4998
|
}
|
|
4989
|
-
console.log(
|
|
4999
|
+
console.log(chalk16.dim("Cleaning up legacy entries...\n"));
|
|
4990
5000
|
const legacyResult = await cleanupLegacyEntries();
|
|
4991
5001
|
if (legacyResult.removed.length > 0) {
|
|
4992
|
-
console.log(
|
|
5002
|
+
console.log(chalk16.yellow(`Removed ${legacyResult.removed.length} legacy entries:`));
|
|
4993
5003
|
for (const entry of legacyResult.removed) {
|
|
4994
|
-
console.log(` ${
|
|
5004
|
+
console.log(` ${chalk16.green("\u2713")} ${entry}`);
|
|
4995
5005
|
}
|
|
4996
5006
|
console.log();
|
|
4997
5007
|
}
|
|
@@ -5000,40 +5010,40 @@ function registerUninstallCommand(program2) {
|
|
|
5000
5010
|
for (const result of results) {
|
|
5001
5011
|
if (result.success) {
|
|
5002
5012
|
console.log(
|
|
5003
|
-
`${
|
|
5013
|
+
`${chalk16.green("\u2713")} Removed: ${result.extension} \u2192 ${result.toolName}`
|
|
5004
5014
|
);
|
|
5005
5015
|
} else {
|
|
5006
5016
|
console.log(
|
|
5007
|
-
`${
|
|
5017
|
+
`${chalk16.gray("-")} Skipped: ${result.extension} \u2192 ${result.toolName}`
|
|
5008
5018
|
);
|
|
5009
5019
|
}
|
|
5010
5020
|
}
|
|
5011
5021
|
const totalRemoved = removedCount + legacyResult.removed.length;
|
|
5012
5022
|
console.log();
|
|
5013
5023
|
console.log(
|
|
5014
|
-
|
|
5024
|
+
chalk16.green(
|
|
5015
5025
|
`\u2713 Cleanup complete. Removed ${totalRemoved} entries total.`
|
|
5016
5026
|
)
|
|
5017
5027
|
);
|
|
5018
|
-
console.log(
|
|
5028
|
+
console.log(chalk16.dim("\nThanks for using PicLet!\n"));
|
|
5019
5029
|
});
|
|
5020
5030
|
}
|
|
5021
5031
|
|
|
5022
5032
|
// src/cli/index.ts
|
|
5023
5033
|
function showHelp() {
|
|
5024
5034
|
showBanner();
|
|
5025
|
-
const dim =
|
|
5026
|
-
const cmd =
|
|
5027
|
-
const arg =
|
|
5028
|
-
const opt =
|
|
5029
|
-
const head =
|
|
5035
|
+
const dim = chalk17.gray;
|
|
5036
|
+
const cmd = chalk17.cyan;
|
|
5037
|
+
const arg = chalk17.hex("#cc8800");
|
|
5038
|
+
const opt = chalk17.green;
|
|
5039
|
+
const head = chalk17.white.bold;
|
|
5030
5040
|
console.log(
|
|
5031
5041
|
` ${head("Usage:")} piclet ${cmd("<command>")} ${arg("<file>")} ${opt("[options]")}`
|
|
5032
5042
|
);
|
|
5033
5043
|
console.log();
|
|
5034
|
-
console.log(head("
|
|
5044
|
+
console.log(head(" GUI"));
|
|
5035
5045
|
console.log(
|
|
5036
|
-
` ${cmd("piclet")} ${arg("<file>")}
|
|
5046
|
+
` ${cmd("piclet")} ${arg("<file>")} Opens PicLet GUI with all tools in one window`
|
|
5037
5047
|
);
|
|
5038
5048
|
console.log();
|
|
5039
5049
|
console.log(head(" Individual Tools"));
|
|
@@ -5047,19 +5057,7 @@ function showHelp() {
|
|
|
5047
5057
|
` ${cmd("scale")} ${arg("<file>")} Resize image with optional padding`
|
|
5048
5058
|
);
|
|
5049
5059
|
console.log(
|
|
5050
|
-
` ${cmd("
|
|
5051
|
-
);
|
|
5052
|
-
console.log(
|
|
5053
|
-
` ${cmd("filter")} ${arg("<file>")} Apply color filters (grayscale, sepia)`
|
|
5054
|
-
);
|
|
5055
|
-
console.log(
|
|
5056
|
-
` ${cmd("border")} ${arg("<file>")} Add solid color border`
|
|
5057
|
-
);
|
|
5058
|
-
console.log(
|
|
5059
|
-
` ${cmd("recolor")} ${arg("<file>")} Replace one color with another`
|
|
5060
|
-
);
|
|
5061
|
-
console.log(
|
|
5062
|
-
` ${cmd("frames")} ${arg("<file>")} Extract frames from animated GIF`
|
|
5060
|
+
` ${cmd("gif")} ${arg("<file>")} Extract frames from animated GIF`
|
|
5063
5061
|
);
|
|
5064
5062
|
console.log(
|
|
5065
5063
|
` ${cmd("iconpack")} ${arg("<file>")} Generate icon sets for Web/Android/iOS`
|
|
@@ -5084,6 +5082,7 @@ function showHelp() {
|
|
|
5084
5082
|
console.log(` ${dim("$")} piclet ${cmd("makeicon")} ${arg("*.png")} ${opt("-y")} ${dim("# Batch with defaults")}`);
|
|
5085
5083
|
console.log(` ${dim("$")} piclet ${cmd("remove-bg")} ${arg("photo.png")} ${dim("# Interactive prompts")}`);
|
|
5086
5084
|
console.log(` ${dim("$")} piclet ${cmd("scale")} ${arg("image.jpg")} ${dim("# Interactive resize")}`);
|
|
5085
|
+
console.log(` ${dim("$")} piclet ${cmd("gif")} ${arg("anim.gif")} ${dim("# Extract GIF frames")}`);
|
|
5087
5086
|
console.log(` ${dim("$")} piclet ${cmd("iconpack")} ${arg("icon.png")} ${opt("-y")} ${dim("# All platforms")}`);
|
|
5088
5087
|
console.log();
|
|
5089
5088
|
console.log(head(" Requirements"));
|
|
@@ -5095,6 +5094,7 @@ function createProgram() {
|
|
|
5095
5094
|
const program2 = new Command();
|
|
5096
5095
|
program2.helpInformation = () => "";
|
|
5097
5096
|
program2.on("--help", () => {
|
|
5097
|
+
showHelp();
|
|
5098
5098
|
});
|
|
5099
5099
|
program2.name("piclet").description("Image manipulation utility toolkit with Windows shell integration").version("1.0.0").action(() => {
|
|
5100
5100
|
showHelp();
|
|
@@ -5120,7 +5120,7 @@ function createProgram() {
|
|
|
5120
5120
|
// src/cli.ts
|
|
5121
5121
|
var program = createProgram();
|
|
5122
5122
|
program.parseAsync(process.argv).catch((error2) => {
|
|
5123
|
-
console.error(
|
|
5123
|
+
console.error(chalk18.red(`Error: ${error2.message}`));
|
|
5124
5124
|
process.exit(1);
|
|
5125
5125
|
});
|
|
5126
5126
|
//# sourceMappingURL=cli.js.map
|