mirror of
https://github.com/rsteube/carapace-bin.git
synced 2025-05-05 15:32:53 +00:00
helm: fix action signature
This commit is contained in:
parent
5964c9f06a
commit
3e7dc814e4
@ -76,7 +76,7 @@ func init() {
|
||||
"version": carapace.ActionCallback(func(c carapace.Context) carapace.Action {
|
||||
if len(c.Args) > 1 {
|
||||
if splitted := strings.Split(c.Args[1], "/"); len(splitted) == 2 {
|
||||
return helm.ActionChartVersions(splitted[0], splitted[1])
|
||||
return helm.ActionChartVersions(helm.ChartVersionOpts{Repo: splitted[0], Chart: splitted[1]})
|
||||
}
|
||||
}
|
||||
return carapace.ActionValues()
|
||||
|
@ -45,7 +45,7 @@ func init() {
|
||||
"version": carapace.ActionCallback(func(c carapace.Context) carapace.Action {
|
||||
if len(c.Args) > 0 {
|
||||
if splitted := strings.Split(c.Args[0], "/"); len(splitted) == 2 {
|
||||
return helm.ActionChartVersions(splitted[0], splitted[1])
|
||||
return helm.ActionChartVersions(helm.ChartVersionOpts{Repo: splitted[0], Chart: splitted[1]})
|
||||
}
|
||||
}
|
||||
return carapace.ActionValues()
|
||||
|
@ -39,7 +39,7 @@ func init() {
|
||||
"version": carapace.ActionCallback(func(c carapace.Context) carapace.Action {
|
||||
if len(c.Args) > 0 {
|
||||
if splitted := strings.Split(c.Args[0], "/"); len(splitted) == 2 {
|
||||
return helm.ActionChartVersions(splitted[0], splitted[1])
|
||||
return helm.ActionChartVersions(helm.ChartVersionOpts{Repo: splitted[0], Chart: splitted[1]})
|
||||
}
|
||||
}
|
||||
return carapace.ActionValues()
|
||||
|
@ -39,7 +39,7 @@ func init() {
|
||||
"version": carapace.ActionCallback(func(c carapace.Context) carapace.Action {
|
||||
if len(c.Args) > 0 {
|
||||
if splitted := strings.Split(c.Args[0], "/"); len(splitted) == 2 {
|
||||
return helm.ActionChartVersions(splitted[0], splitted[1])
|
||||
return helm.ActionChartVersions(helm.ChartVersionOpts{Repo: splitted[0], Chart: splitted[1]})
|
||||
}
|
||||
}
|
||||
return carapace.ActionValues()
|
||||
|
@ -39,7 +39,7 @@ func init() {
|
||||
"version": carapace.ActionCallback(func(c carapace.Context) carapace.Action {
|
||||
if len(c.Args) > 0 {
|
||||
if splitted := strings.Split(c.Args[0], "/"); len(splitted) == 2 {
|
||||
return helm.ActionChartVersions(splitted[0], splitted[1])
|
||||
return helm.ActionChartVersions(helm.ChartVersionOpts{Repo: splitted[0], Chart: splitted[1]})
|
||||
}
|
||||
}
|
||||
return carapace.ActionValues()
|
||||
|
@ -40,7 +40,7 @@ func init() {
|
||||
"version": carapace.ActionCallback(func(c carapace.Context) carapace.Action {
|
||||
if len(c.Args) > 0 {
|
||||
if splitted := strings.Split(c.Args[0], "/"); len(splitted) == 2 {
|
||||
return helm.ActionChartVersions(splitted[0], splitted[1])
|
||||
return helm.ActionChartVersions(helm.ChartVersionOpts{Repo: splitted[0], Chart: splitted[1]})
|
||||
}
|
||||
}
|
||||
return carapace.ActionValues()
|
||||
|
@ -80,7 +80,7 @@ func init() {
|
||||
"version": carapace.ActionCallback(func(c carapace.Context) carapace.Action {
|
||||
if len(c.Args) > 1 {
|
||||
if splitted := strings.Split(c.Args[1], "/"); len(splitted) == 2 {
|
||||
return helm.ActionChartVersions(splitted[0], splitted[1])
|
||||
return helm.ActionChartVersions(helm.ChartVersionOpts{Repo: splitted[0], Chart: splitted[1]})
|
||||
}
|
||||
}
|
||||
return carapace.ActionValues()
|
||||
|
@ -88,10 +88,15 @@ func ActionCharts(repo string) carapace.Action {
|
||||
})
|
||||
}
|
||||
|
||||
type ChartVersionOpts struct {
|
||||
Repo string
|
||||
Chart string
|
||||
}
|
||||
|
||||
// ActionChartVersions completes chart versions
|
||||
func ActionChartVersions(repo string, chart string) carapace.Action {
|
||||
func ActionChartVersions(opts ChartVersionOpts) carapace.Action {
|
||||
return carapace.ActionCallback(func(c carapace.Context) carapace.Action {
|
||||
index, err := loadIndex(repo)
|
||||
index, err := loadIndex(opts.Repo)
|
||||
if err != nil {
|
||||
return carapace.ActionMessage(err.Error())
|
||||
}
|
||||
@ -99,7 +104,7 @@ func ActionChartVersions(repo string, chart string) carapace.Action {
|
||||
vals := make([]string, 0)
|
||||
for _, charts := range index.Entries {
|
||||
for _, c := range charts {
|
||||
if c.Name == chart {
|
||||
if c.Name == opts.Chart {
|
||||
vals = append(vals, c.Version)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user