@pilatos/bitbucket-cli 1.8.3 → 1.8.4

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/index.js +258 -34
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -14337,6 +14337,12 @@ var applyOptions = (object, options = {}) => {
14337
14337
  const colorLevel = stdoutColor ? stdoutColor.level : 0;
14338
14338
  object.level = options.level === undefined ? colorLevel : options.level;
14339
14339
  };
14340
+
14341
+ class Chalk {
14342
+ constructor(options) {
14343
+ return chalkFactory(options);
14344
+ }
14345
+ }
14340
14346
  var chalkFactory = (options) => {
14341
14347
  const chalk = (...strings) => strings.join(" ");
14342
14348
  applyOptions(chalk, options);
@@ -23808,6 +23814,51 @@ function bootstrap(options = {}) {
23808
23814
  return container;
23809
23815
  }
23810
23816
 
23817
+ // src/help-text.ts
23818
+ function createHelpTextBuilder(noColor) {
23819
+ const passthrough = (t) => t;
23820
+ const chalk2 = new Chalk({ level: noColor ? 0 : 1 });
23821
+ const c = noColor ? { bold: passthrough, dim: passthrough, cyan: passthrough } : { bold: chalk2.bold, dim: chalk2.dim, cyan: chalk2.cyan };
23822
+ return function buildHelpText(config) {
23823
+ const sections = [];
23824
+ if (config.examples?.length) {
23825
+ sections.push(c.bold("Examples:"));
23826
+ for (const example of config.examples) {
23827
+ sections.push(` ${c.dim("$")} ${example}`);
23828
+ }
23829
+ }
23830
+ if (config.validValues) {
23831
+ for (const [label, values] of Object.entries(config.validValues)) {
23832
+ if (sections.length)
23833
+ sections.push("");
23834
+ sections.push(c.bold(`${label}:`));
23835
+ sections.push(` ${c.cyan(values.join(", "))}`);
23836
+ }
23837
+ }
23838
+ if (config.defaults) {
23839
+ if (sections.length)
23840
+ sections.push("");
23841
+ sections.push(c.bold("Defaults:"));
23842
+ for (const [key, value] of Object.entries(config.defaults)) {
23843
+ sections.push(` ${c.bold(`--${key}`)} ${c.cyan(value)}`);
23844
+ }
23845
+ }
23846
+ if (config.envVars) {
23847
+ if (sections.length)
23848
+ sections.push("");
23849
+ sections.push(c.bold("Environment variables:"));
23850
+ const maxLen = Math.max(...Object.keys(config.envVars).map((k) => k.length));
23851
+ for (const [name, desc] of Object.entries(config.envVars)) {
23852
+ sections.push(` ${c.bold(name.padEnd(maxLen + 2))}${c.dim(desc)}`);
23853
+ }
23854
+ }
23855
+ return `
23856
+ ` + sections.join(`
23857
+ `) + `
23858
+ `;
23859
+ };
23860
+ }
23861
+
23811
23862
  // src/cli.ts
23812
23863
  import tabtab3 from "tabtab";
23813
23864
  var require3 = createRequire2(import.meta.url);
@@ -23862,6 +23913,7 @@ function resolveNoColorSetting(argv, env2) {
23862
23913
  return hasNoColorEnv;
23863
23914
  }
23864
23915
  var noColor = resolveNoColorSetting(process.argv, process.env);
23916
+ var buildHelpText = createHelpTextBuilder(noColor);
23865
23917
  var container = bootstrap({ noColor });
23866
23918
  function createContext(program2) {
23867
23919
  const opts = program2.opts();
@@ -23891,7 +23943,15 @@ function withGlobalOptions(options, context) {
23891
23943
  };
23892
23944
  }
23893
23945
  var cli = new Command;
23894
- cli.name("bb").description("A command-line interface for Bitbucket Cloud").version(pkg2.version).option("--json", "Output as JSON").option("--no-color", "Disable color output").option("-w, --workspace <workspace>", "Specify workspace").option("-r, --repo <repo>", "Specify repository").action(async () => {
23946
+ cli.name("bb").description("A command-line interface for Bitbucket Cloud").version(pkg2.version).option("--json", "Output as JSON").option("--no-color", "Disable color output").option("-w, --workspace <workspace>", "Specify workspace").option("-r, --repo <repo>", "Specify repository").addHelpText("after", buildHelpText({
23947
+ envVars: {
23948
+ BB_USERNAME: "Bitbucket username (fallback for auth login)",
23949
+ BB_API_TOKEN: "Bitbucket API token (fallback for auth login)",
23950
+ NO_COLOR: "Disable color output when set",
23951
+ FORCE_COLOR: "Force color output when set (and not '0')",
23952
+ DEBUG: "Enable HTTP debug logging when 'true'"
23953
+ }
23954
+ })).action(async () => {
23895
23955
  cli.outputHelp();
23896
23956
  const versionService = container.resolve(ServiceTokens.VersionService);
23897
23957
  const output = container.resolve(ServiceTokens.OutputService);
@@ -23908,116 +23968,255 @@ cli.name("bb").description("A command-line interface for Bitbucket Cloud").versi
23908
23968
  } catch {}
23909
23969
  });
23910
23970
  var authCmd = new Command("auth").description("Authenticate with Bitbucket");
23911
- authCmd.command("login").description("Authenticate with Bitbucket using an API token").option("-u, --username <username>", "Bitbucket username").option("-p, --password <password>", "Bitbucket API token").action(async (options) => {
23971
+ authCmd.command("login").description("Authenticate with Bitbucket using an API token").option("-u, --username <username>", "Bitbucket username").option("-p, --password <password>", "Bitbucket API token").addHelpText("after", buildHelpText({
23972
+ examples: [
23973
+ "bb auth login -u myuser -p mytoken",
23974
+ "BB_USERNAME=myuser BB_API_TOKEN=mytoken bb auth login"
23975
+ ],
23976
+ envVars: {
23977
+ BB_USERNAME: "Used when --username is not provided",
23978
+ BB_API_TOKEN: "Used when --password is not provided"
23979
+ }
23980
+ })).action(async (options) => {
23912
23981
  await runCommand(ServiceTokens.LoginCommand, options, cli);
23913
23982
  });
23914
- authCmd.command("logout").description("Log out of Bitbucket").action(async () => {
23983
+ authCmd.command("logout").description("Log out of Bitbucket").addHelpText("after", buildHelpText({ examples: ["bb auth logout"] })).action(async () => {
23915
23984
  await runCommand(ServiceTokens.LogoutCommand, undefined, cli);
23916
23985
  });
23917
- authCmd.command("status").description("Show authentication status").action(async () => {
23986
+ authCmd.command("status").description("Show authentication status").addHelpText("after", buildHelpText({
23987
+ examples: ["bb auth status", "bb auth status --json"]
23988
+ })).action(async () => {
23918
23989
  await runCommand(ServiceTokens.StatusCommand, undefined, cli);
23919
23990
  });
23920
- authCmd.command("token").description("Print the current access token").action(async () => {
23991
+ authCmd.command("token").description("Print the current access token").addHelpText("after", buildHelpText({
23992
+ examples: ["bb auth token", "bb auth token | pbcopy"]
23993
+ })).action(async () => {
23921
23994
  await runCommand(ServiceTokens.TokenCommand, undefined, cli);
23922
23995
  });
23923
23996
  cli.addCommand(authCmd);
23924
23997
  var repoCmd = new Command("repo").description("Manage repositories");
23925
- repoCmd.command("clone <repository>").description("Clone a Bitbucket repository").option("-d, --directory <dir>", "Directory to clone into").action(async (repository, options) => {
23998
+ repoCmd.command("clone <repository>").description("Clone a Bitbucket repository").option("-d, --directory <dir>", "Directory to clone into").addHelpText("after", buildHelpText({
23999
+ examples: [
24000
+ "bb repo clone workspace/repo-name",
24001
+ "bb repo clone workspace/repo-name -d my-directory"
24002
+ ]
24003
+ })).action(async (repository, options) => {
23926
24004
  await runCommand(ServiceTokens.CloneCommand, { repository, ...options }, cli);
23927
24005
  });
23928
- repoCmd.command("create <name>").description("Create a new repository").option("-d, --description <description>", "Repository description").option("--private", "Create a private repository (default)").option("--public", "Create a public repository").option("-p, --project <project>", "Project key").action(async (name, options) => {
24006
+ repoCmd.command("create <name>").description("Create a new repository").option("-d, --description <description>", "Repository description").option("--private", "Create a private repository (default)").option("--public", "Create a public repository").option("-p, --project <project>", "Project key").addHelpText("after", buildHelpText({
24007
+ examples: [
24008
+ "bb repo create my-repo",
24009
+ "bb repo create my-repo --public -p PROJ",
24010
+ 'bb repo create my-repo -d "My new repository"'
24011
+ ],
24012
+ defaults: { private: "true (visibility is private unless --public)" }
24013
+ })).action(async (name, options) => {
23929
24014
  const context = createContext(cli);
23930
24015
  await runCommand(ServiceTokens.CreateRepoCommand, withGlobalOptions({ name, ...options }, context), cli, context);
23931
24016
  });
23932
- repoCmd.command("list").description("List repositories").option("--limit <number>", "Maximum number of repositories to list", "25").action(async (options) => {
24017
+ repoCmd.command("list").description("List repositories").option("--limit <number>", "Maximum number of repositories to list", "25").addHelpText("after", buildHelpText({
24018
+ examples: [
24019
+ "bb repo list",
24020
+ "bb repo list --limit 50",
24021
+ "bb repo list --json"
24022
+ ],
24023
+ defaults: { limit: "25" }
24024
+ })).action(async (options) => {
23933
24025
  const context = createContext(cli);
23934
24026
  await runCommand(ServiceTokens.ListReposCommand, withGlobalOptions(options, context), cli, context);
23935
24027
  });
23936
- repoCmd.command("view [repository]").description("View repository details").action(async (repository, options) => {
24028
+ repoCmd.command("view [repository]").description("View repository details").addHelpText("after", buildHelpText({
24029
+ examples: [
24030
+ "bb repo view",
24031
+ "bb repo view workspace/repo-name",
24032
+ "bb repo view workspace/repo-name --json"
24033
+ ]
24034
+ })).action(async (repository, options) => {
23937
24035
  const context = createContext(cli);
23938
24036
  await runCommand(ServiceTokens.ViewRepoCommand, withGlobalOptions({ repository, ...options }, context), cli, context);
23939
24037
  });
23940
- repoCmd.command("delete <repository>").description("Delete a repository").option("-y, --yes", "Skip confirmation prompt").action(async (repository, options) => {
24038
+ repoCmd.command("delete <repository>").description("Delete a repository").option("-y, --yes", "Skip confirmation prompt").addHelpText("after", buildHelpText({
24039
+ examples: [
24040
+ "bb repo delete workspace/repo-name",
24041
+ "bb repo delete workspace/repo-name --yes"
24042
+ ]
24043
+ })).action(async (repository, options) => {
23941
24044
  const context = createContext(cli);
23942
24045
  await runCommand(ServiceTokens.DeleteRepoCommand, withGlobalOptions({ repository, ...options }, context), cli, context);
23943
24046
  });
23944
24047
  cli.addCommand(repoCmd);
23945
24048
  var prCmd = new Command("pr").description("Manage pull requests");
23946
- prCmd.command("create").description("Create a pull request").option("-t, --title <title>", "Pull request title").option("-b, --body <body>", "Pull request description").option("-s, --source <branch>", "Source branch (default: current branch)").option("-d, --destination <branch>", "Destination branch (default: main)").option("--close-source-branch", "Close source branch after merge").option("--draft", "Create the pull request as draft").action(async (options) => {
24049
+ prCmd.command("create").description("Create a pull request").option("-t, --title <title>", "Pull request title").option("-b, --body <body>", "Pull request description").option("-s, --source <branch>", "Source branch (default: current branch)").option("-d, --destination <branch>", "Destination branch (default: main)").option("--close-source-branch", "Close source branch after merge").option("--draft", "Create the pull request as draft").addHelpText("after", buildHelpText({
24050
+ examples: [
24051
+ 'bb pr create -t "My PR" -b "Description"',
24052
+ 'bb pr create -t "My PR" --draft',
24053
+ 'bb pr create -t "My PR" -s feature -d develop',
24054
+ 'bb pr create -t "My PR" --close-source-branch'
24055
+ ],
24056
+ defaults: {
24057
+ source: "current git branch",
24058
+ destination: "main"
24059
+ }
24060
+ })).action(async (options) => {
23947
24061
  const context = createContext(cli);
23948
24062
  await runCommand(ServiceTokens.CreatePRCommand, withGlobalOptions(options, context), cli, context);
23949
24063
  });
23950
- prCmd.command("list").description("List pull requests").option("-s, --state <state>", "Filter by state (OPEN, MERGED, DECLINED, SUPERSEDED)", "OPEN").option("--limit <number>", "Maximum number of PRs to list", "25").action(async (options) => {
24064
+ prCmd.command("list").description("List pull requests").option("-s, --state <state>", "Filter by state (OPEN, MERGED, DECLINED, SUPERSEDED)", "OPEN").option("--limit <number>", "Maximum number of PRs to list", "25").addHelpText("after", buildHelpText({
24065
+ examples: [
24066
+ "bb pr list",
24067
+ "bb pr list -s MERGED --limit 10",
24068
+ "bb pr list --json"
24069
+ ],
24070
+ validValues: {
24071
+ "Valid states": ["OPEN", "MERGED", "DECLINED", "SUPERSEDED"]
24072
+ },
24073
+ defaults: { state: "OPEN", limit: "25" }
24074
+ })).action(async (options) => {
23951
24075
  const context = createContext(cli);
23952
24076
  await runCommand(ServiceTokens.ListPRsCommand, withGlobalOptions(options, context), cli, context);
23953
24077
  });
23954
- prCmd.command("view <id>").description("View pull request details").action(async (id, options) => {
24078
+ prCmd.command("view <id>").description("View pull request details").addHelpText("after", buildHelpText({
24079
+ examples: ["bb pr view 42", "bb pr view 42 --json"]
24080
+ })).action(async (id, options) => {
23955
24081
  const context = createContext(cli);
23956
24082
  await runCommand(ServiceTokens.ViewPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
23957
24083
  });
23958
- prCmd.command("activity <id>").description("Show pull request activity log").option("--limit <number>", "Maximum number of activity entries", "25").option("--type <types>", "Filter activity by type (comma-separated)").action(async (id, options) => {
24084
+ prCmd.command("activity <id>").description("Show pull request activity log").option("--limit <number>", "Maximum number of activity entries", "25").option("--type <types>", "Filter activity by type (comma-separated)").addHelpText("after", buildHelpText({
24085
+ examples: [
24086
+ "bb pr activity 42",
24087
+ "bb pr activity 42 --type comment,approval",
24088
+ "bb pr activity 42 --limit 10 --json"
24089
+ ],
24090
+ validValues: {
24091
+ "Valid activity types (comma-separated)": [
24092
+ "comment",
24093
+ "approval",
24094
+ "changes_requested",
24095
+ "merge",
24096
+ "decline",
24097
+ "commit",
24098
+ "update"
24099
+ ]
24100
+ },
24101
+ defaults: { limit: "25" }
24102
+ })).action(async (id, options) => {
23959
24103
  const context = createContext(cli);
23960
24104
  await runCommand(ServiceTokens.ActivityPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
23961
24105
  });
23962
- prCmd.command("checks <id>").description("Show CI/CD checks and build status for a pull request").option("--json", "Output as JSON").action(async (id, options) => {
24106
+ prCmd.command("checks <id>").description("Show CI/CD checks and build status for a pull request").option("--json", "Output as JSON").addHelpText("after", buildHelpText({
24107
+ examples: ["bb pr checks 42", "bb pr checks 42 --json"]
24108
+ })).action(async (id, options) => {
23963
24109
  const context = createContext(cli);
23964
24110
  await runCommand(ServiceTokens.ChecksPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
23965
24111
  });
23966
- prCmd.command("edit [id]").description("Edit a pull request").option("-t, --title <title>", "New pull request title").option("-b, --body <body>", "New pull request description").option("-F, --body-file <file>", "Read description from file").action(async (id, options) => {
24112
+ prCmd.command("edit [id]").description("Edit a pull request").option("-t, --title <title>", "New pull request title").option("-b, --body <body>", "New pull request description").option("-F, --body-file <file>", "Read description from file").addHelpText("after", buildHelpText({
24113
+ examples: [
24114
+ 'bb pr edit 42 -t "New title"',
24115
+ 'bb pr edit 42 -b "Updated description"',
24116
+ "bb pr edit 42 -F description.md",
24117
+ "bb pr edit"
24118
+ ]
24119
+ })).action(async (id, options) => {
23967
24120
  const context = createContext(cli);
23968
24121
  await runCommand(ServiceTokens.EditPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
23969
24122
  });
23970
- prCmd.command("merge <id>").description("Merge a pull request").option("-m, --message <message>", "Merge commit message").option("--close-source-branch", "Delete the source branch after merging").option("--strategy <strategy>", "Merge strategy (merge_commit, squash, fast_forward)").action(async (id, options) => {
24123
+ prCmd.command("merge <id>").description("Merge a pull request").option("-m, --message <message>", "Merge commit message").option("--close-source-branch", "Delete the source branch after merging").option("--strategy <strategy>", "Merge strategy").addHelpText("after", buildHelpText({
24124
+ examples: [
24125
+ "bb pr merge 42",
24126
+ "bb pr merge 42 --strategy squash --close-source-branch",
24127
+ 'bb pr merge 42 -m "Merge feature X"'
24128
+ ],
24129
+ validValues: {
24130
+ "Valid merge strategies": [
24131
+ "merge_commit",
24132
+ "squash",
24133
+ "fast_forward",
24134
+ "squash_fast_forward",
24135
+ "rebase_fast_forward",
24136
+ "rebase_merge"
24137
+ ]
24138
+ }
24139
+ })).action(async (id, options) => {
23971
24140
  const context = createContext(cli);
23972
24141
  await runCommand(ServiceTokens.MergePRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
23973
24142
  });
23974
- prCmd.command("approve <id>").description("Approve a pull request").action(async (id, options) => {
24143
+ prCmd.command("approve <id>").description("Approve a pull request").addHelpText("after", buildHelpText({ examples: ["bb pr approve 42"] })).action(async (id, options) => {
23975
24144
  const context = createContext(cli);
23976
24145
  await runCommand(ServiceTokens.ApprovePRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
23977
24146
  });
23978
- prCmd.command("decline <id>").description("Decline a pull request").action(async (id, options) => {
24147
+ prCmd.command("decline <id>").description("Decline a pull request").addHelpText("after", buildHelpText({ examples: ["bb pr decline 42"] })).action(async (id, options) => {
23979
24148
  const context = createContext(cli);
23980
24149
  await runCommand(ServiceTokens.DeclinePRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
23981
24150
  });
23982
- prCmd.command("ready <id>").description("Mark a draft pull request as ready for review").action(async (id, options) => {
24151
+ prCmd.command("ready <id>").description("Mark a draft pull request as ready for review").addHelpText("after", buildHelpText({ examples: ["bb pr ready 42"] })).action(async (id, options) => {
23983
24152
  const context = createContext(cli);
23984
24153
  await runCommand(ServiceTokens.ReadyPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
23985
24154
  });
23986
- prCmd.command("checkout <id>").description("Checkout a pull request locally").action(async (id, options) => {
24155
+ prCmd.command("checkout <id>").description("Checkout a pull request locally").addHelpText("after", buildHelpText({ examples: ["bb pr checkout 42"] })).action(async (id, options) => {
23987
24156
  const context = createContext(cli);
23988
24157
  await runCommand(ServiceTokens.CheckoutPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
23989
24158
  });
23990
- prCmd.command("diff [id]").description("View pull request diff").option("--color <when>", "Colorize output (auto, always, never)", "auto").option("--name-only", "Show only names of changed files").option("--stat", "Show diffstat").option("--web", "Open diff in web browser").action(async (id, options) => {
24159
+ prCmd.command("diff [id]").description("View pull request diff").option("--color <when>", "Colorize output", "auto").option("--name-only", "Show only names of changed files").option("--stat", "Show diffstat").option("--web", "Open diff in web browser").addHelpText("after", buildHelpText({
24160
+ examples: [
24161
+ "bb pr diff 42",
24162
+ "bb pr diff 42 --stat",
24163
+ "bb pr diff 42 --name-only",
24164
+ "bb pr diff --web",
24165
+ "bb pr diff 42 --color always"
24166
+ ],
24167
+ validValues: {
24168
+ "Valid --color values": ["auto", "always", "never"]
24169
+ },
24170
+ defaults: { color: "auto" }
24171
+ })).action(async (id, options) => {
23991
24172
  const context = createContext(cli);
23992
24173
  await runCommand(ServiceTokens.DiffPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
23993
24174
  });
23994
24175
  var prCommentsCmd = new Command("comments").description("Manage pull request comments");
23995
- prCommentsCmd.command("list <id>").description("List comments on a pull request").option("--limit <number>", "Maximum number of comments (default: 25)").option("--no-truncate", "Show full comment content without truncation").action(async (id, options) => {
24176
+ prCommentsCmd.command("list <id>").description("List comments on a pull request").option("--limit <number>", "Maximum number of comments (default: 25)").option("--no-truncate", "Show full comment content without truncation").addHelpText("after", buildHelpText({
24177
+ examples: [
24178
+ "bb pr comments list 42",
24179
+ "bb pr comments list 42 --no-truncate",
24180
+ "bb pr comments list 42 --limit 50 --json"
24181
+ ],
24182
+ defaults: { limit: "25" }
24183
+ })).action(async (id, options) => {
23996
24184
  const context = createContext(cli);
23997
24185
  await runCommand(ServiceTokens.ListCommentsPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
23998
24186
  });
23999
- prCommentsCmd.command("add <id> <message>").description("Add a comment to a pull request").option("--file <path>", "File path in the diff for inline comment").option("--line-to <number>", "Line number in the new file version").option("--line-from <number>", "Line number in the old file version").action(async (id, message, options) => {
24187
+ prCommentsCmd.command("add <id> <message>").description("Add a comment to a pull request").option("--file <path>", "File path in the diff for inline comment").option("--line-to <number>", "Line number in the new file version").option("--line-from <number>", "Line number in the old file version").addHelpText("after", buildHelpText({
24188
+ examples: [
24189
+ 'bb pr comments add 42 "LGTM"',
24190
+ 'bb pr comments add 42 "Fix this" --file src/main.ts --line-to 10'
24191
+ ]
24192
+ })).action(async (id, message, options) => {
24000
24193
  const context = createContext(cli);
24001
24194
  await runCommand(ServiceTokens.CommentPRCommand, withGlobalOptions({ id, message, ...options }, context), cli, context);
24002
24195
  });
24003
- prCommentsCmd.command("edit <pr-id> <comment-id> <message>").description("Edit a comment on a pull request").action(async (prId, commentId, message, options) => {
24196
+ prCommentsCmd.command("edit <pr-id> <comment-id> <message>").description("Edit a comment on a pull request").addHelpText("after", buildHelpText({
24197
+ examples: ['bb pr comments edit 42 12345 "Updated comment"']
24198
+ })).action(async (prId, commentId, message, options) => {
24004
24199
  const context = createContext(cli);
24005
24200
  await runCommand(ServiceTokens.EditCommentPRCommand, withGlobalOptions({ prId, commentId, message }, context), cli, context);
24006
24201
  });
24007
- prCommentsCmd.command("delete <pr-id> <comment-id>").description("Delete a comment on a pull request").action(async (prId, commentId, options) => {
24202
+ prCommentsCmd.command("delete <pr-id> <comment-id>").description("Delete a comment on a pull request").addHelpText("after", buildHelpText({
24203
+ examples: ["bb pr comments delete 42 12345"]
24204
+ })).action(async (prId, commentId, options) => {
24008
24205
  const context = createContext(cli);
24009
24206
  await runCommand(ServiceTokens.DeleteCommentPRCommand, withGlobalOptions({ prId, commentId }, context), cli, context);
24010
24207
  });
24011
24208
  var prReviewersCmd = new Command("reviewers").description("Manage pull request reviewers");
24012
- prReviewersCmd.command("list <id>").description("List reviewers on a pull request").action(async (id, options) => {
24209
+ prReviewersCmd.command("list <id>").description("List reviewers on a pull request").addHelpText("after", buildHelpText({
24210
+ examples: ["bb pr reviewers list 42", "bb pr reviewers list 42 --json"]
24211
+ })).action(async (id, options) => {
24013
24212
  const context = createContext(cli);
24014
24213
  await runCommand(ServiceTokens.ListReviewersPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
24015
24214
  });
24016
- prReviewersCmd.command("add <id> <username>").description("Add a reviewer to a pull request").action(async (id, username, options) => {
24215
+ prReviewersCmd.command("add <id> <username>").description("Add a reviewer to a pull request").addHelpText("after", buildHelpText({ examples: ["bb pr reviewers add 42 jdoe"] })).action(async (id, username, options) => {
24017
24216
  const context = createContext(cli);
24018
24217
  await runCommand(ServiceTokens.AddReviewerPRCommand, withGlobalOptions({ id, username, ...options }, context), cli, context);
24019
24218
  });
24020
- prReviewersCmd.command("remove <id> <username>").description("Remove a reviewer from a pull request").action(async (id, username, options) => {
24219
+ prReviewersCmd.command("remove <id> <username>").description("Remove a reviewer from a pull request").addHelpText("after", buildHelpText({ examples: ["bb pr reviewers remove 42 jdoe"] })).action(async (id, username, options) => {
24021
24220
  const context = createContext(cli);
24022
24221
  await runCommand(ServiceTokens.RemoveReviewerPRCommand, withGlobalOptions({ id, username, ...options }, context), cli, context);
24023
24222
  });
@@ -24025,21 +24224,46 @@ cli.addCommand(prCmd);
24025
24224
  prCmd.addCommand(prCommentsCmd);
24026
24225
  prCmd.addCommand(prReviewersCmd);
24027
24226
  var configCmd = new Command("config").description("Manage configuration");
24028
- configCmd.command("get <key>").description("Get a configuration value").action(async (key) => {
24227
+ configCmd.command("get <key>").description("Get a configuration value").addHelpText("after", buildHelpText({
24228
+ examples: ["bb config get defaultWorkspace"],
24229
+ validValues: {
24230
+ "Readable config keys": [
24231
+ "username",
24232
+ "defaultWorkspace",
24233
+ "skipVersionCheck",
24234
+ "versionCheckInterval"
24235
+ ]
24236
+ }
24237
+ })).action(async (key) => {
24029
24238
  await runCommand(ServiceTokens.GetConfigCommand, { key }, cli);
24030
24239
  });
24031
- configCmd.command("set <key> <value>").description("Set a configuration value").action(async (key, value) => {
24240
+ configCmd.command("set <key> <value>").description("Set a configuration value").addHelpText("after", buildHelpText({
24241
+ examples: [
24242
+ "bb config set defaultWorkspace my-workspace",
24243
+ "bb config set skipVersionCheck true",
24244
+ "bb config set versionCheckInterval 86400"
24245
+ ],
24246
+ validValues: {
24247
+ "Settable config keys": [
24248
+ "defaultWorkspace (string)",
24249
+ "skipVersionCheck (true/false)",
24250
+ "versionCheckInterval (positive integer, seconds)"
24251
+ ]
24252
+ }
24253
+ })).action(async (key, value) => {
24032
24254
  await runCommand(ServiceTokens.SetConfigCommand, { key, value }, cli);
24033
24255
  });
24034
- configCmd.command("list").description("List all configuration values").action(async () => {
24256
+ configCmd.command("list").description("List all configuration values").addHelpText("after", buildHelpText({
24257
+ examples: ["bb config list", "bb config list --json"]
24258
+ })).action(async () => {
24035
24259
  await runCommand(ServiceTokens.ListConfigCommand, undefined, cli);
24036
24260
  });
24037
24261
  cli.addCommand(configCmd);
24038
24262
  var completionCmd = new Command("completion").description("Shell completion utilities");
24039
- completionCmd.command("install").description("Install shell completions for bash, zsh, or fish").action(async () => {
24263
+ completionCmd.command("install").description("Install shell completions for bash, zsh, or fish").addHelpText("after", buildHelpText({ examples: ["bb completion install"] })).action(async () => {
24040
24264
  await runCommand(ServiceTokens.InstallCompletionCommand, undefined, cli);
24041
24265
  });
24042
- completionCmd.command("uninstall").description("Uninstall shell completions").action(async () => {
24266
+ completionCmd.command("uninstall").description("Uninstall shell completions").addHelpText("after", buildHelpText({ examples: ["bb completion uninstall"] })).action(async () => {
24043
24267
  await runCommand(ServiceTokens.UninstallCompletionCommand, undefined, cli);
24044
24268
  });
24045
24269
  cli.addCommand(completionCmd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pilatos/bitbucket-cli",
3
- "version": "1.8.3",
3
+ "version": "1.8.4",
4
4
  "description": "A command-line interface for Bitbucket Cloud",
5
5
  "author": "",
6
6
  "license": "MIT",