Merge pull request #496 from filecoin-project/fix/fmt-FIL
Implment formatter on FIL to override big.Int
This commit is contained in:
commit
981f108565
@ -15,6 +15,15 @@ func (f FIL) String() string {
|
||||
return strings.TrimRight(r.FloatString(18), "0.")
|
||||
}
|
||||
|
||||
func (f FIL) Format(s fmt.State, ch rune) {
|
||||
switch ch {
|
||||
case 's', 'v':
|
||||
fmt.Fprint(s, f.String())
|
||||
default:
|
||||
f.Int.Format(s, ch)
|
||||
}
|
||||
}
|
||||
|
||||
func ParseFIL(s string) (FIL, error) {
|
||||
r, ok := new(big.Rat).SetString(s)
|
||||
if !ok {
|
||||
|
@ -197,7 +197,7 @@ var statePledgeCollateralCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Println(types.FIL(coll).String())
|
||||
fmt.Println(types.FIL(coll))
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ var walletBalance = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Printf("%s\n", types.FIL(balance).String())
|
||||
fmt.Printf("%s\n", types.FIL(balance))
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user