common

package
v0.1.18-rc11 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneForStream

func CloneForStream(c *http.Client) *http.Client

cloneForStream returns a shallow copy of the provided HTTP client with Timeout disabled (0). Used for SSE calls which should not have a global client timeout.

func ControlPlaneHTTPError

func ControlPlaneHTTPError(resp *http.Response) error

controlPlaneHTTPError summarises a non-2xx control-plane response.

func ExpandPath

func ExpandPath(path string) string

func ParseFlagSet

func ParseFlagSet(fs *flag.FlagSet, args []string, printUsage func()) error

ParseFlagSet handles shared FlagSet parse behavior for CLI handlers. It prints usage via printUsage on parse errors and treats --help/-h as success.

func PrintCommandUsage

func PrintCommandUsage(w io.Writer, parts ...string)

PrintCommandUsage prints a simple usage header for the given command path. It intentionally mirrors the strings used by help goldens under testdata/.

func ReadFileRooted

func ReadFileRooted(path string) ([]byte, error)

func ResolveControlPlaneHTTP

func ResolveControlPlaneHTTP(_ context.Context) (*url.URL, *http.Client, error)

ResolveControlPlaneHTTP selects the base URL and HTTP client using PLOY_SERVER_URL and PLOY_AUTH_TOKEN. Returns a client configured for bearer token authentication.

func ResolveIdentityPath

func ResolveIdentityPath(v StringValue) (string, error)

ResolveIdentityPath chooses a default SSH identity when not explicitly set.

func SplitRemoteRepoSelector

func SplitRemoteRepoSelector(selector string) (string, string)

func SupportsOSC8

func SupportsOSC8(w io.Writer) bool

func ValidateFileReadable

func ValidateFileReadable(path string) error

ValidateFileReadable checks if a file exists and is readable.

func ValidateSSHPort

func ValidateSSHPort(port int) error

ValidateSSHPort checks if a port number is in a valid range.

func WantsHelp

func WantsHelp(args []string) bool

wantsHelp checks whether the given argument list represents a help request. It returns true if the sole argument is "--help" or "-h", which is the pattern used by command routers that manually parse arguments (DisableFlagParsing: true) to detect and respond to help flags before dispatching to subcommands.

Types

type IntValue

type IntValue struct {
	IsSet bool
	Value int
}

IntValue implements flag.Value for integers.

func (*IntValue) Set

func (v *IntValue) Set(s string) error

func (*IntValue) String

func (v *IntValue) String() string

type ResolvedRemoteRepo

type ResolvedRemoteRepo struct {
	RepoURL   string
	Ref       string
	CommitSHA string
}

ResolvedRemoteRepo is the control-plane resolution of a repo selector such as namespace/repo:branch.

func ResolveRemoteRepoSelector

func ResolveRemoteRepoSelector(ctx context.Context, base *url.URL, httpClient *http.Client, selector string) (ResolvedRemoteRepo, error)

type StringValue

type StringValue struct {
	IsSet bool
	Value string
}

StringValue implements flag.Value with a marker for whether it was set.

func (*StringValue) Set

func (v *StringValue) Set(s string) error

func (*StringValue) String

func (v *StringValue) String() string

Jump to

Keyboard shortcuts

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