Skip to content
Open
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
3 changes: 2 additions & 1 deletion prvd/networks/networks.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (

var network map[string]interface{}
var networks []interface{}
var optional bool
var paginate bool

var NetworksCmd = &cobra.Command{
Use: "networks",
Expand All @@ -28,7 +30,6 @@ var NetworksCmd = &cobra.Command{
}

func init() {
NetworksCmd.AddCommand(networksInitCmd)
NetworksCmd.AddCommand(networksListCmd)
NetworksCmd.AddCommand(networksDisableCmd)
NetworksCmd.Flags().BoolVarP(&optional, "optional", "", false, "List all the optional flags")
Expand Down
110 changes: 0 additions & 110 deletions prvd/networks/networks_init.go

This file was deleted.

20 changes: 20 additions & 0 deletions prvd/networks/networks_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,28 @@ func listNetworks(cmd *cobra.Command, args []string) {
log.Printf("Failed to retrieve networks list; %s", err.Error())
os.Exit(1)
}

publicNetworks := []*provide.Network{}
privateNetworks := []*provide.Network{}
for i := range networks {
network := networks[i]

if network.UserID == nil && network.ApplicationID == nil {
publicNetworks = append(publicNetworks, network)
} else {
privateNetworks = append(privateNetworks, network)
}
}

fmt.Println("public:")
for i := range publicNetworks {
network := publicNetworks[i]
result := fmt.Sprintf("%s\t%s\n", network.ID.String(), *network.Name)
fmt.Print(result)
}
fmt.Println("private:")
for i := range privateNetworks {
network := privateNetworks[i]
result := fmt.Sprintf("%s\t%s\n", network.ID.String(), *network.Name)
fmt.Print(result)
}
Expand Down
21 changes: 1 addition & 20 deletions prvd/networks/networks_prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import (
"github.com/spf13/cobra"
)

const promptStepInit = "Initialize"
const promptStepList = "List"
const promptStepDisable = "Disable"

var emptyPromptArgs = []string{promptStepInit, promptStepList, promptStepDisable}
var emptyPromptArgs = []string{promptStepList, promptStepDisable}
var emptyPromptLabel = "What would you like to do"

var publicPromptArgs = []string{"Yes", "No"}
Expand All @@ -18,24 +17,6 @@ var publicPromptLabel = "Would you like the network to be public"
// General Endpoints
func generalPrompt(cmd *cobra.Command, args []string, currentStep string) {
switch step := currentStep; step {
case promptStepInit:
// Validation non-null
if chain == "" {
chain = common.FreeInput("Chain", "", common.NoValidation)
}
if nativeCurrency == "" {
nativeCurrency = common.FreeInput("Native Currency", "", common.NoValidation)
}
if platform == "" {
platform = common.FreeInput("Platform", "", common.NoValidation)
}
if protocolID == "" {
protocolID = common.FreeInput("Protocol ID", "", common.NoValidation)
}
if networkName == "" {
networkName = common.FreeInput("Network Name", "", common.NoValidation)
}
CreateNetwork(cmd, args)
case promptStepList:
if optional {
result := common.SelectInput(publicPromptArgs, publicPromptLabel)
Expand Down