Skip to content

Commit

Permalink
Standardize path variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoff Stuart committed Jan 27, 2023
1 parent d6da796 commit a9c1caa
Show file tree
Hide file tree
Showing 21 changed files with 100 additions and 74 deletions.
10 changes: 6 additions & 4 deletions cmd/lotus-shed/balances.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,9 @@ var chainBalanceStateCmd = &cli.Command{
Description: "Produces a csv file of all account balances from a given stateroot",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.BoolFlag{
Name: "miner-info",
Expand Down Expand Up @@ -677,8 +678,9 @@ var chainPledgeCmd = &cli.Command{
Description: "Calculate sector pledge numbers",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
ArgsUsage: "[stateroot epoch]",
Expand Down
12 changes: 11 additions & 1 deletion cmd/lotus-shed/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down Expand Up @@ -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)",
Expand All @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions cmd/lotus-shed/deal-label.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ var dealLabelCmd = &cli.Command{
Usage: "Scrape state to report on how many deals have non UTF-8 labels",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {
Expand Down
5 changes: 3 additions & 2 deletions cmd/lotus-shed/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ var diffMinerStates = &cli.Command{
ArgsUsage: "<stateCidA> <stateCidB>",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {
Expand Down
5 changes: 3 additions & 2 deletions cmd/lotus-shed/export-car.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ var exportCarCmd = &cli.Command{
Description: "Export a car from repo",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
ArgsUsage: "[outfile] [root cid]",
Expand Down
10 changes: 6 additions & 4 deletions cmd/lotus-shed/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ var exportChainCmd = &cli.Command{
Description: "Export chain from repo (requires node to be offline)",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.StringFlag{
Name: "tipset",
Expand Down Expand Up @@ -146,8 +147,9 @@ var exportRawCmd = &cli.Command{
Description: "Export raw blocks from repo (requires node to be offline)",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.StringFlag{
Name: "car-size",
Expand Down
11 changes: 3 additions & 8 deletions cmd/lotus-shed/fip-0036.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand All @@ -75,8 +69,9 @@ var finalResultCmd = &cli.Command{
ArgsUsage: "[state root] [height] [votes json]",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},

Expand Down
10 changes: 6 additions & 4 deletions cmd/lotus-shed/gas-estimation.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ var gasTraceCmd = &cli.Command{
ArgsUsage: "[migratedStateRootCid networkVersion messageCid]",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {
Expand Down Expand Up @@ -146,8 +147,9 @@ var replayOfflineCmd = &cli.Command{
ArgsUsage: "[messageCid]",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.Int64Flag{
Name: "lookback-limit",
Expand Down
14 changes: 14 additions & 0 deletions cmd/lotus-shed/import-car.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions cmd/lotus-shed/invariants.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ var invariantsCmd = &cli.Command{
ArgsUsage: "[StateRootCid, height]",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {
Expand Down
11 changes: 8 additions & 3 deletions cmd/lotus-shed/keyinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
14 changes: 0 additions & 14 deletions cmd/lotus-shed/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"fmt"
"os"

logging "github.com/ipfs/go-log/v2"
Expand Down Expand Up @@ -88,19 +87,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",
Expand Down
10 changes: 6 additions & 4 deletions cmd/lotus-shed/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ var marketExportDatastoreCmd = &cli.Command{
Description: "export markets datastore key/values to a file",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Usage: "path to the repo",
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.StringFlag{
Name: "backup-dir",
Expand Down Expand Up @@ -241,8 +242,9 @@ var marketImportDatastoreCmd = &cli.Command{
Description: "import markets datastore key/values from a backup file",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Usage: "path to the repo",
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.StringFlag{
Name: "backup-path",
Expand Down
5 changes: 3 additions & 2 deletions cmd/lotus-shed/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ var migrationsCmd = &cli.Command{
ArgsUsage: "[new network version, block to look back from]",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.BoolFlag{
Name: "skip-pre-migration",
Expand Down
8 changes: 5 additions & 3 deletions cmd/lotus-shed/miner-peerid.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {
Expand Down
8 changes: 5 additions & 3 deletions cmd/lotus-shed/miner-types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {
Expand Down
5 changes: 3 additions & 2 deletions cmd/lotus-shed/msig.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ var multisigGetAllCmd = &cli.Command{
ArgsUsage: "[state root]",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {
Expand Down
6 changes: 0 additions & 6 deletions cmd/lotus-shed/nonce-fix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand Down
5 changes: 3 additions & 2 deletions cmd/lotus-shed/pruning.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ var stateTreePruneCmd = &cli.Command{
Description: "Deletes old state root data from local chainstore",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.Int64Flag{
Name: "keep-from-lookback",
Expand Down
10 changes: 6 additions & 4 deletions cmd/lotus-shed/splitstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ var splitstoreRollbackCmd = &cli.Command{
Description: "rollbacks a splitstore installation",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.BoolFlag{
Name: "gc-coldstore",
Expand Down Expand Up @@ -129,8 +130,9 @@ var splitstoreClearCmd = &cli.Command{
Description: "clears a splitstore installation for restart from snapshot",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.BoolFlag{
Name: "keys-only",
Expand Down
Loading

0 comments on commit a9c1caa

Please sign in to comment.