@@ -657,17 +657,13 @@ func AddRepo(cxt context.Context, rpc *coconut.RpcClient, cmd *cobra.Command, ar
657657 return err
658658 }
659659
660- var response * pb.AddRepoReply
661- response , err = rpc .AddRepo (cxt , & pb.AddRepoRequest {Name : args [0 ]}, grpc.EmptyCallOption {})
660+ _ , err = rpc .AddRepo (cxt , & pb.AddRepoRequest {Name : args [0 ]}, grpc.EmptyCallOption {})
662661 if err != nil {
662+ fmt .Fprintln (o , "Cannot add repository." )
663663 return err
664664 }
665665
666- if response .GetErrorString () == "" {
667- fmt .Fprintln (o , "Repository succesfully added." )
668- } else {
669- fmt .Fprintln (o , "Cannot add repository:" , response .GetErrorString ())
670- }
666+ fmt .Fprintln (o , "Repository succesfully added." )
671667
672668 return nil
673669}
@@ -691,13 +687,9 @@ func RemoveRepo(cxt context.Context, rpc *coconut.RpcClient, cmd *cobra.Command,
691687 }
692688
693689 newDefaultRepo := response .GetNewDefaultRepo ()
694- if response .GetOk () {
695- fmt .Fprintln (o , "Repository removed succsefully" )
696- if newDefaultRepo != "" {
697- fmt .Fprintln (o , "New default repo is: " + newDefaultRepo )
698- }
699- } else {
700- fmt .Fprintln (o , "Repository not found" )
690+ fmt .Fprintln (o , "Repository removed succsefully." )
691+ if newDefaultRepo != "" {
692+ fmt .Fprintln (o , "New default repo is: " + newDefaultRepo )
701693 }
702694
703695 return nil
@@ -710,28 +702,23 @@ func RefreshRepos(cxt context.Context, rpc *coconut.RpcClient, cmd *cobra.Comman
710702 return err
711703 }
712704
713- var response * pb.RefreshReposReply
714705 if len (args ) == 0 {
715- response , err = rpc .RefreshRepos (cxt , & pb.RefreshReposRequest {Index : - 1 }, grpc.EmptyCallOption {})
706+ _ , err = rpc .RefreshRepos (cxt , & pb.RefreshReposRequest {Index : - 1 }, grpc.EmptyCallOption {})
716707 } else if len (args ) == 1 {
717708 index , _ := strconv .ParseInt (args [0 ], 10 , 32 )
718709
719- response , err = rpc .RefreshRepos (cxt , & pb.RefreshReposRequest {Index : int32 (index )}, grpc.EmptyCallOption {})
710+ _ , err = rpc .RefreshRepos (cxt , & pb.RefreshReposRequest {Index : int32 (index )}, grpc.EmptyCallOption {})
720711 }
721712
722713 if err != nil {
714+ fmt .Fprintln (o , "Repository refresh operation failed." )
723715 return err
724716 }
725717
726- errorString := response .GetErrorString ()
727- if errorString == "" {
728- if len (args ) == 0 {
729- fmt .Fprintln (o , "Repositories refreshed succesfully" )
730- } else {
731- fmt .Fprintln (o , "Repository refreshed succesfully" )
732- }
718+ if len (args ) == 0 {
719+ fmt .Fprintln (o , "Repositories refreshed succesfully" )
733720 } else {
734- fmt .Fprintln (o , "Repository refresh operation failed:" , errorString )
721+ fmt .Fprintln (o , "Repository refreshed succesfully" )
735722 }
736723
737724 return nil
@@ -748,18 +735,13 @@ func SetDefaultRepo(cxt context.Context, rpc *coconut.RpcClient, cmd *cobra.Comm
748735
749736 index , _ := strconv .ParseInt (args [0 ], 10 , 32 )
750737
751- var response * pb.SetDefaultRepoReply
752- response , err = rpc .SetDefaultRepo (cxt , & pb.SetDefaultRepoRequest {Index : int32 (index )}, grpc.EmptyCallOption {})
738+ _ , err = rpc .SetDefaultRepo (cxt , & pb.SetDefaultRepoRequest {Index : int32 (index )}, grpc.EmptyCallOption {})
753739 if err != nil {
740+ fmt .Fprintln (o , "Operation failed." )
754741 return err
755742 }
756743
757- errorString := response .GetErrorString ()
758- if errorString == "" {
759- fmt .Fprintln (o , "Default repository updated succesfully" )
760- } else {
761- fmt .Fprintln (o , "Operation failed:" , errorString )
762- }
744+ fmt .Fprintln (o , "Default repository update succesfully" )
763745
764746 return nil
765747}
0 commit comments