@kaynooo/cli-forgejo 0.12.0 → 0.12.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.
Files changed (2) hide show
  1. package/dist/cli.js +14 -8
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1456,7 +1456,7 @@ async function currentSession(sessions) {
1456
1456
  return;
1457
1457
  }
1458
1458
  // package.json
1459
- var version = "0.12.0";
1459
+ var version = "0.12.1";
1460
1460
 
1461
1461
  // src/args.ts
1462
1462
  var repoOption = {
@@ -2670,15 +2670,21 @@ async function issue(args) {
2670
2670
  return 0;
2671
2671
  }
2672
2672
  var ISSUE_REFERENCE = /^#?\d+$/;
2673
- async function targetIssue(positionals, repo, usage) {
2673
+ async function chooseTarget(positionals, held, usage) {
2674
2674
  if (positionals[0] !== undefined && ISSUE_REFERENCE.test(positionals[0]))
2675
- return { number: issueNumber(positionals[0], usage), rest: positionals.slice(1) };
2676
- const [only, ...others] = await heldIssues(repo);
2675
+ return { number: issueNumber(positionals[0], usage), rest: positionals.slice(1), defaulted: false };
2676
+ const [only, ...others] = await held();
2677
2677
  if (only === undefined || others.length > 0)
2678
- fail(`${only === undefined ? "an issue number is needed, this session holds none" : "an issue number is needed, this session holds several"}
2678
+ fail(`an issue number is needed, this session holds ${only === undefined ? "none" : "several"}
2679
2679
 
2680
2680
  ${usage}`);
2681
- return { number: only, rest: positionals };
2681
+ return { number: only, rest: positionals, defaulted: true };
2682
+ }
2683
+ async function targetIssue(positionals, repo, usage) {
2684
+ const { number, rest, defaulted } = await chooseTarget(positionals, async () => heldIssues(repo), usage);
2685
+ if (defaulted)
2686
+ warn(`using #${number}, the issue this session holds`);
2687
+ return { number, rest };
2682
2688
  }
2683
2689
  var noteOptions = {
2684
2690
  message: { type: "string", short: "m", description: "comment this text on the issue" },
@@ -2793,7 +2799,7 @@ var tickUsage = `ft tick [<n>] <box>...
2793
2799
  Ticks checklist boxes of issue <n>, each given by its number from \`ft issue\` or by text matching exactly one box, then posts the -m or -F comment.
2794
2800
  With --closed, ticks instead every box opening with \`#<issue>\` whose issue is closed, as a release plan lists them.
2795
2801
 
2796
- Without <n> (a first argument that is not a number) it takes the one open issue this session holds (\`ft take\`), and exits 2 when it holds none or several.
2802
+ Without <n> (a first argument that is not a number) it takes the one open issue this session holds (\`ft take\`), and exits 2 when it holds none or several, saying which issue it used. A first argument that is a number is always the issue, so boxes named by number need it.
2797
2803
 
2798
2804
  Exits 0 when it ticked the boxes, 1 when Forgejo refuses, 2 on a usage error or a box matching none or several.`;
2799
2805
  var tickOptions = {
@@ -2846,7 +2852,7 @@ ${tickUsage}`);
2846
2852
  var commentUsage = `ft comment [<n>] [text]
2847
2853
 
2848
2854
  Posts a comment on issue <n>: the text given, -F <file>, or stdin when neither is, so a heredoc needs no escaping.
2849
- Without <n> (a first argument that is not a number) it takes the one open issue this session holds (\`ft take\`), and exits 2 when it holds none or several.
2855
+ Without <n> (a first argument that is not a number) it takes the one open issue this session holds (\`ft take\`), and exits 2 when it holds none or several, saying which issue it used. A first argument that is a number is always the issue, so boxes named by number need it.
2850
2856
 
2851
2857
  Exits 0 when it posted the comment, 1 when Forgejo refuses, 2 on a usage error.`;
2852
2858
  var commentOptions = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kaynooo/cli-forgejo",
3
3
  "type": "module",
4
- "version": "0.12.0",
4
+ "version": "0.12.1",
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",