@letterstory/cli 0.176.13 → 0.176.14

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.
Files changed (2) hide show
  1. package/lib/cli.mjs +9 -2
  2. package/package.json +1 -1
package/lib/cli.mjs CHANGED
@@ -80,7 +80,7 @@ import {
80
80
  import { fetchParkedSections, withoutParked } from "./parked.mjs";
81
81
 
82
82
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
83
- export const VERSION = "0.176.13";
83
+ export const VERSION = "0.176.14";
84
84
 
85
85
  /** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
86
86
  export const EXIT_PAYMENT_REQUIRED = 3;
@@ -380,6 +380,12 @@ export const BOOLEAN_FLAGS = new Set([
380
380
  // A flag repeated more than once (e.g. `--topic a --topic b`, used by `strategy
381
381
  // positioning set`) accumulates into an array; a single occurrence stays a plain
382
382
  // string, so every existing single-value flag read is unaffected.
383
+ /**
384
+ * A switch that takes a VALUE under one command: `automations add|set --on "fri 09:00 America/New_York"`
385
+ * (the pin) while `on` is `automate`'s boolean. Scoped by the first word, so the global list stays.
386
+ */
387
+ const VALUE_FLAGS_BY_COMMAND = { automations: new Set(["on"]) };
388
+
383
389
  /**
384
390
  * @param {string[]} argv
385
391
  * @returns {{ positionals: string[], flags: Record<string, string | boolean | string[]> }}
@@ -387,6 +393,7 @@ export const BOOLEAN_FLAGS = new Set([
387
393
  export function parseArgs(argv) {
388
394
  const positionals = [];
389
395
  const flags = {};
396
+ const valueFlags = VALUE_FLAGS_BY_COMMAND[argv[0]] ?? new Set();
390
397
  const setFlag = (name, value) => {
391
398
  if (Object.prototype.hasOwnProperty.call(flags, name)) {
392
399
  flags[name] = [].concat(flags[name], value);
@@ -407,7 +414,7 @@ export function parseArgs(argv) {
407
414
  }
408
415
  const name = tok.slice(2);
409
416
  const next = argv[i + 1];
410
- if (BOOLEAN_FLAGS.has(name) || next === undefined || next.startsWith("--")) {
417
+ if ((BOOLEAN_FLAGS.has(name) && !valueFlags.has(name)) || next === undefined || next.startsWith("--")) {
411
418
  flags[name] = true;
412
419
  } else {
413
420
  setFlag(name, next);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.176.13",
3
+ "version": "0.176.14",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",