migrate cli to internal package (#301)

This commit is contained in:
Manav Darji 2022-01-19 16:40:20 +05:30 committed by GitHub
parent 336b89eeba
commit f3d6620ecc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 51 additions and 44 deletions

11
cmd/cli/main.go Normal file
View file

@ -0,0 +1,11 @@
package main
import (
"os"
"github.com/ethereum/go-ethereum/internal/cli"
)
func main() {
os.Exit(cli.Run(os.Args[1:]))
}

View file

@ -1,4 +1,4 @@
package main package cli
import "github.com/mitchellh/cli" import "github.com/mitchellh/cli"

View file

@ -1,11 +1,11 @@
package main package cli
import ( import (
"fmt" "fmt"
"github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/command/flagset"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/internal/cli/flagset"
) )
type AccountImportCommand struct { type AccountImportCommand struct {

View file

@ -1,10 +1,10 @@
package main package cli
import ( import (
"fmt" "fmt"
"github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/command/flagset" "github.com/ethereum/go-ethereum/internal/cli/flagset"
) )
type AccountListCommand struct { type AccountListCommand struct {

View file

@ -1,9 +1,9 @@
package main package cli
import ( import (
"fmt" "fmt"
"github.com/ethereum/go-ethereum/command/flagset" "github.com/ethereum/go-ethereum/internal/cli/flagset"
) )
type AccountNewCommand struct { type AccountNewCommand struct {

View file

@ -1,4 +1,4 @@
package main package cli
import ( import (
"github.com/mitchellh/cli" "github.com/mitchellh/cli"

View file

@ -1,12 +1,12 @@
package main package cli
import ( import (
"context" "context"
"fmt" "fmt"
"strconv" "strconv"
"github.com/ethereum/go-ethereum/command/flagset" "github.com/ethereum/go-ethereum/internal/cli/flagset"
"github.com/ethereum/go-ethereum/command/server/proto" "github.com/ethereum/go-ethereum/internal/cli/server/proto"
) )
// ChainSetHeadCommand is the command to group the peers commands // ChainSetHeadCommand is the command to group the peers commands

View file

@ -1,23 +1,19 @@
package main package cli
import ( import (
"fmt" "fmt"
"os" "os"
"github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/ethereum/go-ethereum/command/flagset" "github.com/ethereum/go-ethereum/internal/cli/flagset"
"github.com/ethereum/go-ethereum/command/server" "github.com/ethereum/go-ethereum/internal/cli/server"
"github.com/ethereum/go-ethereum/command/server/proto" "github.com/ethereum/go-ethereum/internal/cli/server/proto"
"github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/node"
"github.com/mitchellh/cli" "github.com/mitchellh/cli"
"github.com/ryanuber/columnize" "github.com/ryanuber/columnize"
"google.golang.org/grpc" "google.golang.org/grpc"
) )
func main() {
os.Exit(Run(os.Args[1:]))
}
func Run(args []string) int { func Run(args []string) int {
commands := commands() commands := commands()

View file

@ -1,4 +1,4 @@
package main package cli
// Based on https://github.com/hashicorp/nomad/blob/main/command/operator_debug.go // Based on https://github.com/hashicorp/nomad/blob/main/command/operator_debug.go
@ -16,8 +16,8 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/ethereum/go-ethereum/command/flagset" "github.com/ethereum/go-ethereum/internal/cli/flagset"
"github.com/ethereum/go-ethereum/command/server/proto" "github.com/ethereum/go-ethereum/internal/cli/server/proto"
"github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/jsonpb"
gproto "github.com/golang/protobuf/proto" gproto "github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes/empty" "github.com/golang/protobuf/ptypes/empty"

View file

@ -1,4 +1,4 @@
package main package cli
import ( import (
"github.com/mitchellh/cli" "github.com/mitchellh/cli"

View file

@ -1,10 +1,10 @@
package main package cli
import ( import (
"context" "context"
"github.com/ethereum/go-ethereum/command/flagset" "github.com/ethereum/go-ethereum/internal/cli/flagset"
"github.com/ethereum/go-ethereum/command/server/proto" "github.com/ethereum/go-ethereum/internal/cli/server/proto"
) )
// PeersAddCommand is the command to group the peers commands // PeersAddCommand is the command to group the peers commands

View file

@ -1,12 +1,12 @@
package main package cli
import ( import (
"context" "context"
"fmt" "fmt"
"strings" "strings"
"github.com/ethereum/go-ethereum/command/flagset" "github.com/ethereum/go-ethereum/internal/cli/flagset"
"github.com/ethereum/go-ethereum/command/server/proto" "github.com/ethereum/go-ethereum/internal/cli/server/proto"
) )
// PeersListCommand is the command to group the peers commands // PeersListCommand is the command to group the peers commands

View file

@ -1,10 +1,10 @@
package main package cli
import ( import (
"context" "context"
"github.com/ethereum/go-ethereum/command/flagset" "github.com/ethereum/go-ethereum/internal/cli/flagset"
"github.com/ethereum/go-ethereum/command/server/proto" "github.com/ethereum/go-ethereum/internal/cli/server/proto"
) )
// PeersRemoveCommand is the command to group the peers commands // PeersRemoveCommand is the command to group the peers commands

View file

@ -1,12 +1,12 @@
package main package cli
import ( import (
"context" "context"
"fmt" "fmt"
"strings" "strings"
"github.com/ethereum/go-ethereum/command/flagset" "github.com/ethereum/go-ethereum/internal/cli/flagset"
"github.com/ethereum/go-ethereum/command/server/proto" "github.com/ethereum/go-ethereum/internal/cli/server/proto"
) )
// PeersStatusCommand is the command to group the peers commands // PeersStatusCommand is the command to group the peers commands

View file

@ -14,12 +14,12 @@ import (
godebug "runtime/debug" godebug "runtime/debug"
"github.com/ethereum/go-ethereum/command/server/chains"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/fdlimit" "github.com/ethereum/go-ethereum/common/fdlimit"
"github.com/ethereum/go-ethereum/eth/downloader" "github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/eth/ethconfig" "github.com/ethereum/go-ethereum/eth/ethconfig"
"github.com/ethereum/go-ethereum/eth/gasprice" "github.com/ethereum/go-ethereum/eth/gasprice"
"github.com/ethereum/go-ethereum/internal/cli/server/chains"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p"

View file

@ -1,7 +1,7 @@
package server package server
import ( import (
"github.com/ethereum/go-ethereum/command/flagset" "github.com/ethereum/go-ethereum/internal/cli/flagset"
) )
func (c *Command) Flags() *flagset.Flagset { func (c *Command) Flags() *flagset.Flagset {

View file

@ -11,11 +11,11 @@ import (
"time" "time"
"github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/ethereum/go-ethereum/command/server/proto"
"github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth/tracers" "github.com/ethereum/go-ethereum/eth/tracers"
"github.com/ethereum/go-ethereum/ethstats" "github.com/ethereum/go-ethereum/ethstats"
"github.com/ethereum/go-ethereum/graphql" "github.com/ethereum/go-ethereum/graphql"
"github.com/ethereum/go-ethereum/internal/cli/server/proto"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/metrics/influxdb" "github.com/ethereum/go-ethereum/metrics/influxdb"

View file

@ -7,9 +7,9 @@ import (
"reflect" "reflect"
"strings" "strings"
"github.com/ethereum/go-ethereum/command/server/pprof"
"github.com/ethereum/go-ethereum/command/server/proto"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/internal/cli/server/pprof"
"github.com/ethereum/go-ethereum/internal/cli/server/proto"
"github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/p2p/enode"
gproto "github.com/golang/protobuf/proto" gproto "github.com/golang/protobuf/proto"

View file

@ -4,7 +4,7 @@ import (
"math/big" "math/big"
"testing" "testing"
"github.com/ethereum/go-ethereum/command/server/proto" "github.com/ethereum/go-ethereum/internal/cli/server/proto"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )

View file

@ -1,11 +1,11 @@
package main package cli
import ( import (
"context" "context"
"fmt" "fmt"
"strings" "strings"
"github.com/ethereum/go-ethereum/command/server/proto" "github.com/ethereum/go-ethereum/internal/cli/server/proto"
"github.com/golang/protobuf/ptypes/empty" "github.com/golang/protobuf/ptypes/empty"
) )

View file

@ -1,4 +1,4 @@
package main package cli
import ( import (
"github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/params"