Skip to content
This repository was archived by the owner on Feb 21, 2023. It is now read-only.

Commit a000c05

Browse files
flatten cmd pkg
1 parent 99d2a15 commit a000c05

File tree

10 files changed

+44
-43
lines changed

10 files changed

+44
-43
lines changed

cmd/add/add.go renamed to cmd/add.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
// Copyright (C) 2019-2022, Ava Labs, Inc. All rights reserved.
22
// See the file LICENSE for licensing terms.
33

4-
// Package implements "add" sub-commands.
5-
package add
4+
package cmd
65

76
import (
87
"github.com/spf13/cobra"
98
)
109

11-
func init() {
12-
cobra.EnablePrefixMatching = true
13-
}
14-
15-
// NewCommand implements "subnet-cli add" command.
16-
func NewCommand() *cobra.Command {
10+
// NewAddCommand implements "subnet-cli add" command.
11+
func NewAddCommand() *cobra.Command {
1712
cmd := &cobra.Command{
1813
Use: "add",
1914
Short: "Sub-commands for creating resources",

cmd/add/validator.go renamed to cmd/add_validator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (C) 2019-2022, Ava Labs, Inc. All rights reserved.
22
// See the file LICENSE for licensing terms.
33

4-
package add
4+
package cmd
55

66
import (
77
"bytes"

cmd/create/create.go renamed to cmd/create.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// Copyright (C) 2019-2022, Ava Labs, Inc. All rights reserved.
22
// See the file LICENSE for licensing terms.
33

4-
// Package implements "create" sub-commands.
5-
package create
4+
package cmd
65

76
import (
87
"bytes"
@@ -33,8 +32,8 @@ var (
3332
requestTimeout time.Duration
3433
)
3534

36-
// NewCommand implements "subnet-cli create" command.
37-
func NewCommand() *cobra.Command {
35+
// NewCreateCommand implements "subnet-cli create" command.
36+
func NewCreateCommand() *cobra.Command {
3837
cmd := &cobra.Command{
3938
Use: "create",
4039
Short: "Sub-commands for creating resources",

cmd/create/blockchain.go renamed to cmd/create_blockchain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (C) 2019-2022, Ava Labs, Inc. All rights reserved.
22
// See the file LICENSE for licensing terms.
33

4-
package create
4+
package cmd
55

66
import (
77
"context"

cmd/create/key.go renamed to cmd/create_key.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (C) 2019-2022, Ava Labs, Inc. All rights reserved.
22
// See the file LICENSE for licensing terms.
33

4-
package create
4+
package cmd
55

66
import (
77
"github.com/ava-labs/subnet-cli/internal/key"

cmd/create/subnet.go renamed to cmd/create_subnet.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (C) 2019-2022, Ava Labs, Inc. All rights reserved.
22
// See the file LICENSE for licensing terms.
33

4-
package create
4+
package cmd
55

66
import (
77
"context"

cmd/root.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (C) 2019-2022, Ava Labs, Inc. All rights reserved.
2+
// See the file LICENSE for licensing terms.
3+
4+
package cmd
5+
6+
import (
7+
"github.com/spf13/cobra"
8+
)
9+
10+
var rootCmd = &cobra.Command{
11+
Use: "subnet-cli",
12+
Short: "subnet-cli CLI",
13+
SuggestFor: []string{"subnet-cli", "subnetcli", "subnetctl"},
14+
}
15+
16+
func init() {
17+
cobra.EnablePrefixMatching = true
18+
}
19+
20+
func init() {
21+
rootCmd.AddCommand(
22+
create.NewCommand(),
23+
NewAddCommand(),
24+
status.NewCommand(),
25+
)
26+
}
27+
28+
func Execute() error {
29+
return rootCmd.Execute()
30+
}

cmd/status/status.go renamed to cmd/status.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// Copyright (C) 2019-2022, Ava Labs, Inc. All rights reserved.
22
// See the file LICENSE for licensing terms.
33

4-
// Package implements "status" sub-commands.
5-
package status
4+
package cmd
65

76
import (
87
"time"

cmd/status/blockchain.go renamed to cmd/status_blockchain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// See the file LICENSE for licensing terms.
33

44
// Package implements "status" sub-commands.
5-
package status
5+
package cmd
66

77
import (
88
"context"

main.go

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,17 @@
11
// Copyright (C) 2019-2022, Ava Labs, Inc. All rights reserved.
22
// See the file LICENSE for licensing terms.
33

4-
// "subnet-cli" implements quarkvm client operation interface.
54
package main
65

76
import (
87
"fmt"
98
"os"
109

11-
"github.com/ava-labs/subnet-cli/cmd/add"
12-
"github.com/ava-labs/subnet-cli/cmd/create"
13-
"github.com/ava-labs/subnet-cli/cmd/status"
14-
"github.com/spf13/cobra"
10+
"github.com/ava-labs/subnet-cli/cmd"
1511
)
1612

17-
var rootCmd = &cobra.Command{
18-
Use: "subnet-cli",
19-
Short: "subnet-cli CLI",
20-
SuggestFor: []string{"subnet-cli", "subnetcli", "subnetctl"},
21-
}
22-
23-
func init() {
24-
cobra.EnablePrefixMatching = true
25-
}
26-
27-
func init() {
28-
rootCmd.AddCommand(
29-
create.NewCommand(),
30-
add.NewCommand(),
31-
status.NewCommand(),
32-
)
33-
}
34-
3513
func main() {
36-
if err := rootCmd.Execute(); err != nil {
14+
if err := cmd.Execute(); err != nil {
3715
fmt.Fprintf(os.Stderr, "subnet-cli failed %v\n", err)
3816
os.Exit(1)
3917
}

0 commit comments

Comments
 (0)