Giter Site home page Giter Site logo

toml-cli's Issues

The documentation on https://pypi.org/project/toml-cli/ is not right for the version

In this page there is a parameter --toml-path for the version 0.3.1

I've installed it:

Package            Version
------------------ ------------
toml-cli           0.3.1

But when I tried to run it:

>toml --toml-path pyproject.toml get project.version 
Usage: toml [OPTIONS] COMMAND [ARGS]...
Try 'toml --help' for help.
╭─ Error ────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ No such option: --toml-path                                                                                            │
│ --help                        Show this message and exit.                                                              │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ─────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ add_section───────────────────── Add a section with the given key                                                      │
│ get_section───────────────────── Get a value from a toml file                                                          │
│ set_section───────────────────── Set a value to a toml file                                                            │
│ unsetection───────────────────── Unset a value from a toml file                                                        │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Change of behavior in returning strings

Hello,

toml-cli is useful for pyproject configuration manipulation, such as customizing the package version of pyproject. An example is appending a string to a given pyproject.toml:

[project]
version = "1.0"

And in shell:

toml set --toml-path pyproject.toml project.version $(toml get --toml-path pyproject.toml project.version).dev12345

The change of behavior is the following

Shell command line:

$(toml get --toml-path pyproject.toml project.version)

In version 0.3.1:
returns without quotes

1.0

In version 0.4.0:
returns with quotes

"1.0"

Breaking the above command line after customization of pyproject.toml

[project]
version = "\"1.0\".dev12345"

Reach the patch by an argument sequence rather than a single argument

Problem: paths are split by . for the get and unset commands

for key_part in key.split(".")[:-1]:

It's however possible for keys to have . within themselves, for example

[section."https://github.com/octokit"]

In those cases there's no way to get to the desired path due to the . splitting.

Solution: Accept a sequence of paths parts rather than a single string. Thus instead of

$ toml get --toml-path Cargo.toml 'section["https://github.com/octokit"]'

One would do

$ toml get --toml-path Cargo.toml section https://github.com/octokit

New release

Hi. It is possible to create a new release to include the latest changes? Thanks.

"set" array support

It doesnt appear possible to set a key to equal an array, i.e. foo = ["bar"]

Running on Windows

I cannot seem to run this as described on Windows. Installing via pip works fine. But you cannot run toml as a command from Windows terminal. Typically, when this happens I would use python -m to run the module as a script but this doesn't seem to work with toml-cli.

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.