Files
steampipe/pkg/steampipeconfig/dependency_path.go
kaidaguerre 91436fafba Support resolution of variables for transitive dependencies using parent mod 'args' property
`steampipe mod update` now updates transitive mods
It is now be possible to set values for variables in the current mod using fully qualified variable names. 
Only variables for root mod and top level dependency mods can be set by user
Closes #3533. Closes #3547. Closes #3548. Closes #3549
2023-06-09 16:22:09 +01:00

29 lines
845 B
Go

package steampipeconfig
import "strings"
const pathSeparator = " -> "
// DependencyPathKey is a string representation of a dependency path
// - a set of mod dependencyPath values separated by '->'
//
// e.g. local -> github.com/kaidaguerre/steampipe-mod-m1@v3.1.1 -> github.com/kaidaguerre/steampipe-mod-m2@v5.1.1
type DependencyPathKey string
func newDependencyPathKey(dependencyPath ...string) DependencyPathKey {
return DependencyPathKey(strings.Join(dependencyPath, pathSeparator))
}
func (k DependencyPathKey) GetParent() DependencyPathKey {
elements := strings.Split(string(k), pathSeparator)
if len(elements) == 1 {
return ""
}
return newDependencyPathKey(elements[:len(elements)-2]...)
}
// how long is the depdency path
func (k DependencyPathKey) PathLength() int {
return len(strings.Split(string(k), pathSeparator))
}