File tree Expand file tree Collapse file tree 3 files changed +4
-23
lines changed
pkg/ferryctl/cmd/ferryctl Expand file tree Collapse file tree 3 files changed +4
-23
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ limitations under the License.
1717package init
1818
1919import (
20- "fmt"
2120 "strings"
2221
2322 "github.com/ferryproxy/ferry/pkg/ferryctl/control_plane"
@@ -46,9 +45,6 @@ func NewCommand(logger log.Logger) *cobra.Command {
4645 Short : "Control plane init commands" ,
4746 Long : `Control plane init commands is used to initialize the control plane` ,
4847 RunE : func (cmd * cobra.Command , args []string ) error {
49- if len (args ) > 0 {
50- return fmt .Errorf ("too many arguments" )
51- }
5248
5349 kctl := kubectl .NewKubectl ()
5450
Original file line number Diff line number Diff line change @@ -17,27 +17,20 @@ limitations under the License.
1717package dial
1818
1919import (
20- "fmt"
21-
2220 "github.com/ferryproxy/ferry/pkg/ferryctl/local"
2321 "github.com/ferryproxy/ferry/pkg/ferryctl/log"
2422 "github.com/spf13/cobra"
2523)
2624
2725func NewCommand (logger log.Logger ) * cobra.Command {
2826 cmd := & cobra.Command {
29- Use : "dial <local address port> <remote service port>" ,
27+ Use : "dial <local address port> <remote service port>" ,
28+ Args : cobra .ExactArgs (2 ),
3029 Aliases : []string {
3130 "d" ,
3231 },
3332 Short : "local forward dial commands" ,
3433 RunE : func (cmd * cobra.Command , args []string ) error {
35- if len (args ) < 2 {
36- return fmt .Errorf ("too few arguments" )
37- }
38- if len (args ) > 2 {
39- return fmt .Errorf ("too many arguments" )
40- }
4134
4235 return local .ForwardDial (cmd .Context (), args [0 ], args [1 ])
4336 },
Original file line number Diff line number Diff line change @@ -17,28 +17,20 @@ limitations under the License.
1717package listen
1818
1919import (
20- "fmt"
21-
2220 "github.com/ferryproxy/ferry/pkg/ferryctl/local"
2321 "github.com/ferryproxy/ferry/pkg/ferryctl/log"
2422 "github.com/spf13/cobra"
2523)
2624
2725func NewCommand (logger log.Logger ) * cobra.Command {
2826 cmd := & cobra.Command {
29- Use : "listen <remote service port> <local address port>" ,
27+ Use : "listen <remote service port> <local address port>" ,
28+ Args : cobra .ExactArgs (2 ),
3029 Aliases : []string {
3130 "l" ,
3231 },
3332 Short : "local forward listen commands" ,
3433 RunE : func (cmd * cobra.Command , args []string ) error {
35- if len (args ) < 2 {
36- return fmt .Errorf ("too few arguments" )
37- }
38- if len (args ) > 2 {
39- return fmt .Errorf ("too many arguments" )
40- }
41-
4234 return local .ForwardListen (cmd .Context (), args [0 ], args [1 ])
4335 },
4436 }
You can’t perform that action at this time.
0 commit comments