shared

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package shared provides flags common to multiple draftsman commands.

Index

Constants

View Source
const DefaultConfigPath = ".draftsman.yml"

Variables

This section is empty.

Functions

func BackendFlag

func BackendFlag(required bool) *cli.StringFlag

BackendFlag selects which git backend to talk to. Required when set to true (draft/publish need to reach the backend API); optional for preview, where it only enables best-effort PR enrichment.

func BaseURLFlag

func BaseURLFlag() *cli.StringFlag

BaseURLFlag is the git hosting instance's API base URL. GitHub ignores it (fixed api.github.com); self-hosted backends (gitea, forgejo) require it — ResolveBackend enforces that, since it can't be expressed as a static per-flag Required (whether it's required depends on --backend's value, known only at runtime). GitLab defaults to gitlab.com when unset, same as GitHub, but accepts an override for a self-hosted instance.

func ConfigFlag

func ConfigFlag() *cli.StringFlag

ConfigFlag is the path to the repo's .draftsman.yml.

func PackageFlag

func PackageFlag() *cli.StringFlag

PackageFlag scopes an operation to a single package in multi mode. Unused in single mode.

func RepoFlag

func RepoFlag(required bool) *cli.StringFlag

RepoFlag identifies the target repository as "owner/repo". Required alongside BackendFlag/TokenFlag for any command that talks to a backend API. GITHUB_REPOSITORY and CI_PROJECT_PATH are GitHub Actions' and GitLab CI's own auto-injected env vars, in the same "owner/repo" form (CI_PROJECT_PATH includes any nested group), so either works as a source with no extra setup.

func ResolveBackend

func ResolveBackend(cmd *cli.Command, required bool) (backend.Backend, error)

ResolveBackend constructs a Backend from cmd's --backend/--token/--repo flags. When required is true (draft/publish, where these flags are already CLI-required), missing pieces or an unsupported backend are errors. When required is false (preview, where backend access is only optional PR-Reference enrichment — ADR-0001), anything missing or unsupported just means no enrichment: a nil Backend, no error.

func TokenFlag

func TokenFlag(required bool) *cli.StringFlag

TokenFlag is the backend API token. Required alongside BackendFlag.

Types

This section is empty.

Jump to

Keyboard shortcuts

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