Documentation
¶
Index ¶
- Constants
- Variables
- func AddAppFlag(fs *pflag.FlagSet, help string)
- func AddConfigAndInventoryFlags(fs *pflag.FlagSet)
- func AddJSONParamsFlags(fs *pflag.FlagSet)
- func AddSecretFilteringFlag(fs *pflag.FlagSet)
- func AddTriggerFilterFlags(fs *pflag.FlagSet)
- func AppSlugIsUserProvided(cmd *cobra.Command, args []string) bool
- func AppSlugRequiredErr() error
- func ApplyGlobalFlagsFromArgs(root *cobra.Command, args []string, globalFlagNames []string)
- func AsHidden(cmd *cobra.Command) *cobra.Command
- func CheckFormatVersionSupported(configFormatVersion string) error
- func CheckPasswordStdinPiped(passwordStdin, isTerminal bool, exampleCmd string) error
- func CheckUpdate() error
- func CheckValueStdinPiped(valueStdin, isTerminal bool, exampleCmd string) error
- func CommandTokenIndex(fs *pflag.FlagSet, args []string, globalFlagNames []string) int
- func CreateBitriseConfigFromCLIParams(bitriseConfigBase64Data, bitriseConfigPath string, ...) (models.BitriseDataModel, []string, error)
- func CreateDefaultMerger() (*configmerge.Merger, error)
- func CreateInventoryFromCLIParams(inventoryBase64Data, inventoryPath string) ([]envmanModels.EnvironmentItemModel, error)
- func DefaultWorkspaceSlug(cmd *cobra.Command) string
- func DelegateToList(cmd *cobra.Command, args []string) error
- func DetectSingleDashLongFlag(cmd *cobra.Command, args []string) (arg, flagName string, found bool)
- func Failf(format string, args ...interface{})
- func GetBitriseConfigFilePath(bitriseConfigPath string) (string, error)
- func GetBitriseConfigFromBase64Data(configBase64Str string, validation bitrise.ValidationType) (models.BitriseDataModel, []string, error)
- func GetInventoryFilePath(inventoryPath string) (string, error)
- func GetInventoryFromBase64Data(inventoryBase64Str string) ([]envmanModels.EnvironmentItemModel, error)
- func GlobalFlagValuesFromArgs(fs *pflag.FlagSet, args, globalFlagNames []string) map[string]string
- func InstalledWithBrew() (bool, error)
- func IsCIMode(ciGlobalFlagPtr *bool, ...) (bool, error)
- func IsFlag(name, arg string) bool
- func IsPRMode(prGlobalFlagPtr *bool, ...) (bool, error)
- func IsQuiet(cmd *cobra.Command) bool
- func IsSSHSession() bool
- func IsSecretEnvsFiltering(filteringFlag *bool, inventoryEnvironments []envmanModels.EnvironmentItemModel) (bool, error)
- func IsSecretFiltering(filteringFlag *bool, inventoryEnvironments []envmanModels.EnvironmentItemModel) (bool, error)
- func IsSteplibOfflineMode() bool
- func IsTerminalWriter(w io.Writer) bool
- func JoinShellArgs(args []string) string
- func LatestTag() (*ver.Version, error)
- func LogCommandParameters(cmd *cobra.Command)
- func LogPluginCommandParameters(name string, _ []string)
- func LookupAppSlug(cmd *cobra.Command) string
- func NewAPIClient(cmd *cobra.Command) (*bitriseapi.Client, error)
- func NewCLIVersion() (string, error)
- func NewRDEClient(cmd *cobra.Command) (*rdeapi.Client, error)
- func NewResolver(client *bitriseapi.Client) *resolve.Resolver
- func NewVersionFromBrew() (string, error)
- func OAuthConfig() oauth.Config
- func OSDisplayName(os string) string
- func OpenBrowser(url string) error
- func OpenVNCURL(ctx context.Context, url string) error
- func PrintCLIUpdateInfos(newVersion string)
- func ReadPasswordInput(in io.Reader, stderr io.Writer, prompt string, fromStdin bool) (string, error)
- func ReadSecretInput(in io.Reader, stderr io.Writer, prompt string, fromStdin bool) (string, error)
- func RegisterCIMode(isCIMode bool) error
- func RegisterPrMode(isPRMode bool) error
- func RegisterSecretEnvsFiltering(filtering bool) error
- func RegisterSecretFiltering(filtering bool) error
- func RegisterSteplibOfflineMode(offlineMode bool)
- func RequireArgs(names ...string) cobra.PositionalArgs
- func RequireKnownSubcommand(cmd *cobra.Command, args []string) error
- func ResolveAPIBaseURL(cmd *cobra.Command) string
- func ResolveAndLookupAppSlug(cmd *cobra.Command, client *bitriseapi.Client) (string, error)
- func ResolveAndLookupWorkspaceSlug(cmd *cobra.Command, client *bitriseapi.Client, flagValue string) (slug string, usedDefault bool, err error)
- func ResolveAppSlug(cmd *cobra.Command) (string, error)
- func ResolveAppSlugArg(cmd *cobra.Command, args []string) (string, error)
- func ResolveBoolEnv(envKey string) (*bool, error)
- func ResolveBoolFlagOrEnv(fs *pflag.FlagSet, name string) (*bool, error)
- func ResolveRDEAPIBaseURL(cmd *cobra.Command) string
- func ResolveToken() (token string, fromEnv bool, err error)
- func ResolveWebBaseURL(cmd *cobra.Command) string
- func ResolveWorkspaceID(cmd *cobra.Command) (string, error)
- func SendCommandInfo(command, subcommand string, flags []string)
- func SetFlagEnvVar(fs *pflag.FlagSet, name, envKey string)
- func SetTracker(t analytics.Tracker)
- func ShellQuote(s string) string
- func ShowSubcommandHelp(cmd *cobra.Command)
- func SilenceRootErrors(cmd *cobra.Command)
- func TerminalFd(stream any) (fd int, isTerminal bool)
- func Tracker() analytics.Tracker
- type ErrWriter
- type Formatable
- type JSONLogger
- type Logger
- type RawLogger
- type YAMLLogger
Constants ¶
const ( // DefaultBitriseConfigFileName ... DefaultBitriseConfigFileName = "bitrise.yml" // DefaultSecretsFileName ... DefaultSecretsFileName = ".bitrise.secrets.yml" // OutputFormatKey ... OutputFormatKey = "output-format" )
const ( CollectionPathEnvKey = "STEPMAN_COLLECTION" CIKey = "ci" PRKey = "pr" DebugModeKey = "debug" CollectionKey = "collection" InventoryBase64Key = "inventory-base64" ConfigBase64Key = "config-base64" JSONParamsKey = "json-params" JSONParamsBase64Key = "json-params-base64" WorkflowKey = "workflow" PatternKey = "pattern" PushBranchKey = "push-branch" PRSourceBranchKey = "pr-source-branch" PRTargetBranchKey = "pr-target-branch" PRReadyStateKey = "pr-ready-state" ConfigKey = "config" InventoryKey = "inventory" // FormatKey selects the output format. It takes the -f shorthand only on // commands that have no --file flag: where both exist (yml update/validate, // rde template create/update), -f binds to --file and --format has none. FormatKey = "format" TagKey = "tag" GitKey = "git" StepIDKey = "stepid" SecretFilteringKey = "secret-filtering" )
const ( EnvOAuthIssuer = "BITRISE_OAUTH_ISSUER" EnvOIDCTokenEndpoint = "BITRISE_OIDC_TOKEN_ENDPOINT" EnvOAuthClientID = "BITRISE_OAUTH_CLIENT_ID" )
Env vars overriding the OAuth defaults below — rarely changed, mostly for pointing a build at a non-prod environment. Exported since tests set them directly.
const EnvAPIBaseURL = "BITRISE_API_BASE_URL"
EnvAPIBaseURL overrides the API base URL — rarely changed, mostly for pointing at a non-prod environment. Exported since tests set it directly.
const EnvAppID = "BITRISE_APP_ID"
EnvAppID overrides the app slug when --app isn't passed.
const EnvAppIDLegacy = "BITRISE_APP_SLUG"
EnvAppIDLegacy is the pre-rename name, still accepted below EnvAppID. Bitrise auto-injects it into every build to identify the app the build runs for (see analytics/tracker.go, configs/agent_config.go), so honoring it means a bare command inside app X's build targets app X — including `bitrise yml update`, which then overwrites that app's own bitrise.yml. That ambient targeting is intentional and matches the released CLI.
const EnvOutput = "BITRISE_OUTPUT"
EnvOutput overrides the output format when neither --output nor the "output" config key is set.
const EnvRDEAPIBaseURL = "BITRISE_RDE_API_BASE_URL"
EnvRDEAPIBaseURL overrides the RDE API base URL — rarely changed, mostly for pointing at a non-prod environment. Exported since tests set it directly.
const EnvTheme = "BITRISE_CLI_THEME"
EnvTheme overrides the color theme when neither --theme nor the "theme" config key is set.
const EnvVarAnnotation = "bitrise_env_var"
EnvVarAnnotation records the environment variable a flag is bound to. The binding drives both analytics (a flag is reported as set when its value comes from the env) and the flag/env mode resolution (see ResolveBoolFlagOrEnv).
const EnvWebBaseURL = "BITRISE_WEB_BASE_URL"
EnvWebBaseURL overrides the web base URL — rarely changed, mostly for pointing a build at a non-prod environment. Exported since tests set it directly.
const EnvWorkspaceID = workspace.EnvWorkspaceID
EnvWorkspaceID supplies the workspace when --workspace isn't passed. Bitrise auto-injects it into every build, naming the workspace that owns the app the build runs for, so a bare command inside a build acts on that workspace. Same intentional ambient targeting as EnvAppIDLegacy. Defined in internal/workspace because the shared sole-workspace error names it.
const FlagApp = "app"
FlagApp is the app slug a command acts on.
const FlagNoColor = "no-color"
FlagNoColor disables ANSI colors regardless of terminal detection.
const FlagOutput = "output"
FlagOutput is the root-persistent output format flag (raw|json|yml, plus the human alias for raw). Per-command --format flags (FormatKey) take precedence over it when set.
const FlagQuiet = "quiet"
FlagQuiet suppresses non-error diagnostic messages. Only rde commands act on it for now (see IsQuiet).
const FlagTheme = "theme"
FlagTheme selects the color theme (see internal/style.Themes).
const FlagWorkspace = "workspace"
FlagWorkspace is the workspace a command acts on.
Variables ¶
var ErrNoBitriseConfigFound = errors.New("bitrise.yml path not defined and not found on it's default path")
ErrNoBitriseConfigFound is returned when no config path was given and there is no bitrise.yml on the default path. Callers that treat "nothing to validate" as a no-op rather than a failure match on it with errors.Is.
var ErrNoToken = errors.New("no Bitrise access token configured (run 'bitrise auth login' or set BITRISE_TOKEN)")
var GlobalFlagNames = []string{DebugModeKey, CIKey, PRKey, FlagQuiet, FlagNoColor, FlagOutput, FlagTheme}
GlobalFlagNames lists the persistent flags that configure bitrise itself. They are recognised on the plugin/envman dispatch paths and reported to analytics, so the list is shared rather than repeated at each use site.
var IsTerminal = func(r io.Reader) bool { _, ok := TerminalFd(r) return ok }
IsTerminal reports whether r is an interactive terminal. Pipes and buffers never are, so callers can pick an interactive default (e.g. browser login) while keeping non-interactive stdin (CI, pipes) working.
It's a var, not a func, so tests can substitute it to exercise branches that depend on an actual TTY (e.g. cli/auth/login.go's SSH-vs-browser default) without one.
Functions ¶
func AddAppFlag ¶
AddAppFlag registers --app. Registered per-subcommand rather than as a persistent parent flag, since some of these commands are also re-registered standalone as legacy top-level aliases (see cli/root.go) that never attach to the yml parent.
func AddConfigAndInventoryFlags ¶
AddConfigAndInventoryFlags ...
func AddSecretFilteringFlag ¶
AddSecretFilteringFlag ...
func AddTriggerFilterFlags ¶
AddTriggerFilterFlags ...
func AppSlugIsUserProvided ¶
AppSlugIsUserProvided reports whether the app slug ResolveAppSlug / ResolveAppSlugArg / LookupAppSlug would return for cmd/args came from something the user typed (--app, or a positional argument in args) rather than an ambient source (BITRISE_APP_ID/BITRISE_APP_SLUG, saved config). Only a user-provided value can be a display name — ambient ones are always already a canonical slug — so callers that resolve a name to a slug themselves (rather than through ResolveAndLookupAppSlug) use this to skip that lookup, and its API call, for ambient values.
func AppSlugRequiredErr ¶
func AppSlugRequiredErr() error
AppSlugRequiredErr returns the standard missing-app-slug error.
func ApplyGlobalFlagsFromArgs ¶
ApplyGlobalFlagsFromArgs sets the global flags on the plugin/envman dispatch paths, where cobra does not parse them. Only the leading args (before the command token) are bitrise globals; anything after belongs to the passthrough.
func CheckFormatVersionSupported ¶
CheckFormatVersionSupported errors when configFormatVersion is newer than the format version this CLI supports (models.FormatVersion). A bitrise.yml requesting a newer format may use syntax this CLI version doesn't understand yet, so this is checked separately from schema validity.
func CheckPasswordStdinPiped ¶
CheckPasswordStdinPiped reports an error when --password-stdin is set but stdin is an interactive terminal rather than a pipe. Falling through to a plain (non-masked) read in that case would block on terminal input with local echo still on, silently printing the password to the screen. exampleCmd is the invocation shown in the error's pipe example, e.g. "bitrise auth login --email <email>".
func CheckValueStdinPiped ¶
CheckValueStdinPiped is CheckPasswordStdinPiped's counterpart for commands whose stdin secret arrives under --value-stdin (`rde saved-input`). Same hazard, same shape — only the flag and the prose differ, so they stay as two literal messages rather than one parameterized template.
func CommandTokenIndex ¶
CommandTokenIndex returns the index of the first argument that is not a global flag — the command/plugin/positional token. Global flags before this boundary configure bitrise; everything from it onward belongs to the command (and, for plugins and envman, is forwarded verbatim), so it must not be scanned for or stripped of global flags.
fs is the root's persistent flag set. It supplies each global's shorthand and whether it takes a value, so this scanner accepts the same spellings cobra would: a bare "--output"/"-o" is followed by its value, not by the command/plugin token, and that value must be skipped rather than mistaken for it.
func CreateBitriseConfigFromCLIParams ¶
func CreateBitriseConfigFromCLIParams(bitriseConfigBase64Data, bitriseConfigPath string, validation bitrise.ValidationType) (models.BitriseDataModel, []string, error)
CreateBitriseConfigFromCLIParams ...
func CreateDefaultMerger ¶
func CreateDefaultMerger() (*configmerge.Merger, error)
CreateDefaultMerger ...
func CreateInventoryFromCLIParams ¶
func CreateInventoryFromCLIParams(inventoryBase64Data, inventoryPath string) ([]envmanModels.EnvironmentItemModel, error)
CreateInventoryFromCLIParams ...
func DefaultWorkspaceSlug ¶
DefaultWorkspaceSlug returns the workspace configured as the default — BITRISE_WORKSPACE_ID, then the default_workspace_id config key — or "" when neither is set. It deliberately does not read --workspace: callers own that flag's precedence, and they need to know whether a value came from the flag (explicit) or from here (implicit) to report it to the user.
func DelegateToList ¶
DelegateToList forwards a bare parent invocation to its "list" subcommand, propagating the parent's context so resolved config is available.
Invoking RunE bypasses cobra's execute(), so the two things it would do for the subcommand are done here instead: InheritedFlags is called for its side effect of merging the parent chain's persistent flags (e.g. --workspace) into the subcommand's flagset, and required flags are validated explicitly.
func DetectSingleDashLongFlag ¶
DetectSingleDashLongFlag reports the first argument in args that spells a long flag name of cmd with a single dash instead of "--" (e.g. "-config"). Left to pflag, this either silently misparses as a shorthand cluster with an attached value (when the leading character happens to be a registered shorthand, e.g. "-config" becomes "-c" with value "onfig") or is rejected with a cryptic "unknown shorthand flag" error — so callers should reject it outright rather than let cobra parse it. cmd should be the resolved target command (e.g. via (*cobra.Command).Find), since a flag name is only meaningful relative to the command it is reachable on.
Tokens that pflag would consume as a preceding flag's value are skipped: pflag takes the next argument verbatim even when it starts with a dash, so `--commit-message -tag` legitimately sets the message to "-tag" and must not be mistaken for a misspelled --tag.
func Failf ¶
func Failf(format string, args ...interface{})
Failf prints a formatted error to stderr and exits the process with status 1. It must not go through the global logger (log.Errorf): that logger's writer is stdout, which would leak the error into piped machine-readable output (e.g. `stack list -o json | jq`), and re-pointing the global logger would also move `bitrise run`'s step output to stderr with it.
func GetBitriseConfigFilePath ¶
GetBitriseConfigFilePath ...
func GetBitriseConfigFromBase64Data ¶
func GetBitriseConfigFromBase64Data(configBase64Str string, validation bitrise.ValidationType) (models.BitriseDataModel, []string, error)
GetBitriseConfigFromBase64Data ...
func GetInventoryFilePath ¶
GetInventoryFilePath ...
func GetInventoryFromBase64Data ¶
func GetInventoryFromBase64Data(inventoryBase64Str string) ([]envmanModels.EnvironmentItemModel, error)
GetInventoryFromBase64Data ...
func GlobalFlagValuesFromArgs ¶
GlobalFlagValuesFromArgs returns the values the leading global flags in args assign, keyed by flag name. It reads the same tokens ApplyGlobalFlagsFromArgs would set, without touching the command — for callers that need a global's value before cobra has parsed anything.
func IsCIMode ¶
func IsCIMode(ciGlobalFlagPtr *bool, inventoryEnvironments []envmanModels.EnvironmentItemModel) (bool, error)
IsCIMode ...
func IsFlag ¶
IsFlag reports whether arg is the long flag --name or --name=value. Only the double-dash spelling is recognised, matching cobra/pflag: bitrise's long flags have no single-dash form.
func IsPRMode ¶
func IsPRMode(prGlobalFlagPtr *bool, inventoryEnvironments []envmanModels.EnvironmentItemModel) (bool, error)
IsPRMode ...
func IsSSHSession ¶
func IsSSHSession() bool
IsSSHSession reports whether the CLI is running inside an SSH session, where OpenBrowser would try to launch a browser on the remote host and the OAuth loopback redirect could never reach back to this process.
func IsSecretEnvsFiltering ¶
func IsSecretEnvsFiltering(filteringFlag *bool, inventoryEnvironments []envmanModels.EnvironmentItemModel) (bool, error)
IsSecretEnvsFiltering ...
func IsSecretFiltering ¶
func IsSecretFiltering(filteringFlag *bool, inventoryEnvironments []envmanModels.EnvironmentItemModel) (bool, error)
IsSecretFiltering ...
func IsTerminalWriter ¶
IsTerminalWriter reports whether w is an interactive terminal, e.g. for gating pretty-printing so piped or redirected output isn't reformatted.
func JoinShellArgs ¶
JoinShellArgs joins argv into a single shell-safe command string by POSIX-quoting each argument. Without quoting, `bash -c 'echo a; pwd'` would arrive at the remote as three space-separated tokens and the `;` would be reinterpreted by the remote shell, dropping `echo a`.
func LogPluginCommandParameters ¶
LogPluginCommandParameters ...
func LookupAppSlug ¶
LookupAppSlug resolves the app slug the same way as ResolveAppSlug but returns an empty string instead of an error when neither source is set — for commands where the app is optional (e.g. `yml validate --app`).
func NewAPIClient ¶
func NewAPIClient(cmd *cobra.Command) (*bitriseapi.Client, error)
NewAPIClient builds a *bitriseapi.Client using the token resolved by liveToken and the resolved API base URL.
func NewRDEClient ¶
NewRDEClient builds an *rdeapi.Client using the token resolved by liveToken and the resolved RDE API base URL.
func NewResolver ¶
func NewResolver(client *bitriseapi.Client) *resolve.Resolver
NewResolver returns a Resolver wired to client and a fresh in-memory cache, so repeated lookups within one command invocation hit the API once.
func OAuthConfig ¶
OAuthConfig builds the oauth.Config from env-var overrides, falling back to production defaults.
func OSDisplayName ¶
OSDisplayName maps a backend OS token to a human-friendly display name (e.g. "macos" → "macOS", "linux" → "Linux"); unknown values pass through unchanged. Shared by the RDE stack list and the `rde claude` stack picker so the capitalization stays consistent. This is display-only — the raw token is still what `--output json` and the wire carry.
func OpenBrowser ¶
OpenBrowser opens url in the system default browser.
func OpenVNCURL ¶
OpenVNCURL invokes the OS's default URL handler for a vnc:// URL:
- macOS: open
- Windows: cmd /c start
- other: xdg-open
Errors carry the handler's combined output so a missing xdg-open or a malformed URL is debuggable without rerunning under strace.
The vnc:// prefix is verified before shelling out. The URL is built from backend-provided host/port plus URL-escaped credentials, but the call can be triggered by a remote signal (the rde claude host bridge), so the prefix check is the trust boundary that keeps a non-vnc argument from reaching the OS handler.
func ReadPasswordInput ¶
func ReadPasswordInput(in io.Reader, stderr io.Writer, prompt string, fromStdin bool) (string, error)
ReadPasswordInput reads a password from in the same way as ReadSecretInput, but trims only a trailing line terminator — a leading/trailing space can be a deliberate part of a password and must not be silently stripped.
func ReadSecretInput ¶
ReadSecretInput reads a secret from in, trimming all surrounding whitespace (tokens are forgiving of shell copy/paste artifacts). When fromStdin is true, or in isn't a terminal, it reads a line directly; otherwise it prompts and reads a masked line.
func RegisterSecretEnvsFiltering ¶
RegisterSecretEnvsFiltering ...
func RegisterSecretFiltering ¶
RegisterSecretFiltering ...
func RegisterSteplibOfflineMode ¶
func RegisterSteplibOfflineMode(offlineMode bool)
RegisterSteplibOfflineMode ...
func RequireArgs ¶
func RequireArgs(names ...string) cobra.PositionalArgs
RequireArgs returns an Args validator that names exactly which positional argument(s) are missing, instead of cobra's generic "accepts N arg(s), received M".
func RequireKnownSubcommand ¶
RequireKnownSubcommand is the RunE for parent commands that only dispatch to subcommands (they have no action of their own): show help when invoked bare, and error on an unknown subcommand instead of silently succeeding.
func ResolveAPIBaseURL ¶
ResolveAPIBaseURL returns the resolved API base URL: BITRISE_API_BASE_URL, then the api_base_url set via `bitrise config set` (global config file only — never a per-dir .bitrise-cli.yml, see internal/config.Resolve), then the built-in default — matching ResolveWebBaseURL/ResolveRDEAPIBaseURL. Any trailing slash is trimmed here, once, so every caller can concatenate a path onto the result without producing a double slash.
func ResolveAndLookupAppSlug ¶
ResolveAndLookupAppSlug reads the app slug from --app, falling back to BITRISE_APP_ID, then BITRISE_APP_SLUG, then config app_id. Only a --app value goes through the name lookup (a targeted GET /apps?title=<value> query) — the ambient sources are already a canonical slug, so resolving those would just be a wasted API call.
func ResolveAndLookupWorkspaceSlug ¶
func ResolveAndLookupWorkspaceSlug(cmd *cobra.Command, client *bitriseapi.Client, flagValue string) (slug string, usedDefault bool, err error)
ResolveAndLookupWorkspaceSlug resolves a command's --workspace flag value (flagValue), falling back to DefaultWorkspaceSlug (BITRISE_WORKSPACE_ID / default_workspace_id). Only flagValue is resolved by name (a lookup against GET /organizations, since --workspace can be a display name) — the fallback is always already a canonical slug (Bitrise-injected or previously saved by this CLI as a slug), so it's used verbatim without an extra request. usedDefault reports whether the value came from the fallback, for callers that print a "using default workspace" breadcrumb.
func ResolveAppSlug ¶
ResolveAppSlug returns the app slug from --app, falling back to BITRISE_APP_ID, then BITRISE_APP_SLUG, then the app_id set by `bitrise app create` or `bitrise config set app_id`.
func ResolveAppSlugArg ¶
ResolveAppSlugArg is ResolveAppSlug for commands that also accept the app slug as a positional argument (e.g. `app view [APP_ID]`), which takes precedence over --app/BITRISE_APP_ID/config when given.
func ResolveBoolEnv ¶
ResolveBoolEnv resolves a bool from an env var: nil when unset or empty, the parsed value otherwise. A non-bool value is an error.
func ResolveBoolFlagOrEnv ¶
ResolveBoolFlagOrEnv resolves a bool flag that may be bound to an env var via SetFlagEnvVar. Precedence: explicit flag > bound env > nil.
func ResolveRDEAPIBaseURL ¶
ResolveRDEAPIBaseURL returns the resolved RDE API base URL: BITRISE_RDE_API_BASE_URL, then the rde_api_base_url set via `bitrise config set` (global config file only — never a per-dir .bitrise-cli.yml, see internal/config.Resolve), then the built-in default. Any trailing slash is trimmed here, once, so every caller can concatenate a path onto the result without producing a double slash.
func ResolveToken ¶
ResolveToken returns the configured token and whether it came from the BITRISE_TOKEN environment variable (true) or auth.yaml (false), without refreshing it. token is empty when neither is set; err is non-nil only on an unexpected auth.yaml load failure (a missing file is not an error).
func ResolveWebBaseURL ¶
ResolveWebBaseURL returns the resolved web base URL: BITRISE_WEB_BASE_URL, then the web_base_url set via `bitrise config set` (global config file only — never a per-dir .bitrise-cli.yml, see internal/config.Resolve), then the built-in default. Any trailing slash is trimmed here, once, so every caller can concatenate a path onto the result without producing a double slash — the built-in default carries none, but a user-set value might.
func ResolveWorkspaceID ¶
ResolveWorkspaceID returns the workspace ID for this command: --workspace, then DefaultWorkspaceSlug (BITRISE_WORKSPACE_ID / default_workspace_id), then one GET /organizations call — a sole workspace auto-detects (with a stderr breadcrumb), 2+ workspaces show an interactive picker on a TTY or a friendly sorted error otherwise. Zero workspaces always errors.
func SendCommandInfo ¶
SendCommandInfo ...
func SetFlagEnvVar ¶
SetFlagEnvVar binds a flag to an environment variable.
func SetTracker ¶
SetTracker sets the package-level tracker used by LogCommandParameters, LogPluginCommandParameters and Failf.
func ShellQuote ¶
ShellQuote wraps s in POSIX single-quotes, escaping any embedded single quotes with the standard `'\”` sequence. Strings made entirely of shell-safe characters are returned as-is to keep readable commands readable in logs.
func ShowSubcommandHelp ¶
ShowSubcommandHelp prints cmd's help output.
func SilenceRootErrors ¶
SilenceRootErrors prevents cobra from printing a returned error to stderr by setting SilenceErrors on both the command and its root. Use this when the command has already printed its own error summary and the automatic "Error: ..." line would be redundant.
func TerminalFd ¶
TerminalFd reports whether stream is an *os.File backed by a TTY. fd is only meaningful when isTerminal is true. A nil stream safely fails the type assertion below and reports false.
Types ¶
type ErrWriter ¶
type ErrWriter struct {
Err error
// contains filtered or unexported fields
}
ErrWriter wraps an io.Writer and captures the first write error so callers can chain writes and check once at the end.
func NewErrWriter ¶
NewErrWriter returns an ErrWriter backed by w.
type JSONLogger ¶
type JSONLogger struct {
// contains filtered or unexported fields
}
JSONLogger ...
type YAMLLogger ¶
type YAMLLogger struct {
// contains filtered or unexported fields
}
YAMLLogger ...
func (YAMLLogger) Print ¶
func (l YAMLLogger) Print(f Formatable)
Print marshals the concrete model behind f rather than asking it for a rendering: Formatable has no YAML method, and only the two loggers above need a hand-written one. Models reaching here need yaml tags matching their json tags, like anything else passed to output.Print.