Merge pull request #10028 from filecoin-project/gstuart/cli-color-cleanup

chore: cli: Remove unneeded individual color flags
This commit is contained in:
Łukasz Magiera 2023-01-31 09:23:16 +01:00 committed by GitHub
commit 13fc5b688f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 11 additions and 216 deletions

View File

@ -1118,11 +1118,6 @@ var clientListRetrievalsCmd = &cli.Command{
Aliases: []string{"v"},
Usage: "print verbose deal details",
},
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
&cli.BoolFlag{
Name: "show-failed",
Usage: "show failed/failing deals",
@ -1138,10 +1133,6 @@ var clientListRetrievalsCmd = &cli.Command{
},
},
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
api, closer, err := GetFullNodeAPI(cctx)
if err != nil {
return err
@ -1709,11 +1700,6 @@ var clientListDeals = &cli.Command{
Aliases: []string{"v"},
Usage: "print verbose deal details",
},
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
&cli.BoolFlag{
Name: "show-failed",
Usage: "show failed/failing deals",
@ -1724,10 +1710,6 @@ var clientListDeals = &cli.Command{
},
},
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
api, closer, err := GetFullNodeAPI(cctx)
if err != nil {
return err
@ -2241,11 +2223,6 @@ var clientListTransfers = &cli.Command{
Aliases: []string{"v"},
Usage: "print verbose transfer details",
},
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
&cli.BoolFlag{
Name: "completed",
Usage: "show completed data transfers",
@ -2260,10 +2237,6 @@ var clientListTransfers = &cli.Command{
},
},
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
api, closer, err := GetFullNodeAPI(cctx)
if err != nil {
return err

View File

@ -433,17 +433,8 @@ var actorControlList = &cli.Command{
&cli.BoolFlag{
Name: "verbose",
},
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
},
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
minerApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err

View File

@ -31,18 +31,7 @@ var dagstoreCmd = &cli.Command{
var dagstoreListShardsCmd = &cli.Command{
Name: "list-shards",
Usage: "List all shards known to the dagstore, with their current status",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
},
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
marketsApi, closer, err := lcli.GetMarketsAPI(cctx)
if err != nil {
return err
@ -64,18 +53,7 @@ var dagstoreRegisterShardCmd = &cli.Command{
Name: "register-shard",
ArgsUsage: "[key]",
Usage: "Register a shard",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
},
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
if cctx.NArg() != 1 {
return lcli.IncorrectNumArgs(cctx)
}
@ -103,18 +81,7 @@ var dagstoreInitializeShardCmd = &cli.Command{
Name: "initialize-shard",
ArgsUsage: "[key]",
Usage: "Initialize the specified shard",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
},
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
if cctx.NArg() != 1 {
return lcli.IncorrectNumArgs(cctx)
}
@ -135,18 +102,7 @@ var dagstoreRecoverShardCmd = &cli.Command{
Name: "recover-shard",
ArgsUsage: "[key]",
Usage: "Attempt to recover a shard in errored state",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
},
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
if cctx.NArg() != 1 {
return lcli.IncorrectNumArgs(cctx)
}
@ -176,17 +132,8 @@ var dagstoreInitializeAllCmd = &cli.Command{
Name: "include-sealed",
Usage: "initialize sealed pieces as well",
},
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
},
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
concurrency := cctx.Uint("concurrency")
sealed := cctx.Bool("sealed")
@ -236,18 +183,7 @@ var dagstoreInitializeAllCmd = &cli.Command{
var dagstoreGcCmd = &cli.Command{
Name: "gc",
Usage: "Garbage collect the dagstore",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
},
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
marketsApi, closer, err := lcli.GetMarketsAPI(cctx)
if err != nil {
return err
@ -317,18 +253,7 @@ var dagstoreLookupPiecesCmd = &cli.Command{
Name: "lookup-pieces",
Usage: "Lookup pieces that a given CID belongs to",
ArgsUsage: "<cid>",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
},
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
if cctx.NArg() != 1 {
return lcli.IncorrectNumArgs(cctx)
}

View File

@ -3,7 +3,6 @@ package main
import (
"fmt"
"github.com/fatih/color"
"github.com/ipfs/go-cid"
"github.com/urfave/cli/v2"
@ -23,18 +22,7 @@ var indexProvAnnounceCmd = &cli.Command{
Name: "announce",
ArgsUsage: "<deal proposal cid>",
Usage: "Announce a deal to indexers so they can download its index",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
},
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
if cctx.NArg() != 1 {
return lcli.IncorrectNumArgs(cctx)
}
@ -60,18 +48,7 @@ var indexProvAnnounceCmd = &cli.Command{
var indexProvAnnounceAllCmd = &cli.Command{
Name: "announce-all",
Usage: "Announce all active deals to indexers so they can download the indices",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
},
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
marketsApi, closer, err := lcli.GetMarketsAPI(cctx)
if err != nil {
return err

View File

@ -16,7 +16,6 @@ import (
tm "github.com/buger/goterm"
"github.com/docker/go-units"
"github.com/fatih/color"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-cidutil/cidenc"
"github.com/libp2p/go-libp2p/core/peer"
@ -779,11 +778,6 @@ var transfersListCmd = &cli.Command{
Aliases: []string{"v"},
Usage: "print verbose transfer details",
},
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
&cli.BoolFlag{
Name: "completed",
Usage: "show completed data transfers",
@ -798,10 +792,6 @@ var transfersListCmd = &cli.Command{
},
},
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
api, closer, err := lcli.GetMarketsAPI(cctx)
if err != nil {
return err

View File

@ -45,18 +45,7 @@ func workersCmd(sealing bool) *cli.Command {
return &cli.Command{
Name: "workers",
Usage: "list workers",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
},
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
minerApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err
@ -218,21 +207,12 @@ var sealingJobsCmd = &cli.Command{
Name: "jobs",
Usage: "list running jobs",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
&cli.BoolFlag{
Name: "show-ret-done",
Usage: "show returned but not consumed calls",
},
},
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
minerApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err

View File

@ -277,12 +277,6 @@ var sectorsListCmd = &cli.Command{
Usage: "show removed sectors",
Aliases: []string{"r"},
},
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
Aliases: []string{"c"},
},
&cli.BoolFlag{
Name: "fast",
Usage: "don't show on-chain info for better performance",
@ -314,10 +308,6 @@ var sectorsListCmd = &cli.Command{
},
},
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
minerApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err

View File

@ -254,21 +254,10 @@ var storageRedeclareCmd = &cli.Command{
var storageListCmd = &cli.Command{
Name: "list",
Usage: "list local storage paths",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
},
Subcommands: []*cli.Command{
storageListSectorsCmd,
},
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
minerApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err
@ -633,18 +622,7 @@ var storageFindCmd = &cli.Command{
var storageListSectorsCmd = &cli.Command{
Name: "sectors",
Usage: "get list of all sector files",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
},
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
minerApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err

View File

@ -333,7 +333,6 @@ USAGE:
lotus-miner actor control list [command options] [arguments...]
OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--verbose (default: false)
```
@ -980,7 +979,6 @@ USAGE:
lotus-miner data-transfers list [command options] [arguments...]
OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--completed show completed data transfers (default: false)
--show-failed show failed/cancelled transfers (default: false)
--verbose, -v print verbose transfer details (default: false)
@ -1062,7 +1060,7 @@ USAGE:
lotus-miner dagstore list-shards [command options] [arguments...]
OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--help, -h show help (default: false)
```
@ -1075,7 +1073,7 @@ USAGE:
lotus-miner dagstore register-shard [command options] [key]
OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--help, -h show help (default: false)
```
@ -1088,7 +1086,7 @@ USAGE:
lotus-miner dagstore initialize-shard [command options] [key]
OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--help, -h show help (default: false)
```
@ -1101,7 +1099,7 @@ USAGE:
lotus-miner dagstore recover-shard [command options] [key]
OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--help, -h show help (default: false)
```
@ -1114,7 +1112,6 @@ USAGE:
lotus-miner dagstore initialize-all [command options] [arguments...]
OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--concurrency value maximum shards to initialize concurrently at a time; use 0 for unlimited (default: 0)
--include-sealed initialize sealed pieces as well (default: false)
@ -1129,7 +1126,7 @@ USAGE:
lotus-miner dagstore gc [command options] [arguments...]
OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--help, -h show help (default: false)
```
@ -1142,7 +1139,7 @@ USAGE:
lotus-miner dagstore lookup-pieces [command options] <cid>
OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--help, -h show help (default: false)
```
@ -1173,7 +1170,7 @@ USAGE:
lotus-miner index announce [command options] <deal proposal cid>
OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--help, -h show help (default: false)
```
@ -1186,7 +1183,7 @@ USAGE:
lotus-miner index announce-all [command options] [arguments...]
OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--help, -h show help (default: false)
```
@ -1720,7 +1717,6 @@ USAGE:
lotus-miner sectors list [command options] [arguments...]
OPTIONS:
--color, -c use color in display output (default: depends on output being a TTY)
--events, -e display number of events the sector has received (default: false)
--fast, -f don't show on-chain info for better performance (default: false)
--initial-pledge, -p display initial pledge (default: false)
@ -2204,7 +2200,7 @@ USAGE:
lotus-miner proving workers [command options] [arguments...]
OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--help, -h show help (default: false)
```
@ -2352,7 +2348,6 @@ COMMANDS:
help, h Shows a list of commands or help for one command
OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--help, -h show help (default: false)
```
@ -2366,7 +2361,7 @@ USAGE:
lotus-miner storage list sectors [command options] [arguments...]
OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--help, -h show help (default: false)
```
@ -2439,7 +2434,6 @@ USAGE:
lotus-miner sealing jobs [command options] [arguments...]
OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--show-ret-done show returned but not consumed calls (default: false)
```
@ -2453,7 +2447,7 @@ USAGE:
lotus-miner sealing workers [command options] [arguments...]
OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--help, -h show help (default: false)
```

View File

@ -688,7 +688,6 @@ CATEGORY:
RETRIEVAL
OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--completed show completed retrievals (default: false)
--show-failed show failed/failing deals (default: true)
--verbose, -v print verbose deal details (default: false)
@ -759,7 +758,6 @@ CATEGORY:
STORAGE
OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--show-failed show failed/failing deals (default: false)
--verbose, -v print verbose deal details (default: false)
--watch watch deal updates in real-time, rather than a one time list (default: false)
@ -892,7 +890,6 @@ CATEGORY:
UTIL
OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--completed show completed data transfers (default: false)
--show-failed show failed/cancelled transfers (default: false)
--verbose, -v print verbose transfer details (default: false)