@kaynooo/cli-forgejo 0.30.7 → 0.30.8

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/dist/cli.js +23 -13
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -734,11 +734,20 @@ function wholeNumber(value, name, fallback, min = 1) {
734
734
  badUsage(`${name.startsWith("<") ? name : `--${name}`} takes a whole number from ${min}, not ${value}`);
735
735
  return number;
736
736
  }
737
+ function durationMs(text, unit) {
738
+ if (BARE_DURATION.test(text))
739
+ return Number(text) * UNIT_MS[unit];
740
+ if (!DURATION.test(text))
741
+ return 0;
742
+ let ms = 0;
743
+ for (const [, amount, part] of text.matchAll(DURATION_PART))
744
+ ms += Number(amount) * UNIT_MS[part];
745
+ return ms;
746
+ }
737
747
  function duration(value, name, fallback, unit = "s") {
738
748
  if (value === undefined)
739
749
  return fallback;
740
- const match = DURATION.exec(value.trim());
741
- const ms = match === null ? 0 : Number(match[1]) * UNIT_MS[match[2] ?? unit];
750
+ const ms = durationMs(value.trim(), unit);
742
751
  if (ms < 1)
743
752
  badUsage(`--${name} takes a duration such as 30s, 5m, 1h or 7d, not ${value}`);
744
753
  return ms;
@@ -754,12 +763,14 @@ async function readInput(path, { noStdin = "nothing is piped on stdin" } = {}) {
754
763
  fail(`no file ${path}`);
755
764
  return file.text();
756
765
  }
757
- var WHOLE, DURATION, UNIT_MS;
766
+ var WHOLE, BARE_DURATION, DURATION, DURATION_PART, UNIT_MS;
758
767
  var init_input = __esm(() => {
759
768
  init_args();
760
769
  WHOLE = /^\d+$/;
761
- DURATION = /^(\d+(?:\.\d+)?)(ms|[smhd])?$/;
762
- UNIT_MS = { ms: 1, s: 1000, m: 60000, h: 3600000, d: 86400000 };
770
+ BARE_DURATION = /^\d+(?:\.\d+)?$/;
771
+ DURATION = /^(?:\d+(?:\.\d+)?(?:ms|min|[smhd]))+$/;
772
+ DURATION_PART = /(\d+(?:\.\d+)?)(ms|min|[smhd])/g;
773
+ UNIT_MS = { ms: 1, s: 1000, m: 60000, min: 60000, h: 3600000, d: 86400000 };
763
774
  });
764
775
 
765
776
  // ../kit/src/args.ts
@@ -3691,10 +3702,11 @@ A claim shows its boxes left, and one no live session holds also the latest comm
3691
3702
  A lane's claim (lane-<n>-<issue>) is held while the session whose name ends in -<n> runs.`;
3692
3703
  var boardExits = [[0, "it listed them"], [1, "the issues cannot be read"], [2, "a usage error"]];
3693
3704
  var BOARD_LIMIT = 30;
3705
+ var INLINE_IGNORE_CASE = /^\(\?i\)/;
3694
3706
  var boardOptions = {
3695
3707
  labels: { type: "string", short: "L", description: "only issues with these labels, comma separated" },
3696
3708
  milestone: { type: "string", short: "m", description: "only issues of this milestone, a title or an id" },
3697
- query: { type: "string", description: "only issues whose title matches this, a case-insensitive regex such as dom|eager" },
3709
+ query: { type: "string", short: "q", description: "only issues whose title matches this, a case-insensitive regex such as dom|eager" },
3698
3710
  state: { type: "string", choices: ["available", "taken", "away"], description: "only issues in this state (away: claimed, no live session here)" },
3699
3711
  ...limitOptions(BOARD_LIMIT),
3700
3712
  json: jsonOption("number, title, labels, state, holder, since, session, boxesTotal, boxesLeft and note (author, at, body of the latest comment that is not a claim)"),
@@ -3710,7 +3722,7 @@ async function board(args) {
3710
3722
  const limit = limitOf(values, BOARD_LIMIT);
3711
3723
  let query;
3712
3724
  try {
3713
- query = values.query === undefined ? undefined : new RegExp(values.query, "i");
3725
+ query = values.query === undefined ? undefined : new RegExp(values.query.replace(INLINE_IGNORE_CASE, ""), "i");
3714
3726
  } catch (error) {
3715
3727
  fail(`--query: ${error instanceof Error ? error.message : String(error)}`);
3716
3728
  }
@@ -5185,11 +5197,11 @@ ${open.map((issue) => ` #${issue.number} ${truncate(issue.title, TITLE_WIDTH3)}
5185
5197
  console.log(good(`closed milestone ${found.title}`));
5186
5198
  return 0;
5187
5199
  }
5188
- var showUsage = `ft milestone <title|id>
5200
+ var showUsage = `ft milestone [<title|id>]
5189
5201
  ft milestone new <title> [-d <text>] [--due <YYYY-MM-DD>]
5190
5202
  ft milestone close <title|id> [--force]
5191
5203
 
5192
- Shows a milestone with its open issues as \`ft board\` does: available, taken by a session running here, or claimed by one gone, each with its boxes left, at most 30 of each kind (--full for all).
5204
+ Shows a milestone with its open issues as \`ft board\` does: available, taken by a session running here, or claimed by one gone, each with its boxes left, at most 30 of each kind (--full for all); with no title or id it lists the milestones as \`ft milestones\` does.
5193
5205
  \`ft milestone new\` and \`ft milestone close\` have their own --help; a milestone titled new or close is named by its id.`;
5194
5206
  var showExits = [[0, "it showed the milestone"], [1, "it cannot be read"], [2, "a usage error or an unknown milestone"]];
5195
5207
  var showOptions = {
@@ -5202,9 +5214,7 @@ async function show(args) {
5202
5214
  const { values, positionals } = parsed;
5203
5215
  const reference = positionals.join(" ").trim();
5204
5216
  if (reference === "")
5205
- fail(`name the milestone, or see them all with \`ft milestones\`
5206
-
5207
- ${showUsage}`);
5217
+ return milestones(args);
5208
5218
  const found = await findMilestone(reference, values.repo);
5209
5219
  const [issues, sessions] = await Promise.all([openIssues(undefined, values.repo, found.id), liveSessions()]);
5210
5220
  const rows = await boardRows(issues, sessions, values.repo);
@@ -5905,5 +5915,5 @@ process35.exitCode = await runCli({
5905
5915
  milestone: { run: milestone, summary: "show a milestone's issues like the board, `new` creates one, `close` closes it", group: "Repo" },
5906
5916
  remote: { run: remote, summary: "check or fix an origin using an ssh alias tea cannot match", group: "Repo" }
5907
5917
  },
5908
- aliases: { show: "issue", view: "issue" }
5918
+ aliases: { show: "issue", view: "issue", issues: "board" }
5909
5919
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kaynooo/cli-forgejo",
3
3
  "type": "module",
4
- "version": "0.30.7",
4
+ "version": "0.30.8",
5
5
  "description": "ft: Forgejo CI runs, logs, releases and issue checklists from the terminal, through tea.",
6
6
  "author": "Kaynooo <contact@kaynooo.fr>",
7
7
  "license": "MIT",
@@ -31,6 +31,6 @@
31
31
  "@kaynooo/utils": "3.1.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@kaynooo/cli-kit": "0.46.1"
34
+ "@kaynooo/cli-kit": "0.46.2"
35
35
  }
36
36
  }