@@ -17,7 +17,6 @@ package restore
17
17
import (
18
18
"context"
19
19
"fmt"
20
- "strconv"
21
20
22
21
"emperror.dev/errors"
23
22
log "github.com/sirupsen/logrus"
@@ -30,6 +29,8 @@ import (
30
29
31
30
type resultOptions struct {
32
31
clustercontext.Context
32
+
33
+ restoreID int32
33
34
}
34
35
35
36
func newResultCommand (banzaiCli cli.Cli ) * cobra.Command {
@@ -49,28 +50,22 @@ func newResultCommand(banzaiCli cli.Cli) *cobra.Command {
49
50
return errors .WrapIf (err , "failed to initialize options" )
50
51
}
51
52
52
- return showResult (banzaiCli , options , args )
53
+ return showResult (banzaiCli , options )
53
54
},
54
55
}
56
+ flags := cmd .Flags ()
57
+ flags .Int32VarP (& options .restoreID , "restore-id" , "" , 0 , "Restore ID" )
55
58
options .Context = clustercontext .NewClusterContext (cmd , banzaiCli , "result" )
56
59
57
60
return cmd
58
61
}
59
62
60
- func showResult (banzaiCli cli.Cli , options resultOptions , args [] string ) error {
63
+ func showResult (banzaiCli cli.Cli , options resultOptions ) error {
61
64
client := banzaiCli .Client ()
62
65
orgID := banzaiCli .Context ().OrganizationID ()
63
66
clusterID := options .ClusterID ()
64
67
65
- var restoreID int32
66
- if len (args ) > 0 {
67
- if id , err := strconv .ParseUint (args [0 ], 10 , 64 ); err != nil {
68
- return errors .WrapIf (err , "failed to parse restoreID" )
69
- } else {
70
- restoreID = int32 (id )
71
- }
72
- }
73
-
68
+ restoreID := options .restoreID
74
69
if restoreID == 0 {
75
70
if banzaiCli .Interactive () {
76
71
restore , err := askRestore (client , orgID , clusterID )
0 commit comments