state

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStatePath

func GetStatePath() (string, error)

GetStatePath determines the appropriate location for the state file. The state file is stored in .datarobot/cli directory within the current repository.

func HasCompletedDotenvSetup

func HasCompletedDotenvSetup() bool

HasCompletedDotenvSetup checks if dotenv setup has been completed in the past. If force-interactive flag is set, this always returns false to force re-execution.

func Save

func Save(state *State) error

Save writes the state file to the appropriate location. Creates parent directories if they don't exist. Note: Consider using Update() instead, which automatically sets CLIVersion.

func UpdateAfterDotenvSetup

func UpdateAfterDotenvSetup() error

UpdateAfterDotenvSetup updates the state file after a successful `dr dotenv setup` run.

func UpdateAfterSuccessfulRun

func UpdateAfterSuccessfulRun() error

UpdateAfterSuccessfulRun creates or updates the state file after a successful `dr start` run.

func UpdateAfterTemplatesSetup added in v0.2.9

func UpdateAfterTemplatesSetup() error

UpdateAfterTemplatesSetup updates the state file after a successful `dr templates setup` run.

Types

type State

type State struct {
	// CLIVersion is the version of the CLI used for the successful run
	CLIVersion string `yaml:"cli_version"`
	// LastStart is an ISO8601-compliant timestamp of the last successful `dr start` run
	LastStart time.Time `yaml:"last_start"`
	// LastTemplatesSetup is an ISO8601-compliant timestamp of the last successful `dr templates setup` run
	LastTemplatesSetup *time.Time `yaml:"last_templates_setup,omitempty"`
	// LastDotenvSetup is an ISO8601-compliant timestamp of the last successful `dr dotenv setup` run
	LastDotenvSetup *time.Time `yaml:"last_dotenv_setup,omitempty"`
}

State represents the current state of CLI interactions with a repository.

func Load

func Load() (*State, error)

Load reads the state file from the appropriate location. Returns nil if the file doesn't exist (first run).

func (*State) Update

func (s *State) Update() error

Update saves the state file and automatically sets the CLIVersion. This should be the preferred method for saving state.

Jump to

Keyboard shortcuts

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