Skip to content

Your app looks AI-generated. Vincent Van Gogh noticed. An agent skill that finds and fixes AI-looking UI and UX in mobile apps, web apps, and websites.

fix: name the bad --platform value instead of printing usage (#35) (#54)

Nguyễn Tuấn Anhcdda9caa7042
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.js
index 3aa833c..2f83e0e 100644
--- a/skills/unslop-anything/scripts/detect.js
+++ b/skills/unslop-anything/scripts/detect.js
@@ -1032,8 +1032,12 @@ function main(argv) {
const a = args[i];
if (a === "--platform") {
platform = args[++i];
+ if (platform === undefined) {
+ console.error("Missing value for --platform. Choose from mobile, web, universal.");
+ return 1;
+ }
if (!["mobile", "web", "universal"].includes(platform)) {
- console.error(USAGE);
+ console.error(`Unknown platform: ${platform}. Choose from mobile, web, universal.`);
return 1;
}
} else if (a === "--ignore") {
diff --git a/test/detect.test.js b/test/detect.test.js
index 5f77db2..8f2ae66 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -120,10 +120,17 @@ test("exit codes and json shape", () => {
console.log = log;
}
const err = console.error;
- console.error = () => {};
+ let errOut = "";
+ console.error = (s) => (errOut += s);
try {
assert.strictEqual(main(["--ignore", "not-a-rule"]), 1);
assert.strictEqual(main(["--nope"]), 1);
+ errOut = "";
+ assert.strictEqual(main(["--platform", "desktop"]), 1);
+ assert.strictEqual(errOut, "Unknown platform: desktop. Choose from mobile, web, universal.");
+ errOut = "";
+ assert.strictEqual(main(["--platform"]), 1);
+ assert.strictEqual(errOut, "Missing value for --platform. Choose from mobile, web, universal.");
} finally {
console.error = err;
}