Skip to content

Commit

Permalink
make blobberID field mandatory for sp-info command (#307)
Browse files Browse the repository at this point in the history
* make blobberID field mandatory for sp-info command

* Update cmd/stakepool.go

Co-authored-by: Lz <[email protected]>

* Update cmd/stakepool.go

Co-authored-by: Lz <[email protected]>

* fix uts

Co-authored-by: Lz <[email protected]>
  • Loading branch information
boddumanohar and cnlangzi authored Oct 14, 2022
1 parent f8f6e08 commit 762f302
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions cmd/stakepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,13 @@ var spInfo = &cobra.Command{

doJSON, _ := cmd.Flags().GetBool("json")

if flags.Changed("blobber_id") {
if blobberID, err = flags.GetString("blobber_id"); err != nil {
log.Fatalf("can't get 'blobber_id' flag: %v", err)
}
if !flags.Changed("blobber_id") {
log.Fatalf("Error: blobber_id flag is missing")
}

blobberID, err = flags.GetString("blobber_id")
if err != nil {
log.Fatalf("Error: cannot get the value of blobber_id")
}

var info *sdk.StakePoolInfo
Expand Down Expand Up @@ -267,7 +270,7 @@ func init() {
rootCmd.AddCommand(spUnlock)

spInfo.PersistentFlags().String("blobber_id", "",
"for given blobber, default is current client")
"for given blobber")
spInfo.PersistentFlags().Bool("json", false, "pass this option to print response as json data")

spUserInfo.PersistentFlags().Bool("json", false, "pass this option to print response as json data")
Expand Down

0 comments on commit 762f302

Please sign in to comment.