GithubHelp home page GithubHelp logo

Comments (4)

denysdovhan avatar denysdovhan commented on June 3, 2024

This should be easy to fix. You just need to return from function when the first datafile call returns something. Would you like to send a PR?

from spaceship-prompt.

killjoy1221 avatar killjoy1221 commented on June 3, 2024

I actually think a better solution would be to read the pyproject.toml file once. jq can do this via the Alternative Operator.

jq -r '.project.version // .tool.poetry.version' < pyproject.toml`

It could be done using multiple arguments to spaceship::datafile and creating the jq query via ".${(j| // .|)keys}". This would also have to be implemented for the python and ruby implementations, which shouldn't be too difficult.

Of course, the simpler solution would be to just check for null.

local version=$(spaceship::datafile --toml "$pyproject_toml" "tool.poetry.version")
if [[ "$version" == "null" ]]; then
  version=$(spaceship::datafile --toml "$pyproject_toml" "project.version")
fi
echo "$version"

from spaceship-prompt.

denysdovhan avatar denysdovhan commented on June 3, 2024

spaceship:datafile relies not only on jq, but on various other tools, like pure python, node, etc. I'd stick to the simpler solution.

Please, send a PR. Your solution looks good to me.

from spaceship-prompt.

denysdovhan avatar denysdovhan commented on June 3, 2024

🎉 This issue has been resolved in version 4.15.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

from spaceship-prompt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.