Skip to content

Commit

Permalink
fix: name actions instead of do
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexox committed Nov 6, 2024
1 parent 6d64df6 commit bd4c85e
Show file tree
Hide file tree
Showing 5 changed files with 224 additions and 224 deletions.
18 changes: 9 additions & 9 deletions internal/config/do.go → internal/config/actions.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package config

type Do struct {
type Action struct {
Name string `json:"name,omitempty" mapstructure:"name" toml:"name,omitempty" yaml:",omitempty"`
Run string `json:"run,omitempty" mapstructure:"run" toml:"run,omitempty" yaml:",omitempty"`
Script string `json:"script,omitempty" mapstructure:"script" toml:"script,omitempty" yaml:",omitempty"`
Expand Down Expand Up @@ -33,18 +33,18 @@ type Group struct {
Parallel bool `json:"parallel,omitempty" mapstructure:"parallel" toml:"parallel,omitempty" yaml:",omitempty"`
Piped bool `json:"piped,omitempty" mapstructure:"piped" toml:"piped,omitempty" yaml:",omitempty"`
Glob string `json:"glob,omitempty" mapstructure:"glob" toml:"glob,omitempty" yaml:",omitempty"`
Do []*Do `json:"do,omitempty" mapstructure:"do" toml:"do,omitempty" yaml:",omitempty"`
Actions []*Action `json:"actions,omitempty" mapstructure:"actions" toml:"actions,omitempty" yaml:",omitempty"`
}

func (do *Do) PrintableName(id string) string {
if len(do.Name) != 0 {
return do.Name
func (action *Action) PrintableName(id string) string {
if len(action.Name) != 0 {
return action.Name
}
if len(do.Run) != 0 {
return do.Run
if len(action.Run) != 0 {
return action.Run
}
if len(do.Script) != 0 {
return do.Script
if len(action.Script) != 0 {
return action.Script
}

return "[" + id + "]"
Expand Down
2 changes: 1 addition & 1 deletion internal/config/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Hook struct {
Skip interface{} `json:"skip,omitempty" mapstructure:"skip" toml:"skip,omitempty,inline" yaml:",omitempty"`
Only interface{} `json:"only,omitempty" mapstructure:"only" toml:"only,omitempty,inline" yaml:",omitempty"`

Do []*Do `json:"do,omitempty" mapstructure:"do" toml:"do,omitempty" yaml:",omitempty"`
Actions []*Action `json:"actions,omitempty" mapstructure:"actions" toml:"actions,omitempty" yaml:",omitempty"`

// Should be unmarshalled with `mapstructure:"commands"`
// But replacing '{cmd}' is still an issue
Expand Down
213 changes: 0 additions & 213 deletions internal/lefthook/runner/do.go

This file was deleted.

Loading

0 comments on commit bd4c85e

Please sign in to comment.