lotus/cmd/lotus-shed/main.go
2021-03-09 23:36:03 +00:00

91 lines
1.7 KiB
Go

package main
import (
"fmt"
"os"
logging "github.com/ipfs/go-log/v2"
"github.com/urfave/cli/v2"
"github.com/filecoin-project/lotus/build"
)
var log = logging.Logger("lotus-shed")
func main() {
logging.SetLogLevel("*", "INFO")
local := []*cli.Command{
base32Cmd,
base16Cmd,
bitFieldCmd,
frozenMinersCmd,
keyinfoCmd,
jwtCmd,
noncefix,
bigIntParseCmd,
staterootCmd,
auditsCmd,
importCarCmd,
importObjectCmd,
commpToCidCmd,
fetchParamCmd,
postFindCmd,
proofsCmd,
verifRegCmd,
miscCmd,
mpoolCmd,
genesisVerifyCmd,
mathCmd,
mpoolStatsCmd,
exportChainCmd,
consensusCmd,
storageStatsCmd,
syncCmd,
stateTreePruneCmd,
datastoreCmd,
ledgerCmd,
sectorsCmd,
msgCmd,
electionCmd,
rpcCmd,
cidCmd,
blockmsgidCmd,
}
app := &cli.App{
Name: "lotus-shed",
Usage: "A place for all the lotus tools",
Version: build.BuildVersion,
Commands: local,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
EnvVars: []string{"LOTUS_PATH"},
Hidden: true,
Value: "~/.lotus", // TODO: Consider XDG_DATA_HOME
},
&cli.StringFlag{
Name: "miner-repo",
Aliases: []string{"storagerepo"},
EnvVars: []string{"LOTUS_MINER_PATH", "LOTUS_STORAGE_PATH"},
Value: "~/.lotusminer", // TODO: Consider XDG_DATA_HOME
Usage: fmt.Sprintf("Specify miner repo path. flag storagerepo and env LOTUS_STORAGE_PATH are DEPRECATION, will REMOVE SOON"),
},
&cli.StringFlag{
Name: "log-level",
Value: "info",
},
},
Before: func(cctx *cli.Context) error {
return logging.SetLogLevel("lotus-shed", cctx.String("log-level"))
},
}
if err := app.Run(os.Args); err != nil {
log.Warnf("%+v", err)
os.Exit(1)
return
}
}