Skip to content

Commit

Permalink
Added project property for run command
Browse files Browse the repository at this point in the history
  • Loading branch information
legap authored and Roemer committed Aug 13, 2024
1 parent c66eb91 commit 4e8c7fe
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion gttools/nx.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,21 @@ func (tool *NxTool) Affected(runType NxRunType, settings NxAffectedSettings) err
// Settings for run: https://nx.dev/nx-api/nx/documents/run
type NxRunSettings struct {
ToolSettingsBase
Project string
Target string
Configuration string
}

// Runs a target defined for your project.
func (tool *NxTool) Run(runType NxRunType, settings NxRunSettings) error {
args := []string{settings.Target}
args := []string{}
if len(settings.Project) > 0 && len(settings.Target) > 0 {
args = append(args, fmt.Sprintf("%s:%s", settings.Project, settings.Target))
} else if len(settings.Project) > 0 {
args = append(args, settings.Project)
} else if len(settings.Target) > 0 {
args = append(args, settings.Target)
}
args = goext.AppendIf(args, len(settings.Configuration) > 0, "--configuration="+settings.Configuration)
return tool.RunCommand(runType, &settings.ToolSettingsBase, "run", args...)
}
Expand Down

0 comments on commit 4e8c7fe

Please sign in to comment.