Git Product home page Git Product logo

paw's Introduction

clap

Command Line Argument Parser for Rust

Crates.io Crates.io License License Build Status Coverage Status Contributors

Dual-licensed under Apache 2.0 or MIT.

About

Create your command-line parser, with all of the bells and whistles, declaratively or procedurally.

For more details, see:

Sponsors

Gold

Silver

Bronze

Backer

paw's People

Contributors

dylan-dpc avatar nemo157 avatar yoshuawuyts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

paw's Issues

Does not retain `pub` keyword

Expected Behavior

If used inside lib.rs with #[paw::main] pub fn main(...) { ... } it should retain the pub keyword to allow calling from main.rs.

Current Behavior

error[E0603]: function `main` is private
  --> cli/src/main.rs:2:20
   |
2  |     cbor_diag_cli::main();
   |                    ^^^^ private function
   |
note: the function `main` is defined here
  --> cli/src/lib.rs:95:1
   |
95 | #[paw::main]
   | ^^^^^^^^^^^^

move traits to new crate

If we want to follow up on #1 and PR other crates to add paw support, the traits should probably be available standalone, without any of the proc macro deps.

We should probably make a paw-raw crate to hold just the traits, and re-export from the main paw crate.

error[E0277]: the trait bound `Args: ParseArgs` is not satisfied

Thanks for this crate. It works in one of my crates where main returns anyhow::Result<()>.
But why doesn't this work? :)

error[E0277]: the trait bound `Args: ParseArgs` is not satisfied
   --> src\main.rs:287:1
    |
287 | #[paw::main]
    | ^^^^^^^^^^^^ the trait `ParseArgs` is not implemented for `Args`
    |
    = note: required by `parse_args`
#[derive(StructOpt, Debug)]
struct Args {
	// ...
}

#[paw::main]
fn main(args: Args) -> Result<(), Box<dyn Error>> {
	// ...
}

trait name

I'm not entirely sure what we should name the trait. I just went with TryParse because it felt okay, but if it's something that stands out by itself, maybe it should be called something like ParseArgs, MainArgs, TryParseArgs?

Suggestions welcome!

Update proc-macro utilities

Feature Request

Summary

Update syn, proc-macro2 and quote to their stable releases

Motivation

To reduce duplication in the build tree of downstream users.

I can probably submit a PR for this soon, just want to open an issue now in case I don't get round to it.

Update structopt documentation, examples and crate

With structopt 0.2.17 paw is now supported through the 'paw' feature meaning that paw and structopt can be used just by including both in the dependencies:

[dependencies]
structopt = { version = "0.2.17", features = [ "paw" ] }
paw = "1.0"

The documentation and examples need updating and the paw-structopt crate can be deprecated.

Compatibility with human-panic?

From my reading of the code, the argument parser called by paw may panic before human-panic gets called to replace the panic hook, and if that happens the user ends up with a not-so-helpful error message.

Are there any plans for addressing this, particularly given the intention of including something like paw in std in the future?


PS. The issue template refers to a silver package.

Integration with clap 3.0

Feature Request

Summary

clap 3.0 integrated structopts (https://github.com/clap-rs/clap#quick-example) and I wonder if it makes sense to have clap 3.0 integration in paw.

Motivation

It seems that clap is more actively maintained, so it might be better to follow it.

Guide-level explanation

It is just another option to structopt.

Reference-level explanation

The integration should be defined by an optional feature, so it will play well with the existing integrations (structopt).

Drawbacks

It is one extra integration dependency, which makes things hard to maintain.

Rationale and alternatives

We can just ignore clap 3.0 as it seems that structopt is good enough.

Unresolved Questions

Is it worth the trouble?

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.