mirror of
https://github.com/turbot/steampipe.git
synced 2025-12-19 18:12:43 -05:00
`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
29 lines
845 B
Go
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))
|
|
}
|