cli

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:     "bbkt",
	Version: version.Version,
	Short:   "A unified CLI and MCP server for Bitbucket Cloud",
	Long: `bbkt is a complete command-line interface and Model Context Protocol
server for Bitbucket Cloud.

It allows you to manage workspaces, repositories, pull requests,
pipelines, and more directly from your terminal, or expose these
capabilities to your AI agents via the MCP protocol.

Try running 'bbkt auth' to get started!`,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		if profile, _ := cmd.Flags().GetString("profile"); profile != "" {
			os.Setenv("BBKT_PROFILE", profile)
		}
	},
}

RootCmd represents the base command when called without any subcommands

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func FormatBool added in v0.1.3

func FormatBool(b bool) string

FormatBool returns a readable yes/no.

func FormatDuration added in v0.1.3

func FormatDuration(secs int) string

FormatDuration formats seconds into a human-readable duration.

func FormatPrivate added in v0.1.3

func FormatPrivate(b bool) string

FormatPrivate returns "private" or "public".

func FormatTime added in v0.1.3

func FormatTime(t time.Time) string

FormatTime formats a time.Time as a short human-readable string.

func FormatTimePtr added in v0.1.3

func FormatTimePtr(t *time.Time) string

FormatTimePtr handles nil time pointers.

func KV added in v0.1.3

func KV(label string, value string)

KV prints a labeled key-value pair with consistent padding.

func KVf added in v0.1.3

func KVf(label string, format string, args ...any)

KVf prints a formatted key-value pair.

func ParseArgs

func ParseArgs(args []string, trailingArgsCount int) (workspace, repoSlug string, trailing []string, err error)

ParseArgs resolves workspace and repoSlug from the command line arguments, and returns any remaining trailing arguments. It expects either: - exact trailingArgsCount arguments (infers workspace and repoSlug from git) - trailingArgsCount + 2 arguments (explicit workspace and repoSlug provided first)

func PrintJSON

func PrintJSON(data any)

PrintJSON formats any Go struct as pretty JSON and prints to stdout.

func PrintOrJSON added in v0.1.3

func PrintOrJSON(cmd *cobra.Command, data any, formatter func())

PrintOrJSON prints formatted output or JSON depending on the --json flag. The formatter func should print the human-readable output.

func PrintPaginationFooter added in v0.1.3

func PrintPaginationFooter(size, page, pageLen int, hasNext bool)

PrintPaginationFooter prints a summary line showing current page info.

func Truncate added in v0.1.3

func Truncate(s string, maxLen int) string

Truncate truncates a string to maxLen and adds "..." if needed.

Types

type Table added in v0.1.3

type Table struct {
	// contains filtered or unexported fields
}

Table is a simple tabwriter-based table printer.

func NewTable added in v0.1.3

func NewTable() *Table

NewTable creates a new table with tabwriter defaults.

func (*Table) Flush added in v0.1.3

func (t *Table) Flush()

Flush flushes the underlying tabwriter.

func (*Table) Header added in v0.1.3

func (t *Table) Header(cols ...string)

Header writes a header row (uppercased automatically).

func (*Table) Row added in v0.1.3

func (t *Table) Row(vals ...string)

Row writes a data row.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL