Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix version flag for booster-http and booster-bitswap #1590

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions cmd/booster-bitswap/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"os"
"path/filepath"

"github.com/filecoin-project/boost/build"
"github.com/libp2p/go-libp2p"
crypto "github.com/libp2p/go-libp2p/core/crypto"
"github.com/libp2p/go-libp2p/core/host"
Expand Down Expand Up @@ -115,13 +114,3 @@ var initCmd = &cli.Command{
return err
},
}

var versionCmd = &cli.Command{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this, --version flag is supported out of the box with urfave/cli

Name: "version",
Usage: "Print booster-bitswap version",
Before: before,
Action: func(cctx *cli.Context) error {
fmt.Println("booster-bitswap " + build.UserVersion())
return nil
},
}
8 changes: 3 additions & 5 deletions cmd/booster-bitswap/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"os"

"github.com/filecoin-project/boost/build"
"github.com/filecoin-project/boostd-data/shared/cliutil"
logging "github.com/ipfs/go-log/v2"
"github.com/urfave/cli/v2"
Expand All @@ -22,16 +23,15 @@ func main() {
Name: "booster-bitswap",
Usage: "Bitswap endpoint for retrieval from Filecoin",
EnableBashCompletion: true,
Version: build.UserVersion(),
Flags: []cli.Flag{
cliutil.FlagVerbose,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't use -v for verbose, it is used for --version typically.

cliutil.FlagVeryVerbose,
FlagRepo,
},
Commands: []*cli.Command{
initCmd,
runCmd,
fetchCmd,
versionCmd,
},
}
app.Setup()
Expand All @@ -43,10 +43,8 @@ func main() {

func before(cctx *cli.Context) error {
_ = logging.SetLogLevel("booster", "INFO")
_ = logging.SetLogLevel("remote-blockstore", "INFO")

if cliutil.IsVerbose {
_ = logging.SetLogLevel("remote-blockstore", "INFO")
}
if cliutil.IsVeryVerbose {
_ = logging.SetLogLevel("booster", "DEBUG")
_ = logging.SetLogLevel("remote-blockstore", "DEBUG")
Expand Down
7 changes: 3 additions & 4 deletions cmd/booster-http/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"os"

"github.com/filecoin-project/boost/build"
"github.com/filecoin-project/boostd-data/shared/cliutil"
logging "github.com/ipfs/go-log/v2"
"github.com/urfave/cli/v2"
Expand All @@ -22,8 +23,8 @@ func main() {
Name: "booster-http",
Usage: "HTTP endpoint for retrieval from Filecoin",
EnableBashCompletion: true,
Version: build.UserVersion(),
Flags: []cli.Flag{
cliutil.FlagVerbose,
cliutil.FlagVeryVerbose,
FlagRepo,
},
Expand All @@ -40,10 +41,8 @@ func main() {

func before(cctx *cli.Context) error {
_ = logging.SetLogLevel("booster", "INFO")
_ = logging.SetLogLevel("remote-blockstore", "INFO")

if cliutil.IsVerbose {
_ = logging.SetLogLevel("remote-blockstore", "INFO")
}
if cliutil.IsVeryVerbose {
_ = logging.SetLogLevel("booster", "DEBUG")
_ = logging.SetLogLevel("remote-blockstore", "DEBUG")
Expand Down