Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make blobberID field mandatory for sp-info command #307

Merged
merged 4 commits into from
Oct 14, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions cmd/stakepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"fmt"
"log"
"os"

"github.com/0chain/gosdk/zboxcore/sdk"
"github.com/0chain/gosdk/zcncore"
Expand Down Expand Up @@ -85,12 +86,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") {
PrintError("Error: blobber_id flag is missing")
boddumanohar marked this conversation as resolved.
Show resolved Hide resolved
os.Exit(1)
}

blobberID = cmd.Flag("blobber_id").Value.String()
boddumanohar marked this conversation as resolved.
Show resolved Hide resolved

var info *sdk.StakePoolInfo
if info, err = sdk.GetStakePoolInfo(blobberID); err != nil {
log.Fatalf("Failed to get stake pool info: %v", err)
Expand Down Expand Up @@ -267,7 +269,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