@snelusha/noto 1.1.0 → 1.1.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 (3) hide show
  1. package/README.md +12 -1
  2. package/dist/index.js +30 -7
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -105,7 +105,18 @@ Switch between branches in you git repo with an interactive prompt:
105
105
  ```bash
106
106
  noto checkout
107
107
  ```
108
-
108
+
109
+ To copy the selected branch to your clipboard immediately after choosing it, use the new `-c` flag:
110
+
111
+ ```bash
112
+ noto checkout -c
113
+ ```
114
+
115
+ To list all branches, including remote branches, use the -r flag (note: while remote branches are listed, you currently cannot checkout to remote branches):
116
+
117
+ ```bash
118
+ noto checkout -r
119
+ ```
109
120
 
110
121
  ## Pro Tips
111
122
 
package/dist/index.js CHANGED
@@ -208,12 +208,10 @@ var getCurrentBranch = async () => {
208
208
  return null;
209
209
  }
210
210
  };
211
- var getBranches = async () => {
211
+ var getBranches = async (remote) => {
212
212
  try {
213
213
  const branches = await git.branch();
214
- return Object.keys(branches.branches).filter(
215
- (b) => !b.startsWith("remotes/")
216
- );
214
+ return remote ? branches.all : Object.keys(branches.branches).filter((b) => !b.startsWith("remotes/"));
217
215
  } catch {
218
216
  return null;
219
217
  }
@@ -586,11 +584,26 @@ var prev_default = command2;
586
584
  // src/commands/checkout.ts
587
585
  import * as p5 from "@clack/prompts";
588
586
  import color5 from "picocolors";
587
+ import clipboard3 from "clipboardy";
589
588
  import dedent5 from "dedent";
590
589
  var command3 = {
591
590
  name: "checkout",
592
591
  description: "checkout a branch",
593
592
  usage: "checkout [options]",
593
+ options: [
594
+ {
595
+ type: Boolean,
596
+ flag: "--copy",
597
+ alias: "-c",
598
+ description: "copy the selected branch to clipboard"
599
+ },
600
+ {
601
+ type: Boolean,
602
+ flag: "--remote",
603
+ alias: "-r",
604
+ description: "list branches including remotes"
605
+ }
606
+ ],
594
607
  execute: withRepository(
595
608
  async (options) => {
596
609
  if (!options.isRepo) {
@@ -600,7 +613,8 @@ var command3 = {
600
613
  );
601
614
  return await exit(1);
602
615
  }
603
- const branches = await getBranches();
616
+ const remote = options["--remote"];
617
+ const branches = await getBranches(remote);
604
618
  if (!branches) {
605
619
  p5.log.error("failed to fetch branches");
606
620
  return await exit(1);
@@ -625,6 +639,15 @@ var command3 = {
625
639
  p5.log.error("no branch selected");
626
640
  return await exit(1);
627
641
  }
642
+ if (options["--copy"]) {
643
+ clipboard3.writeSync(branch);
644
+ p5.log.success(`copied ${color5.green(branch)} to clipboard`);
645
+ return await exit(0);
646
+ }
647
+ if (remote && branch.startsWith("remotes/")) {
648
+ p5.log.error(color5.red("cannot checkout remote branch"));
649
+ return await exit(1);
650
+ }
628
651
  if (branch === currentBranch) {
629
652
  p5.log.error(`${color5.red("already on branch")}`);
630
653
  return await exit(1);
@@ -685,7 +708,7 @@ var model = {
685
708
  name: "model",
686
709
  description: "configure model",
687
710
  usage: "noto config model [options]",
688
- execute: async (options) => {
711
+ execute: async () => {
689
712
  const model2 = await p6.select({
690
713
  message: "select a model",
691
714
  initialValue: (await StorageManager.get()).llm?.model,
@@ -807,7 +830,7 @@ var listCommand = () => {
807
830
  };
808
831
 
809
832
  // package.json
810
- var version = "1.1.0";
833
+ var version = "1.1.1";
811
834
 
812
835
  // src/index.ts
813
836
  var globalSpec = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snelusha/noto",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Generate clean commit messages in a snap! ✨",
5
5
  "license": "MIT",
6
6
  "type": "module",