Skip to content

Commit 4babc8b

Browse files
committed
refactor(server): remove unnecessary arg checks
Arg validation is done before execution reaches command implementation.
1 parent 11bcfb2 commit 4babc8b

File tree

2 files changed

+0
-8
lines changed

2 files changed

+0
-8
lines changed

internal/commands/ipaddress/modify.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package ipaddress
22

33
import (
4-
"errors"
54
"fmt"
65

76
"github.com/UpCloudLtd/upcloud-cli/internal/commands"
@@ -47,9 +46,6 @@ func (s *modifyCommand) MaximumExecutions() int {
4746

4847
// Execute implements commands.MultipleArgumentCommand
4948
func (s *modifyCommand) Execute(exec commands.Executor, arg string) (output.Output, error) {
50-
if arg == "" {
51-
return nil, errors.New("need ip address to modify")
52-
}
5349
msg := fmt.Sprintf("Modifying ip-address %v", arg)
5450
logline := exec.NewLogEntry(msg)
5551

internal/commands/serverfirewall/show.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ type fwProto struct {
5555

5656
// Execute implements commands.MultipleArgumentCommand
5757
func (s *showCommand) Execute(exec commands.Executor, arg string) (output.Output, error) {
58-
// TODO(aakso): implement prompting with readline support
59-
if arg == "" {
60-
return nil, fmt.Errorf("one server hostname, title or uuid is required")
61-
}
6258
// get rules and server details in parallel
6359
var wg sync.WaitGroup
6460
var rules *upcloud.FirewallRules

0 commit comments

Comments
 (0)