From f6d2b09761c7939787f0acbcfdb010cdd7c8cf41 Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Wed, 19 Jul 2023 14:19:35 +0530 Subject: [PATCH 1/8] fix: update eth starlark package --- cli/common/constants.go | 2 +- package_io/constants.star | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/common/constants.go b/cli/common/constants.go index ce838bf9..b54b5104 100644 --- a/cli/common/constants.go +++ b/cli/common/constants.go @@ -24,4 +24,4 @@ const ( ) // !!!!!!!!!!! DO NOT UPDATE! WILL BE UPDATED DURING THE RELEASE PROCESS !!!!!!!!!!!!!!!!!!!!!! -var DiveVersion = "" +var DiveVersion = "v0.0.1-beta" diff --git a/package_io/constants.star b/package_io/constants.star index b77ff0de..7fbe1969 100644 --- a/package_io/constants.star +++ b/package_io/constants.star @@ -36,7 +36,7 @@ CONTRACT_DEPLOYMENT_SERVICE_ETHEREUM = struct( ) ETH_NODE_CLIENT = struct( - service_name = "el-client-0", + service_name = "el-1-geth-lighthouse", network_name= "eth", network = "0x301824.eth", nid = "0x301824", From 1b4abb0d89893cf405eba4fd589ffc3791a27e92 Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Wed, 19 Jul 2023 15:18:14 +0530 Subject: [PATCH 2/8] chore: update goreleaser --- cli/.goreleaser.yaml | 58 ++++++++++++++++++++++++++++++----- cli/commands/bridge/bridge.go | 4 +-- cli/common/types.go | 2 +- cli/go.mod | 8 +---- cli/go.sum | 18 ----------- 5 files changed, 54 insertions(+), 36 deletions(-) diff --git a/cli/.goreleaser.yaml b/cli/.goreleaser.yaml index a65edfee..86d205cb 100644 --- a/cli/.goreleaser.yaml +++ b/cli/.goreleaser.yaml @@ -6,13 +6,18 @@ before: - go mod tidy # you may remove this if you don't need go generate - go generate ./... + - go build builds: - - env: + - binary: "dive-cli" + env: - CGO_ENABLED=0 goos: - linux - windows - darwin + goarch: + - amd64 + - arm64 archives: - format: tar.gz @@ -26,19 +31,56 @@ archives: {{- if .Arm }}v{{ .Arm }}{{ end }} # use zip for windows archives format_overrides: - - goos: windows - format: zip + - goos: windows + format: zip + +brews: + # creates a brew formula representing the latest version + - name: dive-cli + tap: + owner: hugobyte + name: homebrew-tap + commit_author: + name: shreyasbhat0 + commit_msg_template: "Automated formula update for the CLI, version {{ .Tag }}" + homepage: "https://hugobyte.com" + description: "CLI for Dive Package" + license: "Apache 2.0" + + # NOTE: Goreleaser *should* automatically detect the binaries packaged inside the archives being installed by the Homebrew formula, but it doesn't due to: + # https://github.com/goreleaser/goreleaser/issues/2488 + # When this is fixed, we can remove this section + install: | + bin.install "dive-cli" + + # creates a versioned brew formula, enabling installation of specific versions of kurtosis cli + - name: dive-cli@{{ .Tag }} + tap: + owner: hugobyte + name: homebrew-tap + commit_author: + name: shreyasbhat0 + commit_msg_template: "Automated formula created for the CLI, version {{ .Tag }}" + homepage: "https://www.kurtosistech.com" + description: "CLI for managing Kurtosis environments." + license: "Apache 2.0" + + # NOTE: Goreleaser *should* automatically detect the binaries packaged inside the archives being installed by the Homebrew formula, but it doesn't due to: + # https://github.com/goreleaser/goreleaser/issues/2488 + # When this is fixed, we can remove this section + install: | + bin.install "dive-cli" + checksum: - name_template: 'checksums.txt' + name_template: "checksums.txt" snapshot: - name_template: "{{ incpatch .Version }}-next" + name_template: "{{ incpatch .Version }}" changelog: sort: asc filters: exclude: - - '^docs:' - - '^test:' - + - "^docs:" + - "^test:" # The lines beneath this are called `modelines`. See `:help modeline` # Feel free to remove those if you don't want/use them. # yaml-language-server: $schema=https://goreleaser.com/static/schema.json diff --git a/cli/commands/bridge/bridge.go b/cli/commands/bridge/bridge.go index efe13009..083187ec 100644 --- a/cli/commands/bridge/bridge.go +++ b/cli/commands/bridge/bridge.go @@ -63,7 +63,7 @@ func btpBridgeCmd(diveContext *common.DiveContext) *cobra.Command { if strings.ToLower(chainA) == "icon" && strings.ToLower(chainB) == "icon" { - diveContext.SetSpinnerMessage("Executing BTP Starlark Package") + diveContext.SetSpinnerMessage(" Executing BTP Starlark Package") data, _, err := enclaveCtx.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveBridgeScript, bridgeMainFunction, params, common.DiveDryRun, common.DiveDefaultParallelism, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) @@ -76,7 +76,7 @@ func btpBridgeCmd(diveContext *common.DiveContext) *cobra.Command { diveContext.SetSpinnerMessage(fmt.Sprintf("BTP Bridge Setup Completed between %s and %s", chainA, chainB)) } else if strings.ToLower(chainA) == "icon" && (strings.ToLower(chainB) == "eth" || strings.ToLower(chainB) == "hardhat") { - diveContext.SetSpinnerMessage("Executing BTP Starlark Package") + diveContext.SetSpinnerMessage(" Executing BTP Starlark Package") data, _, err := enclaveCtx.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveBridgeScript, bridgeMainFunction, params, common.DiveDryRun, common.DiveDefaultParallelism, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) if err != nil { diff --git a/cli/common/types.go b/cli/common/types.go index d7db6616..cfb62bb7 100644 --- a/cli/common/types.go +++ b/cli/common/types.go @@ -252,7 +252,7 @@ func (diveContext *DiveContext) GetSerializedData(response chan *kurtosis_core_r } else { diveContext.spinner.Stop() - diveContext.log.Fatalln("Starlark Run Failed", executionResponseLine.GetInstructionResult()) + diveContext.log.Fatalln("Starlark Run Failed", executionResponseLine.GetRunResponseLine()) } } } diff --git a/cli/go.mod b/cli/go.mod index 570f408c..cc4c91fb 100644 --- a/cli/go.mod +++ b/cli/go.mod @@ -3,6 +3,7 @@ module github.com/hugobyte/dive go 1.20 require ( + github.com/briandowns/spinner v1.23.0 github.com/fatih/color v1.15.0 github.com/google/go-github v17.0.0+incompatible github.com/kurtosis-tech/kurtosis/api/golang v0.80.8 @@ -13,27 +14,20 @@ require ( require ( github.com/Masterminds/semver/v3 v3.1.1 // indirect - github.com/briandowns/spinner v1.23.0 // indirect github.com/dsnet/compress v0.0.1 // indirect github.com/go-yaml/yaml v2.1.0+incompatible // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/go-querystring v1.1.0 // indirect - github.com/gosuri/uilive v0.0.4 // indirect - github.com/gosuri/uiprogress v0.0.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/kurtosis-tech/kurtosis-portal/api/golang v0.0.0-20230328194643-b4dea3081e25 // indirect github.com/kurtosis-tech/kurtosis/grpc-file-transfer/golang v0.0.0-20230427135111-ee2492059d06 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect - github.com/mattn/go-runewidth v0.0.14 // indirect github.com/mholt/archiver v3.1.1+incompatible // indirect - github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect github.com/nwaples/rardecode v1.1.3 // indirect github.com/pierrec/lz4 v2.6.1+incompatible // indirect - github.com/rivo/uniseg v0.4.4 // indirect - github.com/schollz/progressbar/v3 v3.13.1 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/ulikunitz/xz v0.5.10 // indirect github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect diff --git a/cli/go.sum b/cli/go.sum index c2141c21..c73706ef 100644 --- a/cli/go.sum +++ b/cli/go.sum @@ -65,14 +65,9 @@ github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+u github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gosuri/uilive v0.0.4 h1:hUEBpQDj8D8jXgtCdBu7sWsy5sbW/5GhuO8KBwJ2jyY= -github.com/gosuri/uilive v0.0.4/go.mod h1:V/epo5LjjlDE5RJUcqx8dbw+zc93y5Ya3yg8tfZ74VI= -github.com/gosuri/uiprogress v0.0.1 h1:0kpv/XY/qTmFWl/SkaJykZXrBBzwwadmW8fRb7RJSxw= -github.com/gosuri/uiprogress v0.0.1/go.mod h1:C1RTYn4Sc7iEyf6j8ft5dyoZ4212h8G1ol9QQluh5+0= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw= github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -89,16 +84,10 @@ github.com/kurtosis-tech/stacktrace v0.0.0-20211028211901-1c67a77b5409/go.mod h1 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/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= -github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mholt/archiver v3.1.1+incompatible h1:1dCVxuqs0dJseYEhi5pl7MYPH9zDa1wBi7mF09cbNkU= github.com/mholt/archiver v3.1.1+incompatible/go.mod h1:Dh2dOXnSdiLxRiPoVfIr/fI1TwETms9B8CTWfeh7ROU= -github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= -github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw= github.com/nwaples/rardecode v1.1.3 h1:cWCaZwfM5H7nAD6PyEdcVnczzV8i/JtotnyW/dD9lEc= github.com/nwaples/rardecode v1.1.3/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM= @@ -106,14 +95,9 @@ github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= -github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/schollz/progressbar/v3 v3.13.1 h1:o8rySDYiQ59Mwzy2FELeHY5ZARXZTVJC7iHD6PEFUiE= -github.com/schollz/progressbar/v3 v3.13.1/go.mod h1:xvrbki8kfT1fzWzBT/UZd9L6GA+jdL7HAgq2RFnO6fQ= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= @@ -121,7 +105,6 @@ github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRM github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= @@ -173,7 +156,6 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= From e137799b6c43d2cf439e4a9b2ab7eb2ae2bb3973 Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Wed, 19 Jul 2023 15:36:39 +0530 Subject: [PATCH 3/8] chore: update bridge log --- cli/commands/bridge/bridge.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cli/commands/bridge/bridge.go b/cli/commands/bridge/bridge.go index 083187ec..02a0850e 100644 --- a/cli/commands/bridge/bridge.go +++ b/cli/commands/bridge/bridge.go @@ -74,7 +74,6 @@ func btpBridgeCmd(diveContext *common.DiveContext) *cobra.Command { common.WriteToFile(response) - diveContext.SetSpinnerMessage(fmt.Sprintf("BTP Bridge Setup Completed between %s and %s", chainA, chainB)) } else if strings.ToLower(chainA) == "icon" && (strings.ToLower(chainB) == "eth" || strings.ToLower(chainB) == "hardhat") { diveContext.SetSpinnerMessage(" Executing BTP Starlark Package") data, _, err := enclaveCtx.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveBridgeScript, bridgeMainFunction, params, common.DiveDryRun, common.DiveDefaultParallelism, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) @@ -85,12 +84,12 @@ func btpBridgeCmd(diveContext *common.DiveContext) *cobra.Command { response := diveContext.GetSerializedData(data) common.WriteToFile(response) - diveContext.SetSpinnerMessage(fmt.Sprintf("BTP Bridge Setup Completed between %s and %s", chainA, chainB)) + } else { diveContext.FatalError("Chains Not Supported", "Supported Chains [icon,eth,hardhat]") } - diveContext.StopSpinner(" Execution Completed") + diveContext.StopSpinner(fmt.Sprintf("BTP Bridge Setup Completed between %s and %s", chainA, chainB)) }, } From 0c193f70a972498401b09c588efdd3d47406606d Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Wed, 19 Jul 2023 15:50:09 +0530 Subject: [PATCH 4/8] chore: update binary name in yaml --- cli/.goreleaser.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/.goreleaser.yaml b/cli/.goreleaser.yaml index 86d205cb..888758ef 100644 --- a/cli/.goreleaser.yaml +++ b/cli/.goreleaser.yaml @@ -8,7 +8,7 @@ before: - go generate ./... - go build builds: - - binary: "dive-cli" + - binary: "dive" env: - CGO_ENABLED=0 goos: @@ -51,7 +51,7 @@ brews: # https://github.com/goreleaser/goreleaser/issues/2488 # When this is fixed, we can remove this section install: | - bin.install "dive-cli" + bin.install "dive" # creates a versioned brew formula, enabling installation of specific versions of kurtosis cli - name: dive-cli@{{ .Tag }} @@ -69,7 +69,7 @@ brews: # https://github.com/goreleaser/goreleaser/issues/2488 # When this is fixed, we can remove this section install: | - bin.install "dive-cli" + bin.install "dive" checksum: name_template: "checksums.txt" From c4384288af339498d47c531f8449e3f1f080fb07 Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Wed, 19 Jul 2023 15:52:29 +0530 Subject: [PATCH 5/8] chore: update binary --- cli/.goreleaser.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/.goreleaser.yaml b/cli/.goreleaser.yaml index 888758ef..c9f6ed84 100644 --- a/cli/.goreleaser.yaml +++ b/cli/.goreleaser.yaml @@ -36,7 +36,7 @@ archives: brews: # creates a brew formula representing the latest version - - name: dive-cli + - name: dive tap: owner: hugobyte name: homebrew-tap @@ -54,7 +54,7 @@ brews: bin.install "dive" # creates a versioned brew formula, enabling installation of specific versions of kurtosis cli - - name: dive-cli@{{ .Tag }} + - name: dive@{{ .Tag }} tap: owner: hugobyte name: homebrew-tap From aa256ad06e98fbf05ee599a5c1927e05b3d477e0 Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Wed, 19 Jul 2023 16:20:22 +0530 Subject: [PATCH 6/8] fix: validate command arguments --- cli/commands/bridge/bridge.go | 6 ++---- cli/commands/chain/types/eth.go | 5 +---- cli/commands/chain/types/hardhat.go | 5 +---- cli/commands/chain/types/icon.go | 5 +---- cli/commands/clean/clean.go | 2 +- cli/commands/discord/discord.go | 1 + cli/commands/tutorial/tutorial.go | 1 + cli/commands/twitter/twitter.go | 1 + cli/commands/version/version.go | 1 + cli/common/types.go | 7 +++++++ 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/cli/commands/bridge/bridge.go b/cli/commands/bridge/bridge.go index 02a0850e..5014ea9f 100644 --- a/cli/commands/bridge/bridge.go +++ b/cli/commands/bridge/bridge.go @@ -29,6 +29,7 @@ func NewBridgeCmd(diveContext *common.DiveContext) *cobra.Command { Long: `To connect two different chains using any of the supported cross chain communication protocols. This will create an relay to connect two different chains and pass any messages between them.`, Run: func(cmd *cobra.Command, args []string) { + cmd.Help() }, } @@ -45,10 +46,7 @@ func btpBridgeCmd(diveContext *common.DiveContext) *cobra.Command { Short: "Starts BTP Bridge between ChainA and ChainB", Long: ``, Run: func(cmd *cobra.Command, args []string) { - if len(args) != 0 { - diveContext.FatalError("Invalid Usage of command. Find cmd", cmd.UsageString()) - - } + common.ValidateCmdArgs(args, cmd.UsageString()) enclaveCtx, err := diveContext.GetEnclaveContext() diff --git a/cli/commands/chain/types/eth.go b/cli/commands/chain/types/eth.go index c90d77a1..42084723 100644 --- a/cli/commands/chain/types/eth.go +++ b/cli/commands/chain/types/eth.go @@ -15,10 +15,7 @@ func NewEthCmd(diveContext *common.DiveContext) *cobra.Command { It establishes a connection to the Ethereum network and allows the node in executing smart contracts and maintaining the decentralized ledger.`, Run: func(cmd *cobra.Command, args []string) { - if len(args) != 0 { - diveContext.FatalError("Invalid Usage of command. Find cmd", cmd.UsageString()) - - } + common.ValidateCmdArgs(args, cmd.UsageString()) data, err := RunEthNode(diveContext) diff --git a/cli/commands/chain/types/hardhat.go b/cli/commands/chain/types/hardhat.go index 1790ef6b..cabac9d5 100644 --- a/cli/commands/chain/types/hardhat.go +++ b/cli/commands/chain/types/hardhat.go @@ -15,10 +15,7 @@ func NewHardhatCmd(diveContext *common.DiveContext) *cobra.Command { It establishes a connection to the hardhat network and allows the node in executing smart contracts and maintaining the decentralized ledger.`, Run: func(cmd *cobra.Command, args []string) { - if len(args) != 0 { - diveContext.FatalError("Invalid Usage of command. Find cmd", cmd.UsageString()) - - } + common.ValidateCmdArgs(args, cmd.UsageString()) data, err := RunHardhatNode(diveContext) diff --git a/cli/commands/chain/types/icon.go b/cli/commands/chain/types/icon.go index 10b119fe..a1ca1dd2 100644 --- a/cli/commands/chain/types/icon.go +++ b/cli/commands/chain/types/icon.go @@ -72,10 +72,7 @@ func NewIconCmd(diveContext *common.DiveContext) *cobra.Command { It establishes a connection to the Icon network and allows the node in executing smart contracts and maintaining the decentralized ledger.`, Run: func(cmd *cobra.Command, args []string) { - if len(args) != 0 { - diveContext.FatalError("Invalid Usage of command. Find cmd", cmd.UsageString()) - - } + common.ValidateCmdArgs(args, cmd.UsageString()) decentralisation, _ := cmd.Flags().GetBool("decentralisation") diff --git a/cli/commands/clean/clean.go b/cli/commands/clean/clean.go index 744c05b8..e38d84cb 100644 --- a/cli/commands/clean/clean.go +++ b/cli/commands/clean/clean.go @@ -16,7 +16,7 @@ func NewCleanCmd(diveContext *common.DiveContext) *cobra.Command { Short: "Cleans up Kurtosis leftover artifacts", Long: `Destroys and removes any running encalves. If no enclaves running to remove it will throw an error`, Run: func(cmd *cobra.Command, args []string) { - + common.ValidateCmdArgs(args, cmd.UsageString()) enclaveName := diveContext.GetEnclaves() if enclaveName == "" { logrus.Errorf("No enclaves running to clean !!") diff --git a/cli/commands/discord/discord.go b/cli/commands/discord/discord.go index 948e0c30..683383b2 100644 --- a/cli/commands/discord/discord.go +++ b/cli/commands/discord/discord.go @@ -19,6 +19,7 @@ var DiscordCmd = &cobra.Command{ to access the dedicated DIVE community. It allows users to engage in discussions, seek support, share insights, and collaborate with other members of the DIVE community within the Discord platform.`, Run: func(cmd *cobra.Command, args []string) { + common.ValidateCmdArgs(args, cmd.UsageString()) logrus.Info("Redirecting to DIVE discord channel...") if err := common.OpenFile(diveURL); err != nil { logrus.Errorf("Failed to open Dive discord channel with error %v", err) diff --git a/cli/commands/tutorial/tutorial.go b/cli/commands/tutorial/tutorial.go index 58dcb83b..ab682875 100644 --- a/cli/commands/tutorial/tutorial.go +++ b/cli/commands/tutorial/tutorial.go @@ -19,6 +19,7 @@ var TutorialCmd = &cobra.Command{ directing users to a curated collection of tutorial videos specifically designed to guide and educate users about DIVE. The playlist offers step-by-step instructions, tips, and demonstrations to help users better understand and utilize the features and functionalities of DIVE.`, Run: func(cmd *cobra.Command, args []string) { + common.ValidateCmdArgs(args, cmd.UsageString()) logrus.Info("Redirecting to YouTube...") if err := common.OpenFile(tutorialURL); err != nil { logrus.Errorf("Failed to open Dive YouTube chanel with error %v", err) diff --git a/cli/commands/twitter/twitter.go b/cli/commands/twitter/twitter.go index e195da0b..1c74c27e 100644 --- a/cli/commands/twitter/twitter.go +++ b/cli/commands/twitter/twitter.go @@ -20,6 +20,7 @@ to the designated Twitter profile of HugoByte, providing access to the latest up shared by the official HugoByte Twitter account. Users can stay informed about HugoByte's activities, engage with the community, and follow our social media presence directly from the Twitter homepage.`, Run: func(cmd *cobra.Command, args []string) { + common.ValidateCmdArgs(args, cmd.UsageString()) logrus.Info("Redirecting to twitter...") if err := common.OpenFile(twitterURL); err != nil { logrus.Errorf("Failed to open HugoByte twitter with error %v", err) diff --git a/cli/commands/version/version.go b/cli/commands/version/version.go index de9a9df0..280be441 100644 --- a/cli/commands/version/version.go +++ b/cli/commands/version/version.go @@ -17,6 +17,7 @@ var VersionCmd = &cobra.Command{ Short: "Prints the CLI version", Long: `Prints the current DIVE CLI version and warns if you are using an old version.`, Run: func(cmd *cobra.Command, args []string) { + common.ValidateCmdArgs(args, cmd.UsageString()) version := color.New(color.Bold).Sprintf("CLI version - %s", common.DiveVersion) fmt.Println(version) diff --git a/cli/common/types.go b/cli/common/types.go index cfb62bb7..73d66d0b 100644 --- a/cli/common/types.go +++ b/cli/common/types.go @@ -260,3 +260,10 @@ func (diveContext *DiveContext) GetSerializedData(response chan *kurtosis_core_r return serializedOutputObj } + +func ValidateCmdArgs(args []string, cmd string) { + if len(args) != 0 { + logrus.Fatalf("Invalid Usage of command. Find cmd %s", cmd) + + } +} From 68f2c3bc4041ab6ed3d820a92a1ca4478efc91b4 Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Wed, 19 Jul 2023 16:32:40 +0530 Subject: [PATCH 7/8] feat: update goreleaser --- cli/.goreleaser.yaml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cli/.goreleaser.yaml b/cli/.goreleaser.yaml index c9f6ed84..413bb6f6 100644 --- a/cli/.goreleaser.yaml +++ b/cli/.goreleaser.yaml @@ -23,12 +23,12 @@ archives: - format: tar.gz # this name template makes the OS and Arch compatible with the results of uname. name_template: >- - {{ .ProjectName }}_ - {{- title .Os }}_ + {{ tolower .ProjectName }}_ + {{- tolower .Os }}_ {{- if eq .Arch "amd64" }}x86_64 {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} - {{- if .Arm }}v{{ .Arm }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }}_{{ .Tag }} # use zip for windows archives format_overrides: - goos: windows @@ -46,7 +46,8 @@ brews: homepage: "https://hugobyte.com" description: "CLI for Dive Package" license: "Apache 2.0" - + dependencies: + - name: kurtosis-tech/tap/kurtosis-cli # NOTE: Goreleaser *should* automatically detect the binaries packaged inside the archives being installed by the Homebrew formula, but it doesn't due to: # https://github.com/goreleaser/goreleaser/issues/2488 # When this is fixed, we can remove this section @@ -64,6 +65,8 @@ brews: homepage: "https://www.kurtosistech.com" description: "CLI for managing Kurtosis environments." license: "Apache 2.0" + dependencies: + - name: kurtosis-tech/tap/kurtosis-cli # NOTE: Goreleaser *should* automatically detect the binaries packaged inside the archives being installed by the Homebrew formula, but it doesn't due to: # https://github.com/goreleaser/goreleaser/issues/2488 @@ -74,7 +77,7 @@ brews: checksum: name_template: "checksums.txt" snapshot: - name_template: "{{ incpatch .Version }}" + name_template: "{{ incpatch .Tag }}" changelog: sort: asc filters: From 060b0fb899d099095bff87cb0f4638c70e244f8b Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Wed, 19 Jul 2023 17:58:52 +0530 Subject: [PATCH 8/8] feat: update goreleaser --- cli/.goreleaser.yaml | 9 --------- cli/commands/tutorial/tutorial.go | 2 +- cli/commands/version/version.go | 7 +++++++ cli/common/types.go | 2 +- cli/main.go | 6 +----- 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/cli/.goreleaser.yaml b/cli/.goreleaser.yaml index 413bb6f6..526cf924 100644 --- a/cli/.goreleaser.yaml +++ b/cli/.goreleaser.yaml @@ -46,8 +46,6 @@ brews: homepage: "https://hugobyte.com" description: "CLI for Dive Package" license: "Apache 2.0" - dependencies: - - name: kurtosis-tech/tap/kurtosis-cli # NOTE: Goreleaser *should* automatically detect the binaries packaged inside the archives being installed by the Homebrew formula, but it doesn't due to: # https://github.com/goreleaser/goreleaser/issues/2488 # When this is fixed, we can remove this section @@ -65,9 +63,6 @@ brews: homepage: "https://www.kurtosistech.com" description: "CLI for managing Kurtosis environments." license: "Apache 2.0" - dependencies: - - name: kurtosis-tech/tap/kurtosis-cli - # NOTE: Goreleaser *should* automatically detect the binaries packaged inside the archives being installed by the Homebrew formula, but it doesn't due to: # https://github.com/goreleaser/goreleaser/issues/2488 # When this is fixed, we can remove this section @@ -84,7 +79,3 @@ changelog: exclude: - "^docs:" - "^test:" -# The lines beneath this are called `modelines`. See `:help modeline` -# Feel free to remove those if you don't want/use them. -# yaml-language-server: $schema=https://goreleaser.com/static/schema.json -# vim: set ts=2 sw=2 tw=0 fo=cnqoj diff --git a/cli/commands/tutorial/tutorial.go b/cli/commands/tutorial/tutorial.go index ab682875..2b8670f0 100644 --- a/cli/commands/tutorial/tutorial.go +++ b/cli/commands/tutorial/tutorial.go @@ -9,7 +9,7 @@ import ( "github.com/spf13/cobra" ) -const tutorialURL = "https://www.youtube.com/@hugobyte" +const tutorialURL = "https://www.youtube.com/playlist?list=PL5Xd9z-fRL1vKtRlOzIlkhROspSSDeGyG" // tutorilaCmd redirects users to DIVE youtube playlist var TutorialCmd = &cobra.Command{ diff --git a/cli/commands/version/version.go b/cli/commands/version/version.go index 280be441..65c2b2b5 100644 --- a/cli/commands/version/version.go +++ b/cli/commands/version/version.go @@ -8,6 +8,7 @@ import ( "github.com/fatih/color" "github.com/hugobyte/dive/common" + "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,6 +19,12 @@ var VersionCmd = &cobra.Command{ Long: `Prints the current DIVE CLI version and warns if you are using an old version.`, Run: func(cmd *cobra.Command, args []string) { common.ValidateCmdArgs(args, cmd.UsageString()) + + // Checks for latest Version + latestVersion := common.GetLatestVersion() + if common.DiveVersion != latestVersion { + logrus.Warnf("Update available '%s'. Get the latest version of our DIVE CLI for bug fixes, performance improvements, and new features.", latestVersion) + } version := color.New(color.Bold).Sprintf("CLI version - %s", common.DiveVersion) fmt.Println(version) diff --git a/cli/common/types.go b/cli/common/types.go index 73d66d0b..6adbf324 100644 --- a/cli/common/types.go +++ b/cli/common/types.go @@ -252,7 +252,7 @@ func (diveContext *DiveContext) GetSerializedData(response chan *kurtosis_core_r } else { diveContext.spinner.Stop() - diveContext.log.Fatalln("Starlark Run Failed", executionResponseLine.GetRunResponseLine()) + diveContext.log.Fatalln("Starlark Run Failed") } } } diff --git a/cli/main.go b/cli/main.go index 7e013dab..4a7ac27b 100644 --- a/cli/main.go +++ b/cli/main.go @@ -5,7 +5,6 @@ package main import ( "github.com/hugobyte/dive/commands" - "github.com/hugobyte/dive/common" "github.com/sirupsen/logrus" ) @@ -15,10 +14,7 @@ func main() { FullTimestamp: true, TimestampFormat: "2006-01-02 15:04:05", }) - latestVersion := common.GetLatestVersion() - if common.DiveVersion != latestVersion { - logrus.Warnf("Update available '%s'. Get the latest version of our DIVE CLI for bug fixes, performance improvements, and new features.", latestVersion) - } + commands.Execute() }