cmd

package
v0.1.0-alpha.8 Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = cli.Command{
	Name:  "stl",
	Usage: "CLI for the stainless API",
	Commands: []*cli.Command{
		{
			Name: "projects",
			Commands: []*cli.Command{
				&projectsRetrieve,
				&projectsUpdate,
				&projectsList,
			},
		},

		{
			Name: "projects:branches",
			Commands: []*cli.Command{
				&projectsBranchesCreate,
				&projectsBranchesRetrieve,
			},
		},

		{
			Name: "projects:configs",
			Commands: []*cli.Command{
				&projectsConfigsRetrieve,
				&projectsConfigsGuess,
			},
		},

		{
			Name: "projects:snippets",
			Commands: []*cli.Command{
				&projectsSnippetsCreateRequest,
			},
		},

		{
			Name: "builds",
			Commands: []*cli.Command{
				&buildsCreate,
				&buildsRetrieve,
				&buildsList,
				&buildsCompare,
			},
		},

		{
			Name: "build_target_outputs",
			Commands: []*cli.Command{
				&buildTargetOutputsRetrieve,
			},
		},

		{
			Name: "orgs",
			Commands: []*cli.Command{
				&orgsRetrieve,
				&orgsList,
			},
		},
	},
	EnableShellCompletion: true,
	HideHelpCommand:       true,
}

Functions

func CheckInteractiveAndInitWorkspace

func CheckInteractiveAndInitWorkspace(cmd *cli.Command, projectName string)

CheckInteractiveAndInitWorkspace checks if running in interactive mode and prompts to init workspace if needed

func ConfigDir

func ConfigDir() (string, error)

ConfigDir returns the directory where config files are stored

func GetProjectName

func GetProjectName(cmd *cli.Command, flagName string) string

GetProjectName returns the project name from the command line flag or workspace config

func GetProjectNameFromConfig

func GetProjectNameFromConfig() string

GetProjectNameFromConfig returns the project name from workspace config if available

func InitWorkspaceConfig

func InitWorkspaceConfig(projectName, openAPISpec, stainlessConfig string) error

InitWorkspaceConfig initializes a new workspace config in the current directory

func SaveAuthConfig

func SaveAuthConfig(config *AuthConfig) error

SaveAuthConfig saves the auth config to disk

func SaveWorkspaceConfig

func SaveWorkspaceConfig(configPath string, config *WorkspaceConfig) error

SaveWorkspaceConfig saves the workspace config to the specified path

Types

type AuthConfig

type AuthConfig struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token,omitempty"`
	TokenType    string `json:"token_type"`
}

AuthConfig stores the OAuth credentials

func LoadAuthConfig

func LoadAuthConfig() (*AuthConfig, error)

LoadAuthConfig loads the auth config from disk

func StartDeviceFlow

func StartDeviceFlow(clientID, scope string) (*AuthConfig, error)

StartDeviceFlow initiates the OAuth 2.0 device flow

type WorkspaceConfig

type WorkspaceConfig struct {
	Project         string `json:"project"`
	OpenAPISpec     string `json:"openapi_spec,omitempty"`
	StainlessConfig string `json:"stainless_config,omitempty"`
}

WorkspaceConfig stores workspace-level configuration

func FindWorkspaceConfig

func FindWorkspaceConfig() (*WorkspaceConfig, string, error)

FindWorkspaceConfig searches for a stainless-workspace.json file starting from the current directory and moving up to parent directories until found or root is reached

func LoadWorkspaceConfig

func LoadWorkspaceConfig(configPath string) (*WorkspaceConfig, error)

LoadWorkspaceConfig loads the workspace config from the specified path

Jump to

Keyboard shortcuts

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