github.com/scaleway/scaleway-cli@v1.11.1/pkg/cli/flags.go (about) 1 // Copyright (C) 2015 Scaleway. All rights reserved. 2 // Use of this source code is governed by a MIT-style 3 // license that can be found in the LICENSE.md file. 4 5 package cli 6 7 import "fmt" 8 9 // CommandListOpts holds a list of parameters 10 type CommandListOpts struct { 11 Values *[]string 12 } 13 14 // NewListOpts create an empty CommandListOpts 15 func NewListOpts() CommandListOpts { 16 var values []string 17 return CommandListOpts{ 18 Values: &values, 19 } 20 } 21 22 // String returns a string representation of a CommandListOpts object 23 func (opts *CommandListOpts) String() string { 24 return fmt.Sprintf("%v", (*opts.Values)) 25 } 26 27 // Set appends a new value to a CommandListOpts 28 func (opts *CommandListOpts) Set(value string) error { 29 (*opts.Values) = append((*opts.Values), value) 30 return nil 31 }