Giter Club home page Giter Club logo

clap-serde's People

Contributors

aobatact avatar fumieval avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

clap-serde's Issues

Add more tests

  • case tests

    • snake-case
    • pascal-case
    • kebab-case
  • Command flag test

  • Arg flag test

More idiomatic setting names

I see #[serde(rename_all = "lowercase")] is applied. I think kebab-case or snake_case would be more idomatic.

Env support?

Env variables are behind an extra clap feature flag and I'm assuming users would be interested

Documenet data model

Both user documentation and machine (schema) will help users to know how to use this.

Should 'required = false' in arg. allow default value to be undefined?

If argument is set as required = false it seems to have no impact on argument rendered as an 'option'?

Only way I was able to add optional flags was to give them default_value and hide it from the --help with hide_default_value = true

I was testing with this toml:

name = "Service provider X"
version = "0.1"
author = "author"
about = "Commands to invoke service provider scripts."

[subcommands.node]
about = "Commands for managing server nodes" 
subcommand_required = true

[subcommands.node.subcommands.create]
about = "Create new server nodes"
arg_required_else_help = true

[subcommands.node.subcommands.create.args.name]
help = "Node name within the group"
forbid_empty_values = true

[subcommands.node.subcommands.create.args.group]
# default_value = "something"
# hide_default_value = true
short = "g"
long = "group"
help = "Node group name"

cmd: target/debug/test node create FirstArg --group GroupName

Above fails when --group is defined, works without the flag though.
Starts working as expected with or without --group flag when default_value = "something" is uncommented.

Not a big issue, I was just curious.
Thank you for your work on this, seems to be the only way to extend clap commands runtime.

Use arrays for ordered items

Currently subcommands and args are objects in the data model. A lot of serialization sources consider the objects to have an undefined order but order of these is important. Rather than relying on implementation details of the serializers (and tools mucking with the raw data), I'd recommend switching these to arrays like in the old clap YAML support

name: myapp
version: "1.0"
author: Kevin K. <[email protected]>
about: Does awesome things
args:
    - config:
        short: c
        long: config
        value_name: FILE
        help: Sets a custom config file
        takes_value: true
    - INPUT:
        help: Sets the input file to use
        required: true
        index: 1
    - verbose:
        short: v
        multiple: true
        help: Sets the level of verbosity
subcommands:
    - test:
        about: controls testing features
        version: "1.3"
        author: Someone E. <[email protected]>
        args:
            - debug:
                short: d
                help: print debug information

Support for context-specific `App` functions

App::help_heading applies to all future args being added. We expect to add more like this (App::next_display_order, `App::env_prefix).

The challenge will be to fit it in the data model.

Serialize support

This was requested in clap, see clap-rs/clap#918

Other benefits

  • Insights into clap building by allowing dumping before and after to see what changed
  • Another way of providing insight into the derive API compared to cargo expand
  • Hopefully help people detect some level of breaking changes (especially for the more magical derive API)

Update to 3.1

A lot of things have changed since clap 3.0.
This crate needs to catch up.

TODO

  • App to Command
  • Add new flags for builder methods to Command
  • Add new flags for builder methods to Arg
  • Deprecations

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.