Skip to content

Conversation

@joshmeads
Copy link

@joshmeads joshmeads commented Apr 4, 2024

Hey, this PR just adds some extra info methods that I needed personally for some CI pipelines. I've separated the data fetching logic from the rendering logic to avoid repeat work.

Hope it helps!

swpm --info --json will return the info spec in JSON format

> swpm --info --json`
{
  "_": "npm",
  "using": "npm",
  "error": null,
  "ready": true,
  "origin": "pinned",
  "volta": true,
  "versions": {
    "swpm": "2.6.0",
    "node": "20.9.0",
    "npm": "10.2.1"
  }
}

If you pass a value to info it'll pick that value back.

> swpm --info=using
npm

> swpm --info origin
pinned

> swpm --info versions.node
20.9.0

> swpm --info brokenSelection
Invalid value - brokenSelection doesn't match any available value
using:  npm 
origin: 📌 pinned 
volta:  ⚡ detected 

Versions:
swpm:   2.6.0
Node:   20.9.0
npm:    10.2.1

The final brokenSelection example will run exit(1)

No value renders the same CLI output as previous.

> swpm --info
using:  npm 
origin: 📌 pinned 
volta:  ⚡ detected 

Versions:
swpm:   2.6.0
Node:   20.9.0
npm:    10.2.1

@equiman
Copy link
Member

equiman commented Apr 4, 2024

Hi @joshmeads I'm actually running out of time, but I will try to take a look at it this weekend.

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.

2 participants