Documentation ¶
Index ¶
- Constants
- Variables
- func AskForOptions(options []string, label string) (string, error)
- func AskIfDeploy(name, namespace string) error
- func AskIfOktetoInit(devPath string) bool
- func AskYesNo(q string, d YesNoDefault) (bool, error)
- func AsksQuestion(q string) (string, error)
- func CheckIfDirectory(path string) error
- func DeprecatedLoadManifest(devPath string, fs afero.Fs) (*model.Manifest, error)
- func DeprecatedLoadManifestOrDefault(devPath, name string, fs afero.Fs) (*model.Manifest, error)
- func ExactArgsAccepted(n int, url string) cobra.PositionalArgs
- func GetApp(ctx context.Context, dev *model.Dev, c kubernetes.Interface, isRetry bool) (apps.App, bool, error)
- func GetBranch(path string) (string, error)
- func GetDevFromManifest(manifest *model.Manifest, devName string) (*model.Dev, error)
- func GetDownCommand(devPath string) string
- func GetLatestVersionFromGithub() (string, error)
- func GetRandomSHA() string
- func GetStackFiles(cwd string) []string
- func GetUpgradeCommand() string
- func GetWarningState(path, name string) string
- func HasAccessToK8sClusterNamespace(ctx context.Context, namespace string, k8sClient kubernetes.Interface) (bool, error)
- func HasAccessToOktetoClusterNamespace(ctx context.Context, namespace string, oktetoClient types.OktetoInterface) (bool, error)
- func IsOktetoRepo() bool
- func LoadManifestContext(devPath string) (*model.ContextResource, error)
- func LoadManifestRc(dev *model.Dev) error
- func LoadStackContext(stackPaths []string) (*model.ContextResource, error)
- func MaximumNArgsAccepted(n int, url string) cobra.PositionalArgs
- func MinimumNArgsAccepted(n int, url string) cobra.PositionalArgs
- func NewLineBarFiller(filler mpb.BarFiller) mpb.BarFiller
- func NoArgsAccepted(url string) cobra.PositionalArgs
- func ParseURL(u string) (string, error)
- func Percentage(total, current int64, width int) float64
- func RenderProgressBar(prefix string, current, scalingFactor float64) string
- func SelectDevFromManifest(manifest *model.Manifest, selector OktetoSelectorInterface, devs []string) (*model.Dev, error)
- func SetWarningState(path, name, value string) error
- func ShouldCreateNamespace(ctx context.Context, ns string) (bool, error)
- func ShouldCreateNamespaceStateless(ctx context.Context, ns string, c *okteto.Client) (bool, error)
- func ShouldNotify(latest, current *semver.Version) bool
- func UpgradeAvailable() string
- type OktetoSelector
- type OktetoSelectorInterface
- type ProgressBar
- type SelectorItem
- type SyncthingProgress
- type YesNoDefault
Constants ¶
const ( YesNoDefault_Unspecified = "[y/n]" YesNoDefault_Yes = "[Y/n]" YesNoDefault_No = "[y/N]" )
const (
// DefaultManifest default okteto manifest file
DefaultManifest = "okteto.yml"
)
Variables ¶
var ErrInvalidOption = errors.New("invalid option")
ErrInvalidOption is raised when the selector has an invalid option
var ( // ErrNoDevSelected is raised when no development environment is selected ErrNoDevSelected = errors.New("No Development Environment selected") )
Functions ¶
func AskIfDeploy ¶
AskIfDeploy asks if a new deployment must be created
func AskIfOktetoInit ¶
AskIfOktetoInit asks if okteto init should be executed
func AskYesNo ¶
func AskYesNo(q string, d YesNoDefault) (bool, error)
AskYesNo prompts for yes/no confirmation
func AsksQuestion ¶
AsksQuestion asks a question to the user
func CheckIfDirectory ¶
CheckIfDirectory checks if a path is a directory
func DeprecatedLoadManifest ¶
DeprecatedLoadManifest loads an okteto manifest checking "yml" and "yaml". Deprecated: use model.GetManifestV2 instead
func DeprecatedLoadManifestOrDefault ¶
DeprecatedLoadManifestOrDefault loads an okteto manifest or a default one if does not exist Deprecatd. It should only be used by `push` command that will be deleted on next major version. No new usages should be added
func ExactArgsAccepted ¶
func ExactArgsAccepted(n int, url string) cobra.PositionalArgs
ExactArgsAccepted returns an error if there are not exactly n args.
func GetDevFromManifest ¶
GetDevFromManifest gets a dev from a manifest by comparing the given dev name with the dev name in the manifest
func GetDownCommand ¶
func GetLatestVersionFromGithub ¶
GetLatestVersionFromGithub returns the latest okteto version from GitHub
func GetRandomSHA ¶
func GetRandomSHA() string
GetRandomSHA returns a random sha generated in the fly
func GetStackFiles ¶
GetStackFiles returns the list of stack files on a path
func GetUpgradeCommand ¶
func GetUpgradeCommand() string
func GetWarningState ¶
GetWarningState returns the value associated to a given warning
func HasAccessToK8sClusterNamespace ¶
func HasAccessToK8sClusterNamespace(ctx context.Context, namespace string, k8sClient kubernetes.Interface) (bool, error)
HasAccessToK8sClusterNamespace checks if the user has access to a namespace
func HasAccessToOktetoClusterNamespace ¶
func HasAccessToOktetoClusterNamespace(ctx context.Context, namespace string, oktetoClient types.OktetoInterface) (bool, error)
HasAccessToOktetoClusterNamespace checks if the user has access to a namespace/preview
func IsOktetoRepo ¶
func IsOktetoRepo() bool
func LoadManifestContext ¶
func LoadManifestContext(devPath string) (*model.ContextResource, error)
LoadManifestContext loads the contextresource from a file
func LoadManifestRc ¶
func LoadStackContext ¶
func LoadStackContext(stackPaths []string) (*model.ContextResource, error)
LoadStackContext loads the namespace and context of an okteto stack manifest
func MaximumNArgsAccepted ¶
func MaximumNArgsAccepted(n int, url string) cobra.PositionalArgs
MaximumNArgsAccepted returns an error if there are more than N args.
func MinimumNArgsAccepted ¶
func MinimumNArgsAccepted(n int, url string) cobra.PositionalArgs
MinimumNArgsAccepted returns an error if there are less than N args.
func NewLineBarFiller ¶
func NewLineBarFiller(filler mpb.BarFiller) mpb.BarFiller
func NoArgsAccepted ¶
func NoArgsAccepted(url string) cobra.PositionalArgs
NoArgsAccepted validates that the number of arguments given by the user is 0
func Percentage ¶
func RenderProgressBar ¶
RenderProgressBar displays a progress bar
func SelectDevFromManifest ¶
func SelectDevFromManifest(manifest *model.Manifest, selector OktetoSelectorInterface, devs []string) (*model.Dev, error)
SelectDevFromManifest prompts the selector to choose a development container and returns the dev selected or error
func SetWarningState ¶
SetWarningState sets the value associated to a given warning
func ShouldCreateNamespace ¶
ShouldCreateNamespace checks if the user has access to the namespace. If not, ask the user if he wants to create it
func ShouldCreateNamespaceStateless ¶
ShouldCreateNamespaceStateless checks if the user has access to the namespace. If not, ask the user if he wants to create it
func ShouldNotify ¶
func ShouldNotify(latest, current *semver.Version) bool
func UpgradeAvailable ¶
func UpgradeAvailable() string
Types ¶
type OktetoSelector ¶
type OktetoSelector struct { Templates *promptui.SelectTemplates Keys *promptui.SelectKeys OktetoTemplates *oktetoTemplates Label string Items []SelectorItem Size int }
OktetoSelector implements the OktetoSelectorInterface
func NewOktetoSelector ¶
func NewOktetoSelector(label string, selectedTpl string) *OktetoSelector
NewOktetoSelector returns a selector set up with the label and options from the input
func (*OktetoSelector) AskForOptionsOkteto ¶
func (s *OktetoSelector) AskForOptionsOkteto(options []SelectorItem, initialPosition int) (string, error)
AskForOptionsOkteto given some options ask the user to select one
type OktetoSelectorInterface ¶
type OktetoSelectorInterface interface {
AskForOptionsOkteto(options []SelectorItem, initialPosition int) (string, error)
}
OktetoSelectorInterface represents an interface for a selector
type ProgressBar ¶
type ProgressBar struct {
// contains filtered or unexported fields
}
ProgressBar tracks progress of the download
func (*ProgressBar) TrackProgress ¶
func (cpb *ProgressBar) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser
TrackProgress instantiates a new progress bar that will display the progress of stream until closed. total can be 0.
type SelectorItem ¶
SelectorItem represents a selectable item on a selector
type SyncthingProgress ¶
type SyncthingProgress struct {
// contains filtered or unexported fields
}
SyncthingProgress tracks the progress of all the files syncthing
func NewSyncthingProgressBar ¶
func NewSyncthingProgressBar(width int) *SyncthingProgress
NewSyncthingProgressBar creates a new syncthing progress
func (*SyncthingProgress) Finish ¶
func (s *SyncthingProgress) Finish()
Finish finishes the progress bar
func (*SyncthingProgress) ItemStartedDecorator ¶
func (sync *SyncthingProgress) ItemStartedDecorator(wcc ...decor.WC) decor.Decorator
func (*SyncthingProgress) SetCurrent ¶
func (s *SyncthingProgress) SetCurrent(v int64)
SetCurrent sets current progress of the syncthing progress bar
func (*SyncthingProgress) UpdateItemInSync ¶
func (s *SyncthingProgress) UpdateItemInSync(lastItem string)
UpdateItemInSync updates the item in sync
type YesNoDefault ¶
type YesNoDefault string
YesNoDefault specifies what will be assumed when the user doesn't answer explicitly