Merge pull request #315 from filecoin-project/feat/more-docs

Clear up confusion around arguments
This commit is contained in:
Łukasz Magiera 2019-10-10 04:16:30 +02:00 committed by GitHub
commit 7194a64ce7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 30 additions and 13 deletions

View File

@ -2,6 +2,7 @@ package api
import (
"context"
"fmt"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-filestore"
@ -9,6 +10,7 @@ import (
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/filecoin-project/go-lotus/build"
"github.com/filecoin-project/go-lotus/chain/address"
"github.com/filecoin-project/go-lotus/chain/store"
"github.com/filecoin-project/go-lotus/chain/types"
@ -173,6 +175,11 @@ type Version struct {
// TODO: git commit / os / genesis cid?
}
func (v Version) String() string {
vM, vm, vp := build.VersionInts(v.APIVersion)
return fmt.Sprintf("%s+api%d.%d.%d", v.Version, vM, vm, vp)
}
type Import struct {
Status filestore.Status
Key cid.Cid

View File

@ -19,3 +19,8 @@ const (
MinorMask = 0xffff00
PatchMask = 0xffffff
)
// VersionInts returns (major, minor, patch) versions
func VersionInts(version uint32) (uint32, uint32, uint32) {
return (version & MajorMask) >> 16, (version & MinorMask) >> 8, version & PatchMask
}

View File

@ -66,8 +66,9 @@ var netListen = &cli.Command{
}
var netConnect = &cli.Command{
Name: "connect",
Usage: "Connect to a peer",
Name: "connect",
Usage: "Connect to a peer",
ArgsUsage: "<peer multiaddr>",
Action: func(cctx *cli.Context) error {
api, closer, err := GetAPI(cctx)
if err != nil {

View File

@ -9,8 +9,9 @@ import (
)
var sendCmd = &cli.Command{
Name: "send",
Usage: "send funds between accounts",
Name: "send",
Usage: "Send funds between accounts",
ArgsUsage: "<target> <amount>",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "source",

View File

@ -26,8 +26,9 @@ var walletCmd = &cli.Command{
}
var walletNew = &cli.Command{
Name: "new",
Usage: "Generate a new key of the given type (bls or secp256k1)",
Name: "new",
Usage: "Generate a new key of the given type",
ArgsUsage: "[bls|secp256k1]",
Action: func(cctx *cli.Context) error {
api, closer, err := GetFullNodeAPI(cctx)
if err != nil {
@ -76,8 +77,9 @@ var walletList = &cli.Command{
}
var walletBalance = &cli.Command{
Name: "balance",
Usage: "get account balance",
Name: "balance",
Usage: "Get account balance",
ArgsUsage: "[account address]",
Action: func(cctx *cli.Context) error {
api, closer, err := GetFullNodeAPI(cctx)
if err != nil {

View File

@ -85,7 +85,8 @@ func (a *CommonAPI) ID(context.Context) (peer.ID, error) {
func (a *CommonAPI) Version(context.Context) (api.Version, error) {
return api.Version{
Version: build.Version,
Version: build.Version,
APIVersion: build.APIVersion,
}, nil
}

View File

@ -43,8 +43,8 @@ func PNetChecker(repo repo.Repo, ph host.Host, lc fx.Lifecycle) error {
select {
case <-t.C:
if len(ph.Network().Peers()) == 0 {
log.Warning("We are in private network and have no peers.")
log.Warning("This might be configuration mistake.")
log.Warn("We are in private network and have no peers.")
log.Warn("This might be configuration mistake.")
}
case <-done:
return

View File

@ -102,7 +102,7 @@ func (m *Miner) handlePostingSealedSectors(ctx context.Context) {
if !ok {
// TODO: set some state variable so that this state can be
// visible via some status command
log.Warning("sealed sector channel closed, aborting process")
log.Warn("sealed sector channel closed, aborting process")
return
}
@ -112,7 +112,7 @@ func (m *Miner) handlePostingSealedSectors(ctx context.Context) {
}
case <-ctx.Done():
log.Warning("exiting seal posting routine")
log.Warn("exiting seal posting routine")
return
}
}