@aaronshaf/ger 1.2.7 → 1.2.9

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aaronshaf/ger",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
4
4
  "description": "Gerrit CLI",
5
5
  "main": "src/ger.ts",
6
6
  "bin": {
@@ -100,7 +100,7 @@ function output(
100
100
  .filter(Boolean)
101
101
  .map((str) => `[${str}]`) as string[];
102
102
 
103
- const approvals = gerritData.currentPatchSet.approvals.map((a) => {
103
+ const approvals = (gerritData.currentPatchSet.approvals || []).map((a) => {
104
104
  let description = a.description;
105
105
  if (a.type === "SUBM" && !description) {
106
106
  description = "Submitted";
package/src/ger.ts CHANGED
@@ -12,6 +12,7 @@ program
12
12
  .command("branch")
13
13
  .description("Get a list of local branches with Gerrit info")
14
14
  .option("-v", "Show extra information, i.e. approvals")
15
+ .option("-d", "Prompt to delete already-merged branches")
15
16
  .action((
16
17
  _program: any,
17
18
  ) => {
package/src/types.d.ts CHANGED
@@ -19,7 +19,7 @@ export type GerritApproval = {
19
19
 
20
20
  export type GerritData = {
21
21
  currentPatchSet: {
22
- approvals: GerritApproval[]
22
+ approvals?: GerritApproval[]
23
23
  }
24
24
  id: string;
25
25
  status: 'MERGED' | 'ABANDONED';
package/src/utils.ts CHANGED
@@ -12,22 +12,19 @@ export function bold(text: string) {
12
12
  return `\x1b[1m${text}\x1b[0m`;
13
13
  }
14
14
 
15
- // grey with transparent background
16
15
  export function grey(text: string) {
17
16
  return `\x1b[37m\x1b[40m${text}\x1b[0m`;
18
17
  }
19
18
 
20
- // brown with transparent background
21
19
  export function darkBrown(text: string) {
22
20
  // return `\x1b[43m\x1b[30m${text}\x1b[0m`;
23
21
  return `\x1b[33m${text}\x1b[0m`;
24
22
  }
25
23
 
26
24
  export function green(text: string) {
27
- return `\x1b[42m\x1b[30m${text}\x1b[0m`;
25
+ return `\x1b[32m${text}\x1b[0m`;
28
26
  }
29
27
 
30
- // yellow text with transparent background
31
28
  export function yellow(text: string) {
32
29
  // return `\x1b[33m\x1b[40m${text}\x1b[0m`;
33
30
  return `\x1b[33m${text}\x1b[0m`;
@@ -63,7 +60,7 @@ export function getGerritData(changeIds: string[]) {
63
60
  }
64
61
 
65
62
  // Run the gerrit query command
66
- const gerrit_output = execSync(
63
+ const gerritData = execSync(
67
64
  `ssh gerrit "gerrit query --current-patch-set --format=JSON '${query}'"`
68
65
  )
69
66
  .toString()
@@ -71,7 +68,7 @@ export function getGerritData(changeIds: string[]) {
71
68
  .split("\n")
72
69
  .map((line) => JSON.parse(line) as GerritData);
73
70
 
74
- return gerrit_output.reduce<GerritDataMap>((acc, change) => {
71
+ return gerritData.reduce<GerritDataMap>((acc, change) => {
75
72
  return {
76
73
  ...acc,
77
74
  [change.id]: change,