jorge

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// E000 System level errors
	E000 ErrorCode = "The active directory does not exist"
	E001 ErrorCode = "Directory already exist" // Already exists
	E002 ErrorCode = "Path is not a directory"
	E003 ErrorCode = "Could not create directory"
	E004 ErrorCode = "Target file is not a regular file"
	E005 ErrorCode = "Unknown error"
	E006 ErrorCode = "Could not open target file"
	E007 ErrorCode = "Could not write to file"
	E008 ErrorCode = "Error constructing path"
	E009 ErrorCode = "Could not delete the target directory"

	// E100 Application level errors. >= 100
	E100 = "Active directory does not belong in a jorge project"
	E101 = "Path to .jorge is not a directory"
	E102 = "Envs directory already exist"
	E103 = "Corrupted internal jorge directory (.jorge)"
	E104 = "Could not open the jorge configuration"
	E105 = "Could not read jorge config yaml file"
	E106 = "Could not write jorge config yaml file"
	E107 = "Could not read configuration file"
	E108 = "Could not Create internal directory for the configuration environment"
	E109 = "Environment already exist"
	E110 = "Could not store configuration file"
	E111 = "Environment does not exist"
	E112 = "Can not delete the active environment"
)
View Source
const (
	// S000 system level messages
	S000 SolutionMessage = "Please make sure the active directory is a valid path"
	S001 SolutionMessage = "Make sure %s is a directory"
	S002 SolutionMessage = "Make sure user %s has write access to the active directory"
	S003 SolutionMessage = "Make sure %s file exist and is readable by the user"

	// S100 application level messages
	S100 = "Please run `jorge init` to initialize a jorge project"
	S101 = "Do not try to initialize a directory which is already a jorge project"
	S102 = "" /* 130-byte string literal not displayed */
	S103 = "Make sure user %s has write privileges to .jorge directory"
	S104 = "Please use an environment name that is not already in use. You can use `jorge ls` to see the list of current environments"
	S105 = "You can create environment by running `jorge use -n %s`"
	S106 = "Please select another environment or create a new one"
)

Variables

This section is empty.

Functions

func AppendToFile

func AppendToFile(filePath string, element string) error

func Contains

func Contains(elems []string, v string) bool

func ExistsInFile

func ExistsInFile(filePath string, element string) (bool, error)

func GetUser

func GetUser() string

Types

type EncapsulatedError

type EncapsulatedError struct {
	OriginalErr error
	Message     string
	Solution    string
	Code        int
}

func CommitCurrentEnv

func CommitCurrentEnv() *EncapsulatedError

CommitCurrentEnv It stores the current active user configuration file under the current selected jorge environment (found at the ./jorge/config.yml file)

func Init

func Init(configFilePathFlag string) *EncapsulatedError

Init Initializes a jorge project by creating the .jorge directory, setting the first environment and requesting the config file path for the user

func ListEnvironments

func ListEnvironments() *EncapsulatedError

ListEnvironments Shows a list with all the available environment for the user

func NewEncapsulatedError

func NewEncapsulatedError(err error, message string, solution string) *EncapsulatedError

func RemoveEnv

func RemoveEnv(envName string) *EncapsulatedError

func RestoreEnv

func RestoreEnv() *EncapsulatedError

RestoreEnv It replaces the current active configuration file, with the one that is stored under the current environment (found under the ./.jorge/config.yml)

func SelectEnvironment

func SelectEnvironment(envName string) *EncapsulatedError

func StoreConfigFile

func StoreConfigFile(path string, envName string) (int64, *EncapsulatedError)

StoreConfigFile It stores the current active user config file under an jorge environment name

func UseConfigFile

func UseConfigFile(envName string, createEnv bool) (int64, *EncapsulatedError)

UseConfigFile It replaces the current active user configuration file with the one that is stored under the jorge environment

type ErrorCode

type ErrorCode string

func (ErrorCode) Err

func (e ErrorCode) Err() error

func (ErrorCode) Is

func (e ErrorCode) Is(targetError ErrorCode) bool

func (ErrorCode) Str

func (e ErrorCode) Str() string

type JorgeConfig

type JorgeConfig struct {
	CurrentEnv     string `yaml:"currentEnv"`
	ConfigFilePath string `yaml:"configFilePath"`
}

type SolutionMessage

type SolutionMessage string

func (SolutionMessage) Str

func (s SolutionMessage) Str(args ...interface{}) string

Jump to

Keyboard shortcuts

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