Merge pull request #10134 from filecoin-project/gstuart/shed-path-fix

fix: shed: Standardize use of path flag
This commit is contained in:
Łukasz Magiera 2023-02-09 18:04:04 +01:00 committed by GitHub
commit 83a7d6e297
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 100 additions and 74 deletions

View File

@ -456,6 +456,7 @@ var chainBalanceStateCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.BoolFlag{
Name: "miner-info",
@ -679,6 +680,7 @@ var chainPledgeCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
ArgsUsage: "[stateroot epoch]",

View File

@ -41,6 +41,11 @@ var datastoreListCmd = &cli.Command{
Name: "list",
Description: "list datastore keys",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.StringFlag{
Name: "repo-type",
Usage: "node type (FullNode, StorageMiner, Worker, Wallet)",
@ -110,6 +115,11 @@ var datastoreGetCmd = &cli.Command{
Name: "get",
Description: "list datastore keys",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.StringFlag{
Name: "repo-type",
Usage: "node type (FullNode, StorageMiner, Worker, Wallet)",
@ -123,7 +133,7 @@ var datastoreGetCmd = &cli.Command{
},
ArgsUsage: "[namespace key]",
Action: func(cctx *cli.Context) error {
logging.SetLogLevel("badger", "ERROR") // nolint:errcheck
_ = logging.SetLogLevel("badger", "ERROR")
r, err := repo.NewFS(cctx.String("repo"))
if err != nil {

View File

@ -26,6 +26,7 @@ var dealLabelCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {

View File

@ -35,6 +35,7 @@ var diffMinerStates = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {

View File

@ -37,6 +37,7 @@ var exportCarCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
ArgsUsage: "[outfile] [root cid]",

View File

@ -44,6 +44,7 @@ var exportChainCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.StringFlag{
Name: "tipset",
@ -148,6 +149,7 @@ var exportRawCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.StringFlag{
Name: "car-size",

View File

@ -58,12 +58,6 @@ var fip36PollCmd = &cli.Command{
Name: "fip36poll",
Usage: "Process the FIP0036 FilPoll result",
ArgsUsage: "[state root, votes]",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
},
},
Subcommands: []*cli.Command{
finalResultCmd,
},
@ -77,6 +71,7 @@ var finalResultCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},

View File

@ -44,6 +44,7 @@ var gasTraceCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {
@ -148,6 +149,7 @@ var replayOfflineCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.Int64Flag{
Name: "lookback-limit",

View File

@ -19,6 +19,13 @@ import (
var importCarCmd = &cli.Command{
Name: "import-car",
Description: "Import a car file into node chain blockstore",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {
r, err := repo.NewFS(cctx.String("repo"))
if err != nil {
@ -96,6 +103,13 @@ var importCarCmd = &cli.Command{
var importObjectCmd = &cli.Command{
Name: "import-obj",
Usage: "import a raw ipld object into your datastore",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {
r, err := repo.NewFS(cctx.String("repo"))
if err != nil {

View File

@ -37,6 +37,7 @@ var invariantsCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {

View File

@ -146,9 +146,14 @@ var keyinfoImportCmd = &cli.Command{
Examples
env LOTUS_PATH=/var/lib/lotus lotus-shed keyinfo import libp2p-host.keyinfo`,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {
flagRepo := cctx.String("repo")
var input io.Reader
if cctx.NArg() == 0 {
input = os.Stdin
@ -177,7 +182,7 @@ var keyinfoImportCmd = &cli.Command{
return err
}
fsrepo, err := repo.NewFS(flagRepo)
fsrepo, err := repo.NewFS(cctx.String("repo"))
if err != nil {
return err
}

View File

@ -1,7 +1,6 @@
package main
import (
"fmt"
"os"
logging "github.com/ipfs/go-log/v2"
@ -89,19 +88,6 @@ func main() {
Version: build.UserVersion(),
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",

View File

@ -125,7 +125,8 @@ var marketExportDatastoreCmd = &cli.Command{
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Usage: "path to the repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.StringFlag{
Name: "backup-dir",
@ -242,7 +243,8 @@ var marketImportDatastoreCmd = &cli.Command{
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Usage: "path to the repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.StringFlag{
Name: "backup-path",

View File

@ -56,6 +56,7 @@ var migrationsCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.BoolFlag{
Name: "skip-pre-migration",

View File

@ -26,10 +26,12 @@ import (
var minerPeeridCmd = &cli.Command{
Name: "miner-peerid",
Usage: "Scrape state to find a miner based on peerid", Flags: []cli.Flag{
Usage: "Scrape state to find a miner based on peerid",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {

View File

@ -28,10 +28,12 @@ import (
var minerTypesCmd = &cli.Command{
Name: "miner-types",
Usage: "Scrape state to report on how many miners of each WindowPoStProofType exist", Flags: []cli.Flag{
Usage: "Scrape state to report on how many miners of each WindowPoStProofType exist",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {

View File

@ -45,6 +45,7 @@ var multisigGetAllCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {

View File

@ -17,12 +17,6 @@ import (
var noncefix = &cli.Command{
Name: "noncefix",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
EnvVars: []string{"LOTUS_PATH"},
Hidden: true,
Value: "~/.lotus", // TODO: Consider XDG_DATA_HOME
},
&cli.Uint64Flag{
Name: "start",
},

View File

@ -88,6 +88,7 @@ var stateTreePruneCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.Int64Flag{
Name: "keep-from-lookback",

View File

@ -41,6 +41,7 @@ var splitstoreRollbackCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.BoolFlag{
Name: "gc-coldstore",
@ -131,6 +132,7 @@ var splitstoreClearCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.BoolFlag{
Name: "keys-only",

View File

@ -35,6 +35,7 @@ var terminationsCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {