ya-git-jira 2.1.0 → 2.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.
- package/bin/git-api.ts +2 -4
- package/bin/git-bump.ts +2 -4
- package/bin/git-confluence-page-search.ts +4 -6
- package/bin/git-confluence-page-show.ts +3 -5
- package/bin/git-confluence-page-update.ts +3 -5
- package/bin/git-confluence-page.ts +2 -4
- package/bin/git-confluence-space-list.ts +3 -5
- package/bin/git-confluence-space.ts +2 -4
- package/bin/git-confluence-whoami.ts +3 -5
- package/bin/git-confluence.ts +11 -4
- package/bin/git-jira-issue-list.ts +2 -4
- package/bin/git-jira-issue-show.ts +3 -5
- package/bin/git-jira-issue.ts +2 -4
- package/bin/git-jira-start.ts +2 -4
- package/bin/git-jira-whoami.ts +3 -5
- package/bin/git-jira.ts +11 -4
- package/bin/git-lab-group-list.ts +4 -6
- package/bin/git-lab-group.ts +2 -4
- package/bin/git-lab-merge-active.ts +4 -6
- package/bin/git-lab-merge-todo.ts +4 -6
- package/bin/git-lab-merge-train-list.ts +3 -5
- package/bin/git-lab-merge-train.ts +2 -4
- package/bin/git-lab-merge.ts +2 -4
- package/bin/git-lab-namespace-list.ts +3 -5
- package/bin/git-lab-namespace.ts +2 -4
- package/bin/git-lab-project-list.ts +4 -6
- package/bin/git-lab-project-mr-list.ts +4 -6
- package/bin/git-lab-project-mr.ts +2 -4
- package/bin/git-lab-project-pipeline-jobs.ts +2 -4
- package/bin/git-lab-project-pipeline-latest.ts +2 -4
- package/bin/git-lab-project-pipeline-list.ts +4 -6
- package/bin/git-lab-project-pipeline-log.ts +2 -4
- package/bin/git-lab-project-pipeline.ts +2 -4
- package/bin/git-lab-project-whereami.ts +3 -5
- package/bin/git-lab-project.ts +2 -4
- package/bin/git-lab-whoami.ts +3 -5
- package/bin/git-lab.ts +11 -4
- package/bin/gitj-install-skills.ts +2 -4
- package/bin/gitj.ts +6 -1
- package/dist/bin/git-api.js +33 -5
- package/dist/bin/git-bump.js +32 -24
- package/dist/bin/git-confluence-page-search.js +46 -26
- package/dist/bin/git-confluence-page-show.js +24 -4
- package/dist/bin/git-confluence-page-update.js +24 -4
- package/dist/bin/git-confluence-page.js +30 -16
- package/dist/bin/git-confluence-space-list.js +45 -25
- package/dist/bin/git-confluence-space.js +46 -28
- package/dist/bin/git-confluence-whoami.js +45 -25
- package/dist/bin/git-confluence.js +45 -31
- package/dist/bin/git-jira-issue-list.js +36 -24
- package/dist/bin/git-jira-issue-show.js +16 -4
- package/dist/bin/git-jira-issue.js +18 -10
- package/dist/bin/git-jira-start.js +16 -4
- package/dist/bin/git-jira-whoami.js +37 -25
- package/dist/bin/git-jira.js +32 -22
- package/dist/bin/git-lab-group-list.js +18 -6
- package/dist/bin/git-lab-group.js +19 -9
- package/dist/bin/git-lab-merge-active.js +18 -6
- package/dist/bin/git-lab-merge-todo.js +18 -6
- package/dist/bin/git-lab-merge-train-list.js +17 -5
- package/dist/bin/git-lab-merge-train.js +18 -8
- package/dist/bin/git-lab-merge.js +25 -21
- package/dist/bin/git-lab-namespace-list.js +38 -26
- package/dist/bin/git-lab-namespace.js +39 -29
- package/dist/bin/git-lab-project-list.js +18 -6
- package/dist/bin/git-lab-project-mr-list.js +18 -6
- package/dist/bin/git-lab-project-mr.js +19 -9
- package/dist/bin/git-lab-project-pipeline-jobs.js +16 -4
- package/dist/bin/git-lab-project-pipeline-latest.js +16 -4
- package/dist/bin/git-lab-project-pipeline-list.js +18 -6
- package/dist/bin/git-lab-project-pipeline-log.js +16 -4
- package/dist/bin/git-lab-project-pipeline.js +22 -18
- package/dist/bin/git-lab-project-whereami.js +17 -5
- package/dist/bin/git-lab-project.js +32 -38
- package/dist/bin/git-lab-whoami.js +17 -5
- package/dist/bin/git-lab.js +61 -81
- package/dist/bin/gitj-install-skills.js +21 -11
- package/dist/bin/gitj.js +154 -153
- package/dist/index.js +32 -1
- package/lib/api.ts +19 -1
- package/lib/confluence/api.ts +12 -0
- package/lib/confluence/config.ts +3 -3
- package/lib/gitlab/api.ts +4 -0
- package/lib/gitlab/config.ts +2 -2
- package/lib/is_main.ts +11 -0
- package/lib/jira.ts +7 -3
- package/package.json +1 -1
|
@@ -2497,7 +2497,7 @@ async function getGitlabConfig() {
|
|
|
2497
2497
|
const host = await hostP || "gitlab.com";
|
|
2498
2498
|
const user = await gitEmailP || await gitlabEmailP;
|
|
2499
2499
|
if (!user)
|
|
2500
|
-
throw new Error("Neither user.email nor gitlab.
|
|
2500
|
+
throw new Error("Neither user.email nor gitlab.user in git config");
|
|
2501
2501
|
const token = await tokenP;
|
|
2502
2502
|
if (!token)
|
|
2503
2503
|
throw new Error("gitlab.token not in git config");
|
|
@@ -2534,6 +2534,10 @@ async function gitlabApi(endpoint) {
|
|
|
2534
2534
|
};
|
|
2535
2535
|
let request = new Request(uri, options);
|
|
2536
2536
|
const response = await fetch(request);
|
|
2537
|
+
if (!response.ok) {
|
|
2538
|
+
const text = await response.text();
|
|
2539
|
+
throw new Error(`GitLab API ${endpoint} failed (${response.status}): ${text}`);
|
|
2540
|
+
}
|
|
2537
2541
|
let link = getNextLink(response.headers.get("Link"));
|
|
2538
2542
|
let partial = await response.json();
|
|
2539
2543
|
let result = partial;
|
|
@@ -2696,6 +2700,16 @@ function isMain(self) {
|
|
|
2696
2700
|
const result = argv1Base === selfBase;
|
|
2697
2701
|
return result;
|
|
2698
2702
|
}
|
|
2703
|
+
async function runMain(self, create) {
|
|
2704
|
+
if (!isMain(self))
|
|
2705
|
+
return;
|
|
2706
|
+
try {
|
|
2707
|
+
await create().parseAsync(Bun.argv);
|
|
2708
|
+
} catch (err) {
|
|
2709
|
+
console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
|
|
2710
|
+
process.exit(1);
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2699
2713
|
|
|
2700
2714
|
// bin/git-lab-project-pipeline-jobs.ts
|
|
2701
2715
|
var version = await getPackageVersion();
|
|
@@ -2725,9 +2739,7 @@ function create() {
|
|
|
2725
2739
|
return program2;
|
|
2726
2740
|
}
|
|
2727
2741
|
var git_lab_project_pipeline_jobs_default = create;
|
|
2728
|
-
|
|
2729
|
-
await create().parseAsync(Bun.argv);
|
|
2730
|
-
}
|
|
2742
|
+
await runMain("git-lab-project-pipeline-jobs", create);
|
|
2731
2743
|
|
|
2732
2744
|
// bin/git-lab-project-pipeline-latest.ts
|
|
2733
2745
|
var version2 = await getPackageVersion();
|
|
@@ -2759,9 +2771,7 @@ function create2() {
|
|
|
2759
2771
|
return program2;
|
|
2760
2772
|
}
|
|
2761
2773
|
var git_lab_project_pipeline_latest_default = create2;
|
|
2762
|
-
|
|
2763
|
-
await create2().parseAsync(Bun.argv);
|
|
2764
|
-
}
|
|
2774
|
+
await runMain("git-lab-project-pipeline-latest", create2);
|
|
2765
2775
|
|
|
2766
2776
|
// bin/git-lab-project-pipeline-list.ts
|
|
2767
2777
|
var import_debug2 = __toESM(require_src(), 1);
|
|
@@ -2777,21 +2787,19 @@ function create3() {
|
|
|
2777
2787
|
process.exit(1);
|
|
2778
2788
|
}
|
|
2779
2789
|
if (options.verbose) {
|
|
2780
|
-
console.log(pipelines);
|
|
2790
|
+
console.log(JSON.stringify(pipelines, null, 2));
|
|
2781
2791
|
} else {
|
|
2782
2792
|
let filtered = pipelines.map((p) => {
|
|
2783
2793
|
const { id, web_url, updated_at, ref, sha } = p;
|
|
2784
2794
|
return { id, web_url, updated_at, ref, sha };
|
|
2785
2795
|
});
|
|
2786
|
-
console.log(filtered);
|
|
2796
|
+
console.log(JSON.stringify(filtered, null, 2));
|
|
2787
2797
|
}
|
|
2788
2798
|
});
|
|
2789
2799
|
return program2;
|
|
2790
2800
|
}
|
|
2791
2801
|
var git_lab_project_pipeline_list_default = create3;
|
|
2792
|
-
|
|
2793
|
-
await create3().parseAsync(Bun.argv);
|
|
2794
|
-
}
|
|
2802
|
+
await runMain("git-lab-project-pipeline-list", create3);
|
|
2795
2803
|
|
|
2796
2804
|
// bin/git-lab-project-pipeline-log.ts
|
|
2797
2805
|
var version4 = await getPackageVersion();
|
|
@@ -2826,9 +2834,7 @@ function create4() {
|
|
|
2826
2834
|
return program2;
|
|
2827
2835
|
}
|
|
2828
2836
|
var git_lab_project_pipeline_log_default = create4;
|
|
2829
|
-
|
|
2830
|
-
await create4().parseAsync(Bun.argv);
|
|
2831
|
-
}
|
|
2837
|
+
await runMain("git-lab-project-pipeline-log", create4);
|
|
2832
2838
|
|
|
2833
2839
|
// bin/git-lab-project-pipeline.ts
|
|
2834
2840
|
var version5 = await getPackageVersion();
|
|
@@ -2838,9 +2844,7 @@ function create5() {
|
|
|
2838
2844
|
return program2;
|
|
2839
2845
|
}
|
|
2840
2846
|
var git_lab_project_pipeline_default = create5;
|
|
2841
|
-
|
|
2842
|
-
await create5().parseAsync(Bun.argv);
|
|
2843
|
-
}
|
|
2847
|
+
await runMain("git-lab-project-pipeline", create5);
|
|
2844
2848
|
export {
|
|
2845
2849
|
git_lab_project_pipeline_default as default,
|
|
2846
2850
|
create5 as create
|
|
@@ -2497,7 +2497,7 @@ async function getGitlabConfig() {
|
|
|
2497
2497
|
const host = await hostP || "gitlab.com";
|
|
2498
2498
|
const user = await gitEmailP || await gitlabEmailP;
|
|
2499
2499
|
if (!user)
|
|
2500
|
-
throw new Error("Neither user.email nor gitlab.
|
|
2500
|
+
throw new Error("Neither user.email nor gitlab.user in git config");
|
|
2501
2501
|
const token = await tokenP;
|
|
2502
2502
|
if (!token)
|
|
2503
2503
|
throw new Error("gitlab.token not in git config");
|
|
@@ -2534,6 +2534,10 @@ async function gitlabApi(endpoint) {
|
|
|
2534
2534
|
};
|
|
2535
2535
|
let request = new Request(uri, options);
|
|
2536
2536
|
const response = await fetch(request);
|
|
2537
|
+
if (!response.ok) {
|
|
2538
|
+
const text = await response.text();
|
|
2539
|
+
throw new Error(`GitLab API ${endpoint} failed (${response.status}): ${text}`);
|
|
2540
|
+
}
|
|
2537
2541
|
let link = getNextLink(response.headers.get("Link"));
|
|
2538
2542
|
let partial = await response.json();
|
|
2539
2543
|
let result = partial;
|
|
@@ -2634,6 +2638,16 @@ function isMain(self) {
|
|
|
2634
2638
|
const result = argv1Base === selfBase;
|
|
2635
2639
|
return result;
|
|
2636
2640
|
}
|
|
2641
|
+
async function runMain(self, create) {
|
|
2642
|
+
if (!isMain(self))
|
|
2643
|
+
return;
|
|
2644
|
+
try {
|
|
2645
|
+
await create().parseAsync(Bun.argv);
|
|
2646
|
+
} catch (err) {
|
|
2647
|
+
console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
|
|
2648
|
+
process.exit(1);
|
|
2649
|
+
}
|
|
2650
|
+
}
|
|
2637
2651
|
|
|
2638
2652
|
// bin/git-lab-project-whereami.ts
|
|
2639
2653
|
var version = await getPackageVersion();
|
|
@@ -2652,7 +2666,7 @@ function create() {
|
|
|
2652
2666
|
process.exit(1);
|
|
2653
2667
|
}
|
|
2654
2668
|
if (options.verbose) {
|
|
2655
|
-
console.log(project);
|
|
2669
|
+
console.log(JSON.stringify(project, null, 2));
|
|
2656
2670
|
} else {
|
|
2657
2671
|
const { id, name, path_with_namespace, ssh_url_to_repo } = project;
|
|
2658
2672
|
console.log({ id, name, path_with_namespace, ssh_url_to_repo });
|
|
@@ -2661,9 +2675,7 @@ function create() {
|
|
|
2661
2675
|
return program2;
|
|
2662
2676
|
}
|
|
2663
2677
|
var git_lab_project_whereami_default = create;
|
|
2664
|
-
|
|
2665
|
-
await create().parseAsync(Bun.argv);
|
|
2666
|
-
}
|
|
2678
|
+
await runMain("git-lab-project-whereami", create);
|
|
2667
2679
|
export {
|
|
2668
2680
|
git_lab_project_whereami_default as default,
|
|
2669
2681
|
create
|
|
@@ -2497,7 +2497,7 @@ async function getGitlabConfig() {
|
|
|
2497
2497
|
const host = await hostP || "gitlab.com";
|
|
2498
2498
|
const user = await gitEmailP || await gitlabEmailP;
|
|
2499
2499
|
if (!user)
|
|
2500
|
-
throw new Error("Neither user.email nor gitlab.
|
|
2500
|
+
throw new Error("Neither user.email nor gitlab.user in git config");
|
|
2501
2501
|
const token = await tokenP;
|
|
2502
2502
|
if (!token)
|
|
2503
2503
|
throw new Error("gitlab.token not in git config");
|
|
@@ -2534,6 +2534,10 @@ async function gitlabApi(endpoint) {
|
|
|
2534
2534
|
};
|
|
2535
2535
|
let request = new Request(uri, options);
|
|
2536
2536
|
const response = await fetch(request);
|
|
2537
|
+
if (!response.ok) {
|
|
2538
|
+
const text = await response.text();
|
|
2539
|
+
throw new Error(`GitLab API ${endpoint} failed (${response.status}): ${text}`);
|
|
2540
|
+
}
|
|
2537
2541
|
let link = getNextLink(response.headers.get("Link"));
|
|
2538
2542
|
let partial = await response.json();
|
|
2539
2543
|
let result = partial;
|
|
@@ -2634,6 +2638,16 @@ function isMain(self) {
|
|
|
2634
2638
|
const result = argv1Base === selfBase;
|
|
2635
2639
|
return result;
|
|
2636
2640
|
}
|
|
2641
|
+
async function runMain(self, create) {
|
|
2642
|
+
if (!isMain(self))
|
|
2643
|
+
return;
|
|
2644
|
+
try {
|
|
2645
|
+
await create().parseAsync(Bun.argv);
|
|
2646
|
+
} catch (err) {
|
|
2647
|
+
console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
|
|
2648
|
+
process.exit(1);
|
|
2649
|
+
}
|
|
2650
|
+
}
|
|
2637
2651
|
|
|
2638
2652
|
// bin/git-lab-project-list.ts
|
|
2639
2653
|
var version = await getPackageVersion();
|
|
@@ -2646,21 +2660,19 @@ function create() {
|
|
|
2646
2660
|
process.exit(1);
|
|
2647
2661
|
}
|
|
2648
2662
|
if (options.verbose) {
|
|
2649
|
-
console.log(projects);
|
|
2663
|
+
console.log(JSON.stringify(projects, null, 2));
|
|
2650
2664
|
} else {
|
|
2651
2665
|
let filtered = projects.map((p) => {
|
|
2652
2666
|
const { id, name, path_with_namespace, ssh_url_to_repo } = p;
|
|
2653
2667
|
return { id, name, path_with_namespace, ssh_url_to_repo };
|
|
2654
2668
|
});
|
|
2655
|
-
console.log(filtered);
|
|
2669
|
+
console.log(JSON.stringify(filtered, null, 2));
|
|
2656
2670
|
}
|
|
2657
2671
|
});
|
|
2658
2672
|
return program2;
|
|
2659
2673
|
}
|
|
2660
2674
|
var git_lab_project_list_default = create;
|
|
2661
|
-
|
|
2662
|
-
await create().parseAsync(Bun.argv);
|
|
2663
|
-
}
|
|
2675
|
+
await runMain("git-lab-project-list", create);
|
|
2664
2676
|
// lib/gitlab/group.ts
|
|
2665
2677
|
async function getGroups() {
|
|
2666
2678
|
return await gitlabApi(`groups`);
|
|
@@ -2748,21 +2760,19 @@ function create2() {
|
|
|
2748
2760
|
process.exit(0);
|
|
2749
2761
|
}
|
|
2750
2762
|
if (options.verbose) {
|
|
2751
|
-
console.log(mrs);
|
|
2763
|
+
console.log(JSON.stringify(mrs, null, 2));
|
|
2752
2764
|
} else {
|
|
2753
2765
|
const filtered = mrs.map((m) => {
|
|
2754
2766
|
const { iid, title, web_url, source_branch, target_branch, state, draft } = m;
|
|
2755
2767
|
return { iid, title, web_url, source_branch, target_branch, state, draft };
|
|
2756
2768
|
});
|
|
2757
|
-
console.log(filtered);
|
|
2769
|
+
console.log(JSON.stringify(filtered, null, 2));
|
|
2758
2770
|
}
|
|
2759
2771
|
});
|
|
2760
2772
|
return program2;
|
|
2761
2773
|
}
|
|
2762
2774
|
var git_lab_project_mr_list_default = create2;
|
|
2763
|
-
|
|
2764
|
-
await create2().parseAsync(Bun.argv);
|
|
2765
|
-
}
|
|
2775
|
+
await runMain("git-lab-project-mr-list", create2);
|
|
2766
2776
|
|
|
2767
2777
|
// bin/git-lab-project-mr.ts
|
|
2768
2778
|
var version3 = await getPackageVersion();
|
|
@@ -2772,9 +2782,7 @@ function create3() {
|
|
|
2772
2782
|
return program2;
|
|
2773
2783
|
}
|
|
2774
2784
|
var git_lab_project_mr_default = create3;
|
|
2775
|
-
|
|
2776
|
-
await create3().parseAsync(Bun.argv);
|
|
2777
|
-
}
|
|
2785
|
+
await runMain("git-lab-project-mr", create3);
|
|
2778
2786
|
|
|
2779
2787
|
// bin/git-lab-project-pipeline-jobs.ts
|
|
2780
2788
|
var version4 = await getPackageVersion();
|
|
@@ -2804,9 +2812,7 @@ function create4() {
|
|
|
2804
2812
|
return program2;
|
|
2805
2813
|
}
|
|
2806
2814
|
var git_lab_project_pipeline_jobs_default = create4;
|
|
2807
|
-
|
|
2808
|
-
await create4().parseAsync(Bun.argv);
|
|
2809
|
-
}
|
|
2815
|
+
await runMain("git-lab-project-pipeline-jobs", create4);
|
|
2810
2816
|
|
|
2811
2817
|
// bin/git-lab-project-pipeline-latest.ts
|
|
2812
2818
|
var version5 = await getPackageVersion();
|
|
@@ -2838,9 +2844,7 @@ function create5() {
|
|
|
2838
2844
|
return program2;
|
|
2839
2845
|
}
|
|
2840
2846
|
var git_lab_project_pipeline_latest_default = create5;
|
|
2841
|
-
|
|
2842
|
-
await create5().parseAsync(Bun.argv);
|
|
2843
|
-
}
|
|
2847
|
+
await runMain("git-lab-project-pipeline-latest", create5);
|
|
2844
2848
|
|
|
2845
2849
|
// bin/git-lab-project-pipeline-list.ts
|
|
2846
2850
|
var import_debug2 = __toESM(require_src(), 1);
|
|
@@ -2856,21 +2860,19 @@ function create6() {
|
|
|
2856
2860
|
process.exit(1);
|
|
2857
2861
|
}
|
|
2858
2862
|
if (options.verbose) {
|
|
2859
|
-
console.log(pipelines);
|
|
2863
|
+
console.log(JSON.stringify(pipelines, null, 2));
|
|
2860
2864
|
} else {
|
|
2861
2865
|
let filtered = pipelines.map((p) => {
|
|
2862
2866
|
const { id, web_url, updated_at, ref, sha } = p;
|
|
2863
2867
|
return { id, web_url, updated_at, ref, sha };
|
|
2864
2868
|
});
|
|
2865
|
-
console.log(filtered);
|
|
2869
|
+
console.log(JSON.stringify(filtered, null, 2));
|
|
2866
2870
|
}
|
|
2867
2871
|
});
|
|
2868
2872
|
return program2;
|
|
2869
2873
|
}
|
|
2870
2874
|
var git_lab_project_pipeline_list_default = create6;
|
|
2871
|
-
|
|
2872
|
-
await create6().parseAsync(Bun.argv);
|
|
2873
|
-
}
|
|
2875
|
+
await runMain("git-lab-project-pipeline-list", create6);
|
|
2874
2876
|
|
|
2875
2877
|
// bin/git-lab-project-pipeline-log.ts
|
|
2876
2878
|
var version7 = await getPackageVersion();
|
|
@@ -2905,9 +2907,7 @@ function create7() {
|
|
|
2905
2907
|
return program2;
|
|
2906
2908
|
}
|
|
2907
2909
|
var git_lab_project_pipeline_log_default = create7;
|
|
2908
|
-
|
|
2909
|
-
await create7().parseAsync(Bun.argv);
|
|
2910
|
-
}
|
|
2910
|
+
await runMain("git-lab-project-pipeline-log", create7);
|
|
2911
2911
|
|
|
2912
2912
|
// bin/git-lab-project-pipeline.ts
|
|
2913
2913
|
var version8 = await getPackageVersion();
|
|
@@ -2917,9 +2917,7 @@ function create8() {
|
|
|
2917
2917
|
return program2;
|
|
2918
2918
|
}
|
|
2919
2919
|
var git_lab_project_pipeline_default = create8;
|
|
2920
|
-
|
|
2921
|
-
await create8().parseAsync(Bun.argv);
|
|
2922
|
-
}
|
|
2920
|
+
await runMain("git-lab-project-pipeline", create8);
|
|
2923
2921
|
|
|
2924
2922
|
// bin/git-lab-project-whereami.ts
|
|
2925
2923
|
var version9 = await getPackageVersion();
|
|
@@ -2938,7 +2936,7 @@ function create9() {
|
|
|
2938
2936
|
process.exit(1);
|
|
2939
2937
|
}
|
|
2940
2938
|
if (options.verbose) {
|
|
2941
|
-
console.log(project2);
|
|
2939
|
+
console.log(JSON.stringify(project2, null, 2));
|
|
2942
2940
|
} else {
|
|
2943
2941
|
const { id, name, path_with_namespace, ssh_url_to_repo } = project2;
|
|
2944
2942
|
console.log({ id, name, path_with_namespace, ssh_url_to_repo });
|
|
@@ -2947,9 +2945,7 @@ function create9() {
|
|
|
2947
2945
|
return program2;
|
|
2948
2946
|
}
|
|
2949
2947
|
var git_lab_project_whereami_default = create9;
|
|
2950
|
-
|
|
2951
|
-
await create9().parseAsync(Bun.argv);
|
|
2952
|
-
}
|
|
2948
|
+
await runMain("git-lab-project-whereami", create9);
|
|
2953
2949
|
|
|
2954
2950
|
// bin/git-lab-project.ts
|
|
2955
2951
|
var version10 = await getPackageVersion();
|
|
@@ -2961,9 +2957,7 @@ function create10() {
|
|
|
2961
2957
|
return program2;
|
|
2962
2958
|
}
|
|
2963
2959
|
var git_lab_project_default = create10;
|
|
2964
|
-
|
|
2965
|
-
await create10().parseAsync(Bun.argv);
|
|
2966
|
-
}
|
|
2960
|
+
await runMain("git-lab-project", create10);
|
|
2967
2961
|
export {
|
|
2968
2962
|
git_lab_project_default as default,
|
|
2969
2963
|
create10 as create
|
|
@@ -1887,7 +1887,7 @@ async function getGitlabConfig() {
|
|
|
1887
1887
|
const host = await hostP || "gitlab.com";
|
|
1888
1888
|
const user = await gitEmailP || await gitlabEmailP;
|
|
1889
1889
|
if (!user)
|
|
1890
|
-
throw new Error("Neither user.email nor gitlab.
|
|
1890
|
+
throw new Error("Neither user.email nor gitlab.user in git config");
|
|
1891
1891
|
const token = await tokenP;
|
|
1892
1892
|
if (!token)
|
|
1893
1893
|
throw new Error("gitlab.token not in git config");
|
|
@@ -1924,6 +1924,10 @@ async function gitlabApi(endpoint) {
|
|
|
1924
1924
|
};
|
|
1925
1925
|
let request = new Request(uri, options);
|
|
1926
1926
|
const response = await fetch(request);
|
|
1927
|
+
if (!response.ok) {
|
|
1928
|
+
const text = await response.text();
|
|
1929
|
+
throw new Error(`GitLab API ${endpoint} failed (${response.status}): ${text}`);
|
|
1930
|
+
}
|
|
1927
1931
|
let link = getNextLink(response.headers.get("Link"));
|
|
1928
1932
|
let partial = await response.json();
|
|
1929
1933
|
let result = partial;
|
|
@@ -1956,6 +1960,16 @@ function isMain(self) {
|
|
|
1956
1960
|
const result = argv1Base === selfBase;
|
|
1957
1961
|
return result;
|
|
1958
1962
|
}
|
|
1963
|
+
async function runMain(self, create) {
|
|
1964
|
+
if (!isMain(self))
|
|
1965
|
+
return;
|
|
1966
|
+
try {
|
|
1967
|
+
await create().parseAsync(Bun.argv);
|
|
1968
|
+
} catch (err) {
|
|
1969
|
+
console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
|
|
1970
|
+
process.exit(1);
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1959
1973
|
|
|
1960
1974
|
// bin/git-lab-whoami.ts
|
|
1961
1975
|
var version = await getPackageVersion();
|
|
@@ -1968,7 +1982,7 @@ function create() {
|
|
|
1968
1982
|
process.exit(1);
|
|
1969
1983
|
}
|
|
1970
1984
|
if (options.verbose) {
|
|
1971
|
-
console.log(user);
|
|
1985
|
+
console.log(JSON.stringify(user, null, 2));
|
|
1972
1986
|
process.exit(0);
|
|
1973
1987
|
} else {
|
|
1974
1988
|
console.log(user.username);
|
|
@@ -1977,9 +1991,7 @@ function create() {
|
|
|
1977
1991
|
return program2;
|
|
1978
1992
|
}
|
|
1979
1993
|
var git_lab_whoami_default = create;
|
|
1980
|
-
|
|
1981
|
-
await create().parseAsync(Bun.argv);
|
|
1982
|
-
}
|
|
1994
|
+
await runMain("git-lab-whoami", create);
|
|
1983
1995
|
export {
|
|
1984
1996
|
git_lab_whoami_default as default,
|
|
1985
1997
|
create
|