This commit is contained in:
Andrew Woodlee 2025-02-23 15:42:50 -06:00
parent 0007c8696a
commit 3acb20a40f
10 changed files with 174 additions and 4 deletions

View File

@ -0,0 +1,3 @@
kind: Added
body: '`list` command with subcommands `cmds` and `lists`'
time: 2025-02-20T14:45:49.562361581-06:00

View File

@ -0,0 +1,3 @@
kind: Added
body: Deprecation and unsupported warnings for old config keys
time: 2025-02-20T14:50:14.048452348-06:00

View File

@ -0,0 +1,3 @@
kind: Added
body: CLI flag `--cmdStdOut` to output command's stdout/stderr to stdout
time: 2025-02-20T14:52:45.030582408-06:00

View File

@ -0,0 +1,3 @@
kind: Added
body: Command type `remoteScript`. See docs for more info.
time: 2025-02-21T00:30:12.276616792-06:00

View File

@ -0,0 +1,3 @@
kind: Changed
body: change to enums for Command type
time: 2025-02-23T15:30:12.033359922-06:00

View File

@ -0,0 +1,3 @@
kind: Changed
body: Cache now stores resources by URL hash for ease-of-lookup
time: 2025-02-23T15:33:05.33444642-06:00

View File

@ -0,0 +1,3 @@
kind: Fixed
body: Local command's `dir` config key resolved to full path
time: 2025-02-20T14:48:43.475300515-06:00

8
.gitignore vendored
View File

@ -1,10 +1,10 @@
+.changie.yaml
+.changes/*
!.changie.yaml
!.changes/**
dist/
.codegpt
*.log
*.sh
*.yaml
*.yml
./*.yaml
./*.yml

View File

@ -0,0 +1,141 @@
// Code generated by "enumer -linecomment -yaml -text -json -type=CommandType"; DO NOT EDIT.
package backy
import (
"encoding/json"
"fmt"
"strings"
)
const _CommandTypeName = "scriptscriptFileremoteScriptpackageuser"
var _CommandTypeIndex = [...]uint8{0, 0, 6, 16, 28, 35, 39}
const _CommandTypeLowerName = "scriptscriptfileremotescriptpackageuser"
func (i CommandType) String() string {
if i < 0 || i >= CommandType(len(_CommandTypeIndex)-1) {
return fmt.Sprintf("CommandType(%d)", i)
}
return _CommandTypeName[_CommandTypeIndex[i]:_CommandTypeIndex[i+1]]
}
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
func _CommandTypeNoOp() {
var x [1]struct{}
_ = x[Default-(0)]
_ = x[Script-(1)]
_ = x[ScriptFile-(2)]
_ = x[RemoteScript-(3)]
_ = x[Package-(4)]
_ = x[User-(5)]
}
var _CommandTypeValues = []CommandType{Default, Script, ScriptFile, RemoteScript, Package, User}
var _CommandTypeNameToValueMap = map[string]CommandType{
_CommandTypeName[0:0]: Default,
_CommandTypeLowerName[0:0]: Default,
_CommandTypeName[0:6]: Script,
_CommandTypeLowerName[0:6]: Script,
_CommandTypeName[6:16]: ScriptFile,
_CommandTypeLowerName[6:16]: ScriptFile,
_CommandTypeName[16:28]: RemoteScript,
_CommandTypeLowerName[16:28]: RemoteScript,
_CommandTypeName[28:35]: Package,
_CommandTypeLowerName[28:35]: Package,
_CommandTypeName[35:39]: User,
_CommandTypeLowerName[35:39]: User,
}
var _CommandTypeNames = []string{
_CommandTypeName[0:0],
_CommandTypeName[0:6],
_CommandTypeName[6:16],
_CommandTypeName[16:28],
_CommandTypeName[28:35],
_CommandTypeName[35:39],
}
// CommandTypeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func CommandTypeString(s string) (CommandType, error) {
if val, ok := _CommandTypeNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _CommandTypeNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to CommandType values", s)
}
// CommandTypeValues returns all values of the enum
func CommandTypeValues() []CommandType {
return _CommandTypeValues
}
// CommandTypeStrings returns a slice of all String values of the enum
func CommandTypeStrings() []string {
strs := make([]string, len(_CommandTypeNames))
copy(strs, _CommandTypeNames)
return strs
}
// IsACommandType returns "true" if the value is listed in the enum definition. "false" otherwise
func (i CommandType) IsACommandType() bool {
for _, v := range _CommandTypeValues {
if i == v {
return true
}
}
return false
}
// MarshalJSON implements the json.Marshaler interface for CommandType
func (i CommandType) MarshalJSON() ([]byte, error) {
return json.Marshal(i.String())
}
// UnmarshalJSON implements the json.Unmarshaler interface for CommandType
func (i *CommandType) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
return fmt.Errorf("CommandType should be a string, got %s", data)
}
var err error
*i, err = CommandTypeString(s)
return err
}
// MarshalText implements the encoding.TextMarshaler interface for CommandType
func (i CommandType) MarshalText() ([]byte, error) {
return []byte(i.String()), nil
}
// UnmarshalText implements the encoding.TextUnmarshaler interface for CommandType
func (i *CommandType) UnmarshalText(text []byte) error {
var err error
*i, err = CommandTypeString(string(text))
return err
}
// MarshalYAML implements a YAML Marshaler for CommandType
func (i CommandType) MarshalYAML() (interface{}, error) {
return i.String(), nil
}
// UnmarshalYAML implements a YAML Unmarshaler for CommandType
func (i *CommandType) UnmarshalYAML(unmarshal func(interface{}) error) error {
var s string
if err := unmarshal(&s); err != nil {
return err
}
var err error
*i, err = CommandTypeString(s)
return err
}

8
pkg/backy/tools.go Normal file
View File

@ -0,0 +1,8 @@
//go:build tools
package backy
import (
// Protect this entry in go.mod from being removed by go mod tidy.
_ "github.com/dmarkham/enumer"
)