Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List command to show sdk and ibc version #112

Merged
merged 4 commits into from
Mar 24, 2023

Conversation

7AC
Copy link
Contributor

@7AC 7AC commented Mar 24, 2023

Sample output:

~/Developer/heighliner(main|…) % go run main.go list
Loaded chains from /Users/giuseppe/Developer/heighliner/chains.yaml

ArableProtocol/acrechain:
  cosmos-sdk@v0.45.10
  ibc-go@v3.2.0

axelarnetwork/axelar-core:
  cosmos-sdk@v0.45.11
  ibc-go@v4.2.0

BitCannaGlobal/bcna:
  cosmos-sdk@v0.45.15
  ibc-go@v3.4.0

bitsongofficial/go-bitsong:
  cosmos-sdk@v0.45.11
  ibc-go@v3.3.1

[...]

@DavidNix
Copy link
Contributor

@7AC This is a neat feature!

How does it handle non-cosmos builds?

@7AC
Copy link
Contributor Author

7AC commented Mar 24, 2023

How does it handle non-cosmos builds?

right now it just prints this:

tendermint/tendermint:
  no versions found

cmd/list.go Outdated Show resolved Hide resolved
cmd/list.go Outdated
Comment on lines 57 to 68
if err != nil {
continue
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
continue
}
mod, err := modfile.Parse("", body, nil)
if err != nil {
continue
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If encountering an error, can we print the error so the user will know something went wrong?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah makes sense, this was a quick prototype

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the full output with errors:

Loaded chains from /Users/giuseppe/Developer/heighliner/chains.yaml

acrechain:
  cosmos-sdk@v0.45.10
  ibc-go@v3.2.0

agoric:
  error: not enough repo info

akash:
  error: 404 Not Found

assetmantle:
  error: 404 Not Found

axelar:
  cosmos-sdk@v0.45.11
  ibc-go@v4.2.0

tofnd:
  error: 404 Not Found

basilisk:
  error: 404 Not Found

bitcanna:
  cosmos-sdk@v0.45.15
  ibc-go@v3.4.0

bitsong:
  cosmos-sdk@v0.45.11
  ibc-go@v3.3.1

bostrom:
  cosmos-sdk@v0.45.5
  ibc-go@v3.0.0

burnt:
  cosmos-sdk@v0.45.11
  ibc-go@v4.2.0

carbon:
  error: 404 Not Found

cerberus:
  cosmos-sdk@v0.45.10
  ibc-go@v3.3.0

cheqd:
  cosmos-sdk@v0.46.10
  ibc-go@v6.1.0

chihuahua:
  cosmos-sdk@v0.45.12
  ibc-go@v4.2.0

comdex:
  cosmos-sdk@v0.46.7
  ibc-go@v4.3.0

composable:
  error: 404 Not Found

gaia:
  cosmos-sdk@v0.45.13-ics
  ibc-go@v4.2.0

ics:
  cosmos-sdk@v0.45.11
  ibc-go@v4.2.0

crescent:
  cosmos-sdk@v0.45.10
  ibc-go@v3.4.0

cronos:
  cosmos-sdk@v0.46.11
  ibc-go@v5.2.0

cryptoorgchain:
  error: 404 Not Found

decentr:
  error: 404 Not Found

desmos:
  error: 404 Not Found

dig:
  error: 404 Not Found

duality:
  error: 404 Not Found

emoney:
  error: 404 Not Found

evmos:
  cosmos-sdk@v0.46.11
  ibc-go@v6.1.0

fetchhub:
  error: 404 Not Found

firmachain:
  error: 404 Not Found

gravitybridge:
  error: 404 Not Found

ibc-go-simd:
  cosmos-sdk@v0.47.0

impacthub:
  cosmos-sdk@v0.45.12
  ibc-go@v4.3.0

injective:
  error: not enough repo info

icad:
  error: 404 Not Found

icqd:
  cosmos-sdk@v0.45.8
  ibc-go@v3.0.1

irisnet:
  error: 404 Not Found

juno:
  cosmos-sdk@v0.45.15
  ibc-go@v4.3.0

kichain:
  cosmos-sdk@v0.42.10

konstellation:
  error: 404 Not Found

kujira:
  error: 404 Not Found

likecoin:
  error: 404 Not Found

lumnetwork:
  error: 404 Not Found

nomic:
  error: 404 Not Found

neutron:
  cosmos-sdk@v0.45.11
  ibc-go@v4.2.0

nibiru:
  error: 404 Not Found

noble:
  cosmos-sdk@v0.45.13
  ibc-go@v3.4.0

nolus:
  cosmos-sdk@v0.45.13-ics
  ibc-go@v4.2.0

omniflixhub:
  cosmos-sdk@v0.45.11
  ibc-go@v3.4.0

onomy:
  cosmos-sdk@v0.44.5
  ibc-go@v2.0.4

onomy-gbt:
  error: 404 Not Found

osmosis:
  cosmos-sdk@v0.47.1
  ibc-go@v4.3.0

panacea:
  cosmos-sdk@v0.45.12
  ibc-go@v4.3.0

penumbra:
  error: 404 Not Found

persistence:
  cosmos-sdk@v0.45.14
  ibc-go@v4.3.0

polkadot:
  error: 404 Not Found

provenance:
  cosmos-sdk@v0.46.7
  ibc-go@v6.1.0

quasar:
  cosmos-sdk@v0.45.14
  ibc-go@v4.3.0

quasartestnet:
  error: not enough repo info

quicksilver:
  cosmos-sdk@v0.46.10
  ibc-go@v5.2.0

regen:
  cosmos-sdk@v0.46.7
  ibc-go@v5.2.0
  cosmos-sdk@v0.1.0
  cosmos-sdk@v1.0.0-beta.5
  cosmos-sdk@v1.0.0-alpha.12

rizon:
  error: 404 Not Found

secretnetwork:
  error: not enough repo info

sei:
  error: 404 Not Found

sentinel:
  error: 404 Not Found

shentu:
  error: 404 Not Found

sifchain:
  error: 404 Not Found

sim:
  cosmos-sdk@v1.0.0-beta.1.0.20220726092710-f848e4300a8a

sommelier:
  cosmos-sdk@v0.44.5-patch
  ibc-go@v2.0.0

stargaze:
  cosmos-sdk@v0.45.14
  ibc-go@v4.3.0

starname:
  cosmos-sdk@v0.45.9
  ibc-go@v3.3.0
  cosmos-sdk@v0.4.0-rc

stride:
  cosmos-sdk@v0.46.7
  ibc-go@v5.1.0

tendermint:
  error: no versions found

terra:
  cosmos-sdk@v0.45.12
  ibc-go@v3.4.0

thorchain:
  error: 404 Not Found

umee:
  cosmos-sdk@v0.46.11
  ibc-go@v5.2.0

vidulum:
  cosmos-sdk@v0.45.9
  ibc-go@v1.2.2

wasm:
  cosmos-sdk@v0.47.0
  ibc-go@v7.0.0

7AC and others added 2 commits March 24, 2023 09:35
Co-authored-by: David Nix <DavidNix@users.noreply.github.com>
Copy link
Contributor

@DavidNix DavidNix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the refactor.

The error handling could still use improvement.

This error is not descriptive enough if you are trying this command for the first time.

error: 404 Not Found

The command only attempts to find Cosmos-specific info which may not be obvious to a new user.

However, an easy followup refactor can resolve these concerns. Thanks for the contribution!

"strings"
)

func loadLocalChainsYaml() error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

@DavidNix DavidNix merged commit ef609ef into strangelove-ventures:main Mar 24, 2023
@7AC
Copy link
Contributor Author

7AC commented Mar 24, 2023

Thanks for the refactor.

The error handling could still use improvement.

This error is not descriptive enough if you are trying this command for the first time.

error: 404 Not Found

The command only attempts to find Cosmos-specific info which may not be obvious to a new user.

404 actually means that there is no go.mod in the root of the repo (or the repo doesn’t exist anymore, has been renamed etc). But yeah to your point we could put the URL in the error or describe what we tried to fetch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants