mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(hostman): cmdline option range panic
This commit is contained in:
@@ -66,12 +66,14 @@ func (o Option) ToString() string {
|
||||
type OptionFilter func(Option) bool
|
||||
|
||||
func (cl *Cmdline) FilterOption(filter OptionFilter) {
|
||||
for i, op := range cl.options {
|
||||
opts := make([]Option, 0)
|
||||
for _, op := range cl.options {
|
||||
if filter(op) {
|
||||
// remove this option
|
||||
cl.options = append(cl.options[:i], cl.options[i+1:]...)
|
||||
continue
|
||||
}
|
||||
opts = append(opts, op)
|
||||
}
|
||||
cl.options = opts
|
||||
}
|
||||
|
||||
func (cl *Cmdline) AddOption(opts ...Option) *Cmdline {
|
||||
|
||||
Reference in New Issue
Block a user