@pilatos/bitbucket-cli 1.15.0 → 1.16.0
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/README.md +2 -0
- package/dist/index.js +291 -10
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -17440,6 +17440,8 @@ var ServiceTokens = {
|
|
|
17440
17440
|
AddDefaultReviewerCommand: "AddDefaultReviewerCommand",
|
|
17441
17441
|
RemoveDefaultReviewerCommand: "RemoveDefaultReviewerCommand",
|
|
17442
17442
|
DefaultReviewerService: "DefaultReviewerService",
|
|
17443
|
+
UrlBuilderService: "UrlBuilderService",
|
|
17444
|
+
BrowseCommand: "BrowseCommand",
|
|
17443
17445
|
CreatePRCommand: "CreatePRCommand",
|
|
17444
17446
|
ListPRsCommand: "ListPRsCommand",
|
|
17445
17447
|
ViewPRCommand: "ViewPRCommand",
|
|
@@ -17823,6 +17825,9 @@ class GitService {
|
|
|
17823
17825
|
async getCurrentBranch() {
|
|
17824
17826
|
return this.execOrError(["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
17825
17827
|
}
|
|
17828
|
+
async getCurrentCommit() {
|
|
17829
|
+
return this.execOrError(["rev-parse", "HEAD"]);
|
|
17830
|
+
}
|
|
17826
17831
|
async getRemoteUrl(remote = "origin") {
|
|
17827
17832
|
const result = await this.exec(["remote", "get-url", remote]);
|
|
17828
17833
|
if (result.exitCode !== 0) {
|
|
@@ -23376,6 +23381,67 @@ function accountToEntry(account) {
|
|
|
23376
23381
|
nickname: asUser.nickname
|
|
23377
23382
|
};
|
|
23378
23383
|
}
|
|
23384
|
+
// src/services/url-builder.service.ts
|
|
23385
|
+
var BITBUCKET_WEB_BASE = "https://bitbucket.org";
|
|
23386
|
+
function encodePathSegments(path3) {
|
|
23387
|
+
return path3.split("/").map((segment) => encodeURIComponent(segment)).join("/");
|
|
23388
|
+
}
|
|
23389
|
+
|
|
23390
|
+
class UrlBuilderService {
|
|
23391
|
+
base;
|
|
23392
|
+
constructor(base = BITBUCKET_WEB_BASE) {
|
|
23393
|
+
this.base = base.replace(/\/+$/, "");
|
|
23394
|
+
}
|
|
23395
|
+
repo(ctx) {
|
|
23396
|
+
return this.repoBase(ctx);
|
|
23397
|
+
}
|
|
23398
|
+
src(ctx, branch, path3, line) {
|
|
23399
|
+
const encodedBranch = encodeURIComponent(branch);
|
|
23400
|
+
const trimmedPath = path3?.replace(/^\/+/, "").replace(/\/+$/, "") ?? "";
|
|
23401
|
+
const pathPart = trimmedPath ? `/${encodePathSegments(trimmedPath)}` : "/";
|
|
23402
|
+
const lineFragment = typeof line === "number" && Number.isFinite(line) && line > 0 ? `#lines-${line}` : "";
|
|
23403
|
+
return `${this.repoBase(ctx)}/src/${encodedBranch}${pathPart}${lineFragment}`;
|
|
23404
|
+
}
|
|
23405
|
+
branchList(ctx) {
|
|
23406
|
+
return `${this.repoBase(ctx)}/branches/`;
|
|
23407
|
+
}
|
|
23408
|
+
commit(ctx, sha) {
|
|
23409
|
+
return `${this.repoBase(ctx)}/commits/${encodeURIComponent(sha)}`;
|
|
23410
|
+
}
|
|
23411
|
+
commitList(ctx) {
|
|
23412
|
+
return `${this.repoBase(ctx)}/commits/`;
|
|
23413
|
+
}
|
|
23414
|
+
pullRequest(ctx, id) {
|
|
23415
|
+
return `${this.repoBase(ctx)}/pull-requests/${id}`;
|
|
23416
|
+
}
|
|
23417
|
+
pullRequestList(ctx) {
|
|
23418
|
+
return `${this.repoBase(ctx)}/pull-requests/`;
|
|
23419
|
+
}
|
|
23420
|
+
pipelinesHome(ctx) {
|
|
23421
|
+
return `${this.repoBase(ctx)}/pipelines`;
|
|
23422
|
+
}
|
|
23423
|
+
pipelineRun(ctx, idOrUuid) {
|
|
23424
|
+
return `${this.repoBase(ctx)}/pipelines/results/${encodeURIComponent(idOrUuid)}`;
|
|
23425
|
+
}
|
|
23426
|
+
downloads(ctx) {
|
|
23427
|
+
return `${this.repoBase(ctx)}/downloads/`;
|
|
23428
|
+
}
|
|
23429
|
+
issue(ctx, id) {
|
|
23430
|
+
return `${this.repoBase(ctx)}/issues/${id}`;
|
|
23431
|
+
}
|
|
23432
|
+
issueList(ctx) {
|
|
23433
|
+
return `${this.repoBase(ctx)}/issues`;
|
|
23434
|
+
}
|
|
23435
|
+
wiki(ctx) {
|
|
23436
|
+
return `${this.repoBase(ctx)}/wiki`;
|
|
23437
|
+
}
|
|
23438
|
+
settings(ctx) {
|
|
23439
|
+
return `${this.repoBase(ctx)}/admin`;
|
|
23440
|
+
}
|
|
23441
|
+
repoBase(ctx) {
|
|
23442
|
+
return `${this.base}/${encodeURIComponent(ctx.workspace)}/${encodeURIComponent(ctx.repoSlug)}`;
|
|
23443
|
+
}
|
|
23444
|
+
}
|
|
23379
23445
|
// src/bootstrap.ts
|
|
23380
23446
|
import { createRequire } from "module";
|
|
23381
23447
|
|
|
@@ -30451,6 +30517,193 @@ class UninstallCompletionCommand extends BaseCommand {
|
|
|
30451
30517
|
}
|
|
30452
30518
|
}
|
|
30453
30519
|
|
|
30520
|
+
// src/commands/browse.command.ts
|
|
30521
|
+
var SHA_PATTERN = /^[0-9a-f]{7,40}$/i;
|
|
30522
|
+
var PR_NUMBER_PATTERN = /^\d+$/;
|
|
30523
|
+
var PATH_LINE_PATTERN = /^(.+):(\d+)$/;
|
|
30524
|
+
|
|
30525
|
+
class BrowseCommand extends BaseCommand {
|
|
30526
|
+
contextService;
|
|
30527
|
+
gitService;
|
|
30528
|
+
urlBuilder;
|
|
30529
|
+
name = "browse";
|
|
30530
|
+
description = "Open a Bitbucket page (repo, file, PR, commit, etc.) in your browser";
|
|
30531
|
+
constructor(contextService, gitService, urlBuilder, output) {
|
|
30532
|
+
super(output);
|
|
30533
|
+
this.contextService = contextService;
|
|
30534
|
+
this.gitService = gitService;
|
|
30535
|
+
this.urlBuilder = urlBuilder;
|
|
30536
|
+
}
|
|
30537
|
+
async execute(options, context) {
|
|
30538
|
+
const repoContext = await this.contextService.requireRepoContext({
|
|
30539
|
+
...context.globalOptions,
|
|
30540
|
+
...options
|
|
30541
|
+
});
|
|
30542
|
+
this.validateFlagCombination(options);
|
|
30543
|
+
const url2 = await this.resolveUrl(options, repoContext);
|
|
30544
|
+
const useJson = Boolean(context.globalOptions.json);
|
|
30545
|
+
const printOnly = options.browser === false;
|
|
30546
|
+
if (useJson) {
|
|
30547
|
+
await this.output.json({ url: url2 });
|
|
30548
|
+
return { url: url2, opened: false };
|
|
30549
|
+
}
|
|
30550
|
+
if (printOnly) {
|
|
30551
|
+
this.output.text(url2);
|
|
30552
|
+
return { url: url2, opened: false };
|
|
30553
|
+
}
|
|
30554
|
+
await this.openInBrowser(url2);
|
|
30555
|
+
return { url: url2, opened: true };
|
|
30556
|
+
}
|
|
30557
|
+
async resolveUrl(options, ctx) {
|
|
30558
|
+
if (options.pr !== undefined) {
|
|
30559
|
+
return this.urlBuilder.pullRequest(ctx, this.parsePositiveInt(options.pr, "pr"));
|
|
30560
|
+
}
|
|
30561
|
+
if (options.prs || options.pullRequests) {
|
|
30562
|
+
return this.urlBuilder.pullRequestList(ctx);
|
|
30563
|
+
}
|
|
30564
|
+
if (options.branches) {
|
|
30565
|
+
return this.urlBuilder.branchList(ctx);
|
|
30566
|
+
}
|
|
30567
|
+
if (options.commits) {
|
|
30568
|
+
return this.urlBuilder.commitList(ctx);
|
|
30569
|
+
}
|
|
30570
|
+
if (options.commit !== undefined) {
|
|
30571
|
+
const sha = typeof options.commit === "string" && options.commit.length > 0 ? options.commit : await this.gitService.getCurrentCommit();
|
|
30572
|
+
return this.urlBuilder.commit(ctx, sha);
|
|
30573
|
+
}
|
|
30574
|
+
if (options.pipelines) {
|
|
30575
|
+
return this.urlBuilder.pipelinesHome(ctx);
|
|
30576
|
+
}
|
|
30577
|
+
if (options.pipeline !== undefined) {
|
|
30578
|
+
const value = options.pipeline.trim();
|
|
30579
|
+
if (value.length === 0) {
|
|
30580
|
+
throw new BBError({
|
|
30581
|
+
code: 5002 /* VALIDATION_INVALID */,
|
|
30582
|
+
message: this.appendHelpHint("--pipeline requires a run id or uuid.")
|
|
30583
|
+
});
|
|
30584
|
+
}
|
|
30585
|
+
return this.urlBuilder.pipelineRun(ctx, value);
|
|
30586
|
+
}
|
|
30587
|
+
if (options.downloads) {
|
|
30588
|
+
return this.urlBuilder.downloads(ctx);
|
|
30589
|
+
}
|
|
30590
|
+
if (options.issue !== undefined) {
|
|
30591
|
+
return this.urlBuilder.issue(ctx, this.parsePositiveInt(options.issue, "issue"));
|
|
30592
|
+
}
|
|
30593
|
+
if (options.issues) {
|
|
30594
|
+
return this.urlBuilder.issueList(ctx);
|
|
30595
|
+
}
|
|
30596
|
+
if (options.wiki) {
|
|
30597
|
+
return this.urlBuilder.wiki(ctx);
|
|
30598
|
+
}
|
|
30599
|
+
if (options.settings) {
|
|
30600
|
+
return this.urlBuilder.settings(ctx);
|
|
30601
|
+
}
|
|
30602
|
+
const target = options.target?.trim();
|
|
30603
|
+
if (target && target.length > 0) {
|
|
30604
|
+
if (PR_NUMBER_PATTERN.test(target)) {
|
|
30605
|
+
return this.urlBuilder.pullRequest(ctx, Number.parseInt(target, 10));
|
|
30606
|
+
}
|
|
30607
|
+
if (SHA_PATTERN.test(target)) {
|
|
30608
|
+
return this.urlBuilder.commit(ctx, target);
|
|
30609
|
+
}
|
|
30610
|
+
const { path: path3, line } = this.parsePathWithLine(target);
|
|
30611
|
+
const branch = await this.resolveBranch(options.branch);
|
|
30612
|
+
return this.urlBuilder.src(ctx, branch, path3, line);
|
|
30613
|
+
}
|
|
30614
|
+
if (options.branch) {
|
|
30615
|
+
return this.urlBuilder.src(ctx, options.branch);
|
|
30616
|
+
}
|
|
30617
|
+
return this.urlBuilder.repo(ctx);
|
|
30618
|
+
}
|
|
30619
|
+
validateFlagCombination(options) {
|
|
30620
|
+
const setFlags = [];
|
|
30621
|
+
if (options.pr !== undefined)
|
|
30622
|
+
setFlags.push("--pr");
|
|
30623
|
+
if (options.prs) {
|
|
30624
|
+
setFlags.push("--prs");
|
|
30625
|
+
} else if (options.pullRequests) {
|
|
30626
|
+
setFlags.push("--pull-requests");
|
|
30627
|
+
}
|
|
30628
|
+
if (options.branches)
|
|
30629
|
+
setFlags.push("--branches");
|
|
30630
|
+
if (options.commit !== undefined)
|
|
30631
|
+
setFlags.push("--commit");
|
|
30632
|
+
if (options.commits)
|
|
30633
|
+
setFlags.push("--commits");
|
|
30634
|
+
if (options.pipelines)
|
|
30635
|
+
setFlags.push("--pipelines");
|
|
30636
|
+
if (options.pipeline !== undefined)
|
|
30637
|
+
setFlags.push("--pipeline");
|
|
30638
|
+
if (options.downloads)
|
|
30639
|
+
setFlags.push("--downloads");
|
|
30640
|
+
if (options.issue !== undefined)
|
|
30641
|
+
setFlags.push("--issue");
|
|
30642
|
+
if (options.issues)
|
|
30643
|
+
setFlags.push("--issues");
|
|
30644
|
+
if (options.wiki)
|
|
30645
|
+
setFlags.push("--wiki");
|
|
30646
|
+
if (options.settings)
|
|
30647
|
+
setFlags.push("--settings");
|
|
30648
|
+
if (setFlags.length > 1) {
|
|
30649
|
+
throw new BBError({
|
|
30650
|
+
code: 5002 /* VALIDATION_INVALID */,
|
|
30651
|
+
message: this.appendHelpHint(`Cannot combine ${setFlags.join(" and ")}; pick one resource.`)
|
|
30652
|
+
});
|
|
30653
|
+
}
|
|
30654
|
+
const hasResourceFlag = setFlags.length === 1;
|
|
30655
|
+
const hasTarget = !!options.target?.trim();
|
|
30656
|
+
if (hasResourceFlag && hasTarget) {
|
|
30657
|
+
throw new BBError({
|
|
30658
|
+
code: 5002 /* VALIDATION_INVALID */,
|
|
30659
|
+
message: this.appendHelpHint(`Cannot use a positional target with ${setFlags[0]}.`)
|
|
30660
|
+
});
|
|
30661
|
+
}
|
|
30662
|
+
if (hasResourceFlag && options.branch) {
|
|
30663
|
+
throw new BBError({
|
|
30664
|
+
code: 5002 /* VALIDATION_INVALID */,
|
|
30665
|
+
message: this.appendHelpHint(`Cannot combine --branch with ${setFlags[0]}.`)
|
|
30666
|
+
});
|
|
30667
|
+
}
|
|
30668
|
+
}
|
|
30669
|
+
parsePathWithLine(target) {
|
|
30670
|
+
const match = PATH_LINE_PATTERN.exec(target);
|
|
30671
|
+
if (match) {
|
|
30672
|
+
const line = Number.parseInt(match[2], 10);
|
|
30673
|
+
if (Number.isFinite(line) && line > 0) {
|
|
30674
|
+
return { path: match[1], line };
|
|
30675
|
+
}
|
|
30676
|
+
}
|
|
30677
|
+
return { path: target };
|
|
30678
|
+
}
|
|
30679
|
+
async resolveBranch(explicit) {
|
|
30680
|
+
if (explicit && explicit.length > 0) {
|
|
30681
|
+
return explicit;
|
|
30682
|
+
}
|
|
30683
|
+
try {
|
|
30684
|
+
return await this.gitService.getCurrentBranch();
|
|
30685
|
+
} catch {
|
|
30686
|
+
return "HEAD";
|
|
30687
|
+
}
|
|
30688
|
+
}
|
|
30689
|
+
parsePositiveInt(value, name) {
|
|
30690
|
+
const parsed = Number.parseInt(value, 10);
|
|
30691
|
+
if (!Number.isFinite(parsed) || parsed <= 0 || String(parsed) !== value.trim()) {
|
|
30692
|
+
throw new BBError({
|
|
30693
|
+
code: 5002 /* VALIDATION_INVALID */,
|
|
30694
|
+
message: this.appendHelpHint(`--${name} must be a positive integer.`),
|
|
30695
|
+
context: { [name]: value }
|
|
30696
|
+
});
|
|
30697
|
+
}
|
|
30698
|
+
return parsed;
|
|
30699
|
+
}
|
|
30700
|
+
async openInBrowser(url2) {
|
|
30701
|
+
this.output.info(`Opening ${url2} in your browser...`);
|
|
30702
|
+
const open2 = (await Promise.resolve().then(() => (init_open(), exports_open))).default;
|
|
30703
|
+
await open2(url2);
|
|
30704
|
+
}
|
|
30705
|
+
}
|
|
30706
|
+
|
|
30454
30707
|
// src/bootstrap.ts
|
|
30455
30708
|
var require2 = createRequire(import.meta.url);
|
|
30456
30709
|
var pkg = require2("../package.json");
|
|
@@ -30497,6 +30750,7 @@ function bootstrap(options = {}) {
|
|
|
30497
30750
|
});
|
|
30498
30751
|
registerCommand(container, ServiceTokens.SnippetFilesService, SnippetFilesService, [ServiceTokens.SnippetsAxios]);
|
|
30499
30752
|
registerCommand(container, ServiceTokens.DefaultReviewerService, DefaultReviewerService, [ServiceTokens.PullrequestsApi]);
|
|
30753
|
+
container.register(ServiceTokens.UrlBuilderService, () => new UrlBuilderService);
|
|
30500
30754
|
registerCommand(container, ServiceTokens.LoginCommand, LoginCommand, [
|
|
30501
30755
|
ServiceTokens.CredentialStore,
|
|
30502
30756
|
ServiceTokens.UsersApi,
|
|
@@ -30731,6 +30985,12 @@ function bootstrap(options = {}) {
|
|
|
30731
30985
|
ServiceTokens.OutputService
|
|
30732
30986
|
]);
|
|
30733
30987
|
registerCommand(container, ServiceTokens.ListConfigCommand, ListConfigCommand, [ServiceTokens.ConfigService, ServiceTokens.OutputService]);
|
|
30988
|
+
registerCommand(container, ServiceTokens.BrowseCommand, BrowseCommand, [
|
|
30989
|
+
ServiceTokens.ContextService,
|
|
30990
|
+
ServiceTokens.GitService,
|
|
30991
|
+
ServiceTokens.UrlBuilderService,
|
|
30992
|
+
ServiceTokens.OutputService
|
|
30993
|
+
]);
|
|
30734
30994
|
registerCommand(container, ServiceTokens.InstallCompletionCommand, InstallCompletionCommand, [ServiceTokens.OutputService]);
|
|
30735
30995
|
registerCommand(container, ServiceTokens.UninstallCompletionCommand, UninstallCompletionCommand, [ServiceTokens.OutputService]);
|
|
30736
30996
|
container.register(ServiceTokens.VersionService, () => {
|
|
@@ -30820,6 +31080,7 @@ var ROOT_COMPLETIONS = [
|
|
|
30820
31080
|
"repo",
|
|
30821
31081
|
"pr",
|
|
30822
31082
|
"snippet",
|
|
31083
|
+
"browse",
|
|
30823
31084
|
"config",
|
|
30824
31085
|
"completion",
|
|
30825
31086
|
"--help",
|
|
@@ -31021,7 +31282,7 @@ cli.name("bb").description("A command-line interface for Bitbucket Cloud").versi
|
|
|
31021
31282
|
} catch {}
|
|
31022
31283
|
});
|
|
31023
31284
|
var authCmd = new Command("auth").description("Authenticate with Bitbucket");
|
|
31024
|
-
authCmd.command("login").description("Authenticate with Bitbucket (OAuth or API token)").option("-u, --username <username>", "Bitbucket username (implies API token auth)").option("-p, --password <password>", "Bitbucket API token (implies API token auth)").option("--app-password", "Use API token authentication instead of OAuth").option("--client-id <clientId>", "Custom OAuth consumer client ID").option("--client-secret <clientSecret>", "Custom OAuth consumer client secret").addHelpText("before", `
|
|
31285
|
+
authCmd.command("login").description("Authenticate with Bitbucket (OAuth or API token)").option("-u, --username <username>", "Bitbucket username (implies API token auth)").option("-p, --password <password>", "Bitbucket API token (implies API token auth)").option("--app-password", "Use API token authentication (instead of OAuth). App passwords are deprecated; use API tokens.").option("--client-id <clientId>", "Custom OAuth consumer client ID").option("--client-secret <clientSecret>", "Custom OAuth consumer client secret").addHelpText("before", `
|
|
31025
31286
|
Default: OAuth (browser-based, recommended).
|
|
31026
31287
|
` + `For CI/CD: API token via --app-password or BB_API_TOKEN env var.
|
|
31027
31288
|
` + `Note: Bitbucket app passwords are deprecated; use OAuth or an API token.
|
|
@@ -31164,7 +31425,7 @@ prCmd.command("create").description("Create a pull request").option("-t, --title
|
|
|
31164
31425
|
const context = createContext(cli);
|
|
31165
31426
|
await runCommand(ServiceTokens.CreatePRCommand, withGlobalOptions(options, context), cli, context);
|
|
31166
31427
|
});
|
|
31167
|
-
prCmd.command("list").description("List pull requests").option("-s, --state <state>", `Filter by state (${PR_STATES.join(", ")})`, "OPEN").option("--limit <number>", "Maximum number of PRs to list", "25").option("--mine", "Show only PRs where you are a reviewer").addHelpText("after", buildHelpText({
|
|
31428
|
+
prCmd.command("list").description("List pull requests").option("-s, --state <state>", `Filter by state (${PR_STATES.join(", ")})`, "OPEN").option("--limit <number>", "Maximum number of PRs to list", "25").option("--mine", "Show only PRs where you are a reviewer (not authored by you)").addHelpText("after", buildHelpText({
|
|
31168
31429
|
examples: [
|
|
31169
31430
|
"bb pr list",
|
|
31170
31431
|
"bb pr list -s MERGED --limit 10",
|
|
@@ -31358,23 +31619,23 @@ prReviewersCmd.command("list <id>").description("List reviewers on a pull reques
|
|
|
31358
31619
|
const context = createContext(cli);
|
|
31359
31620
|
await runCommand(ServiceTokens.ListReviewersPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
|
|
31360
31621
|
});
|
|
31361
|
-
prReviewersCmd.command("add <id> <
|
|
31622
|
+
prReviewersCmd.command("add <id> <user>").description("Add a reviewer to a pull request (user is an account ID or {uuid})").addHelpText("after", buildHelpText({
|
|
31362
31623
|
examples: [
|
|
31363
31624
|
'bb pr reviewers add 42 "712020:3cfed7e0-0ed6-49fc-bb35-410a00ccee6f"',
|
|
31364
31625
|
'bb pr reviewers add 42 "{c1cb1bb5-2e32-456e-a373-43978dc12aa1}"'
|
|
31365
31626
|
]
|
|
31366
|
-
})).action(async (id,
|
|
31627
|
+
})).action(async (id, user, options) => {
|
|
31367
31628
|
const context = createContext(cli);
|
|
31368
|
-
await runCommand(ServiceTokens.AddReviewerPRCommand, withGlobalOptions({ id, username, ...options }, context), cli, context);
|
|
31629
|
+
await runCommand(ServiceTokens.AddReviewerPRCommand, withGlobalOptions({ id, username: user, ...options }, context), cli, context);
|
|
31369
31630
|
});
|
|
31370
|
-
prReviewersCmd.command("remove <id> <
|
|
31631
|
+
prReviewersCmd.command("remove <id> <user>").description("Remove a reviewer from a pull request (user is an account ID or {uuid})").addHelpText("after", buildHelpText({
|
|
31371
31632
|
examples: [
|
|
31372
31633
|
'bb pr reviewers remove 42 "712020:3cfed7e0-0ed6-49fc-bb35-410a00ccee6f"',
|
|
31373
31634
|
'bb pr reviewers remove 42 "{c1cb1bb5-2e32-456e-a373-43978dc12aa1}"'
|
|
31374
31635
|
]
|
|
31375
|
-
})).action(async (id,
|
|
31636
|
+
})).action(async (id, user, options) => {
|
|
31376
31637
|
const context = createContext(cli);
|
|
31377
|
-
await runCommand(ServiceTokens.RemoveReviewerPRCommand, withGlobalOptions({ id, username, ...options }, context), cli, context);
|
|
31638
|
+
await runCommand(ServiceTokens.RemoveReviewerPRCommand, withGlobalOptions({ id, username: user, ...options }, context), cli, context);
|
|
31378
31639
|
});
|
|
31379
31640
|
cli.addCommand(prCmd);
|
|
31380
31641
|
prCmd.addCommand(prCommentsCmd);
|
|
@@ -31405,7 +31666,7 @@ snippetCmd.command("view <id>").description("View snippet details").option("-f,
|
|
|
31405
31666
|
const context = createContext(cli);
|
|
31406
31667
|
await runCommand(ServiceTokens.ViewSnippetCommand, withGlobalOptions({ id, ...options }, context), cli, context);
|
|
31407
31668
|
});
|
|
31408
|
-
snippetCmd.command("create").description("Create a new snippet").option("-t, --title <title>", "Snippet title").option("-f, --file <path...>", "File(s) to include").option("--private", "Create a private snippet (default)").option("--public", "Create a public snippet").addHelpText("after", buildHelpText({
|
|
31669
|
+
snippetCmd.command("create").description("Create a new snippet").option("-t, --title <title>", "Snippet title").option("-f, --file <path...>", "File(s) to include (variadic; pass multiple paths or repeat the flag)").option("--private", "Create a private snippet (default)").option("--public", "Create a public snippet").addHelpText("after", buildHelpText({
|
|
31409
31670
|
examples: [
|
|
31410
31671
|
'bb snippet create -t "My snippet" -f file.txt',
|
|
31411
31672
|
'bb snippet create -t "Config files" -f config.yml -f setup.sh --public'
|
|
@@ -31415,7 +31676,7 @@ snippetCmd.command("create").description("Create a new snippet").option("-t, --t
|
|
|
31415
31676
|
const context = createContext(cli);
|
|
31416
31677
|
await runCommand(ServiceTokens.CreateSnippetCommand, withGlobalOptions(options, context), cli, context);
|
|
31417
31678
|
});
|
|
31418
|
-
snippetCmd.command("edit <id>").description("Edit a snippet").option("-t, --title <title>", "New snippet title").option("--private", "Make snippet private").option("--public", "Make snippet public").option("-f, --file <path...>", "Replace/add file(s) (sends multipart update)").addHelpText("after", buildHelpText({
|
|
31679
|
+
snippetCmd.command("edit <id>").description("Edit a snippet").option("-t, --title <title>", "New snippet title").option("--private", "Make snippet private").option("--public", "Make snippet public").option("-f, --file <path...>", "Replace/add file(s) (variadic; pass multiple paths or repeat the flag; sends multipart update)").addHelpText("after", buildHelpText({
|
|
31419
31680
|
examples: [
|
|
31420
31681
|
'bb snippet edit kypj -t "New title"',
|
|
31421
31682
|
"bb snippet edit kypj --public",
|
|
@@ -31488,6 +31749,26 @@ snippetCommentsCmd.command("delete <snippet-id> <comment-id>").description("Dele
|
|
|
31488
31749
|
});
|
|
31489
31750
|
snippetCmd.addCommand(snippetCommentsCmd);
|
|
31490
31751
|
cli.addCommand(snippetCmd);
|
|
31752
|
+
cli.command("browse [target]").description("Open a Bitbucket page (repo home, file, PR, commit, etc.) in your browser").option("--pr <id>", "Open a specific pull request").option("--prs", "Open the pull-requests list").option("--pull-requests", "Alias for --prs").option("--branch <name>", "Open the branch source tree (or, with <target>, that path on the branch)").option("--branches", "Open the branches list").option("--commit [sha]", "Open a specific commit (defaults to HEAD when no SHA is given)").option("--commits", "Open the commits list").option("--pipelines", "Open the pipelines page").option("--pipeline <id>", "Open a specific pipeline run").option("--downloads", "Open the downloads page").option("--issue <id>", "Open a specific issue").option("--issues", "Open the issue tracker").option("--wiki", "Open the wiki").option("--settings", "Open repository settings").option("-n, --no-browser", "Print the URL to stdout instead of opening it").addHelpText("after", buildHelpText({
|
|
31753
|
+
examples: [
|
|
31754
|
+
"bb browse",
|
|
31755
|
+
"bb browse src/cli.ts",
|
|
31756
|
+
"bb browse src/cli.ts:42",
|
|
31757
|
+
"bb browse --branch release/2.0 src/cli.ts",
|
|
31758
|
+
"bb browse 217",
|
|
31759
|
+
"bb browse --pr 217",
|
|
31760
|
+
"bb browse --prs",
|
|
31761
|
+
"bb browse abc1234",
|
|
31762
|
+
"bb browse --commit",
|
|
31763
|
+
"bb browse --pipelines",
|
|
31764
|
+
"bb browse --settings",
|
|
31765
|
+
"bb browse --pr 217 --no-browser",
|
|
31766
|
+
"bb browse --pr 217 --json url"
|
|
31767
|
+
]
|
|
31768
|
+
})).action(async (target, options) => {
|
|
31769
|
+
const context = createContext(cli);
|
|
31770
|
+
await runCommand(ServiceTokens.BrowseCommand, withGlobalOptions({ target, ...options }, context), cli, context);
|
|
31771
|
+
});
|
|
31491
31772
|
var configCmd = new Command("config").description("Manage configuration");
|
|
31492
31773
|
configCmd.command("get <key>").description("Get a configuration value").addHelpText("after", buildHelpText({
|
|
31493
31774
|
examples: ["bb config get defaultWorkspace"],
|