Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert from docopt to structopt #62

Closed
wants to merge 1 commit into from
Closed

Convert from docopt to structopt #62

wants to merge 1 commit into from

Conversation

svartalf
Copy link

@svartalf svartalf commented Mar 14, 2019

Closes #55.

Instead of direct clap integration I've decided to use structopt crate, which is basically clap with custom derives, for these reasons:

  • it helps to keep verbose enough clap configuration out of the code
  • it is similar to previously used docopt crate, which will ease further maintenance
  • hides arguments parsing into required types (no more manual conversions from String to PathBuf)

Here is a generated output example for wasm2obj binary:

$ cargo run --bin wasm2obj -- --help
wasm2obj 0.1.0
The Wasmtime Project Developers
Wasm to native object translation utility.

Takes a binary WebAssembly module into a native object file. The translation is dependent on the environment chosen. The
default is a dummy environment that produces placeholder values.

USAGE:
    wasm2obj [FLAGS] [OPTIONS] <FILE> -o <arg_output>

FLAGS:
    -g               
            generate debug information

    -h, --help       
            Prints help information

    -V, --version    
            Prints version information

OPTIONS:
    -o <arg_output>              
            output file

        --target <arg_target>    
            build for the target triple; default is the host machine

ARGS:
    <FILE>    

P.S. I've also noticed that wast binary declares flag_function argument, but not using it at all. Was not sure what to do with that, so leaved it as is.

@svartalf
Copy link
Author

Okay, builds for Linux and MacOS (1.31, beta and nightly) are green 🎉

For some reasons, Windows build is failing with the same error as all builds in last few months, so I'm going to assume that this problem is not related to my PR.

Ready for review!

@sunfishcode
Copy link
Member

Thanks for your participation here, however for unrelated reasons, we've decided not to continue with the Gitcoin program here.

pchickey pushed a commit to pchickey/wasmtime that referenced this pull request May 12, 2023
Add a `byte-array` proc-macro crate for converting strings into byte
arrays that don't use static initializers, and use it to implement
`eprintln`, an `unreachable` that prints the line number, and other
macros.
dhil added a commit to dhil/wasmtime that referenced this pull request Nov 29, 2023
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.

Convert from docopt to clap
2 participants