Skip to content

Commit

Permalink
prompt change
Browse files Browse the repository at this point in the history
  • Loading branch information
vineshtk committed Sep 24, 2024
1 parent c2b3e01 commit 2c0754d
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 21 deletions.
Binary file modified fabrix
Binary file not shown.
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/vineshtk/fabrix
go 1.22.5

require (
github.com/fatih/color v1.14.1
github.com/spf13/cobra v1.8.1
github.com/spf13/viper v1.19.0
golang.org/x/text v0.17.0
Expand All @@ -13,6 +14,8 @@ require (
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
Expand Down
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w=
github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
Expand All @@ -19,6 +21,11 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
Expand Down Expand Up @@ -63,6 +70,7 @@ go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
Expand Down
11 changes: 2 additions & 9 deletions pkg/configs/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func CreateDockerComposeCA(domainName string, orgPeers map[string]int) {

// create configs for all the organisations
for _, org := range keys {
fmt.Println("this is range order at CA", org)
// fmt.Println("this is range order at CA", org)
org := strings.ToLower(org)
viper.Set(fmt.Sprintf("services.ca_%v.image", org), "hyperledger/fabric-ca:1.5.7")
viper.Set(fmt.Sprintf("services.ca_%v.labels.service", org), "hyperledger-fabric")
Expand Down Expand Up @@ -331,7 +331,7 @@ func CreateDockerComposeMembers(domainName string, orgPeers map[string]int) {
// creating couchdb and peers for all the orgs
for index, org := range keys {
peers := orgPeers[org]
fmt.Println("this is range order", org)
// fmt.Println("this is range order", org)
org := strings.ToLower(org)
orgMSP := fmt.Sprintf("%vMSP", caser.String(org))
peerList := []Peer{}
Expand Down Expand Up @@ -1059,13 +1059,6 @@ func appendToScriptFile(content string, filePath string) error {
return err
}

// Make the script executable (optional)
// err = os.Chmod(filePath, 0755)
// if err != nil {
// fmt.Println("Error setting executable permissions:", err)
// return err
// }

return nil
}

Expand Down
3 changes: 1 addition & 2 deletions pkg/menu/inputs.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ func GetInputsFromUser() {
fmt.Print("\n")
domainName := ""
fmt.Println("Enter the domain name: ")
fmt.Scan(&domainName)
fmt.Print("\n")
fmt.Scanln(&domainName)
fmt.Print("Enter the number of organizations: ")
numOrganizations, err := getInputAsInt()
if err != nil || numOrganizations <= 0 {
Expand Down
25 changes: 15 additions & 10 deletions pkg/menu/menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,26 @@ package menu

import (
"fmt"

"github.com/fatih/color"
)

func ShowMainMenu() {
fmt.Println("Welcome to Fabrix - The helper tool for chaincode developers to create fabric network, it does all the heavy lifting for you!!!")
fmt.Println("You will be guided during throughout the process. Let's start...")

asciiArt := " _____ _ _ \n" +
"| ___|_ _| |__ _ __(_)_ __\n" +
"| |_ / _' | '_ \\| '__| \\ \\/ /\n" +
"| _| (_| | |_) | | | |> < \n" +
"|_| \\__,_|_.__/|_| |_/_/\\_\\\n"

fmt.Print("\n\n")
fmt.Println("MENU")
fmt.Println("N - New network")
fmt.Println("S - Select an existing network")
fmt.Println("D - Docker status")
fmt.Println("C - Clean all Docker resources")
fmt.Println("Q - Quit")
color.Blue(asciiArt)
fmt.Print("\n")
fmt.Print("Please select from the options: N, S, D, C, Q : ")

// color.Cyan("Hello, this text is in cyan!")
color.Green("The helper tool for chaincode developers to create fabric network, it does all the heavy lifting for you!!!")
color.Green("You will be guided throughout the process.")
color.Green("Prompt will ask you to give all the details of your network, please provide details acordingly.")
color.Yellow("Let's start...")

fmt.Print("\n")
}

0 comments on commit 2c0754d

Please sign in to comment.