Skip to content

Commit

Permalink
fix: add module
Browse files Browse the repository at this point in the history
  • Loading branch information
kooksee committed Jan 26, 2024
1 parent 01ab84f commit cf1b3ef
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
15 changes: 14 additions & 1 deletion cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,22 @@ func Main() *cli.App {
return false
}

if !hasPath() {
var hasModule = func() bool {
for _, opt := range opts {
if strings.HasPrefix(opt, "module=") {
return true
}
}
return false
}

if !hasPath() && basePlugin.Paths != "" {
opts = append(opts, fmt.Sprintf("paths=%s", basePlugin.Paths))
}

if !hasModule() && basePlugin.Module != "" {
opts = append(opts, fmt.Sprintf("module=%s", basePlugin.Module))
}
}

if plg.Shell != "" || plg.Docker != "" {
Expand Down
5 changes: 3 additions & 2 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ type Cfg struct {
}

type basePluginCfg struct {
Out string `yaml:"out,omitempty"`
Paths string `yaml:"paths,omitempty"`
Out string `yaml:"out,omitempty"`
Paths string `yaml:"paths,omitempty"`
Module string `yaml:"module,omitempty"`
}

type plugin struct {
Expand Down

0 comments on commit cf1b3ef

Please sign in to comment.