Documentation
¶
Index ¶
Constants ¶
const ( Self = "self" CommandUpdate = "update" CommandUninstall = "uninstall" CommandVersion = "version" CommandHelp = "help" )
Variables ¶
var ErrNotSelfCommand = errors.New("not a self command")
ErrNotSelfCommand is returned when the command is not a self command.
Functions ¶
func HandleAppVersion ¶ added in v0.2.0
HandleAppVersion handles the app binary version.
func HandleError ¶ added in v0.2.0
HandleError prints error messages and exits with status code 1.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App represents the main app.
func NewAppGitBack ¶ added in v0.2.0
NewAppGitBack creates a new App instance for git-back.
func NewAppGitUndo ¶ added in v0.2.0
NewAppGitUndo creates a new App instance.
func (*App) HandleVersion ¶ added in v0.2.0
HandleVersion handles the --version flag by delegating to SelfController.
type GitHelper ¶
type GitHelper interface { GetCurrentGitRef() (string, error) GetRepoGitDir() (string, error) GitRun(subCmd string, args ...string) error GitOutput(subCmd string, args ...string) (string, error) }
GitHelper provides methods for reading git references.
type RunOptions ¶ added in v0.2.0
RunOptions contains parsed CLI options.
type SelfController ¶ added in v0.1.1
type SelfController struct {
// contains filtered or unexported fields
}
SelfController handles self-management commands that don't require a git repository.
func NewSelfController ¶ added in v0.1.1
func NewSelfController(version, versionSource string, verbose bool, appName string) *SelfController
NewSelfController creates a new SelfController instance.
func (*SelfController) AddScript ¶ added in v0.1.1
func (sc *SelfController) AddScript(cmdName, script string) *SelfController
func (*SelfController) ExtractSelfCommand ¶ added in v0.1.1
func (sc *SelfController) ExtractSelfCommand(args []string) string
ExtractSelfCommand checks if the given arguments represent a self-management command.
func (*SelfController) HandleSelfCommand ¶ added in v0.1.1
func (sc *SelfController) HandleSelfCommand(args []string) error
HandleSelfCommand processes self-management commands and returns true if handled. Returns (handled, error) where handled indicates if the command was a self command.