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

Swap in structopt to get -h/--help #31

Merged
merged 1 commit into from
Oct 17, 2021

Conversation

scribe
Copy link
Contributor

@scribe scribe commented Oct 17, 2021

Add the short version of help by switching to structopt flag by switching the argument parsing to structopt to fix #30

Small PR to add the -h flag by switching the argument parsing
to structopt.
@scribe scribe requested a review from Tamschi as a code owner October 17, 2021 00:32
@scribe
Copy link
Contributor Author

scribe commented Oct 17, 2021

I saw your post about hacktoberfest contributions being welcome. If this is in any way not ok please feel free to close right away.

@Tamschi
Copy link
Owner

Tamschi commented Oct 17, 2021

I saw your post about hacktoberfest contributions being welcome. If this is in any way not ok please feel free to close right away.

It's looking great from the diff! Thank you!

I'll just run the checks and try it out. (If one of the checks fails it's likely my fault, I'll look into it in a moment.)

Copy link
Owner

@Tamschi Tamschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reserde on  structopt-for-h is 📦 v0.0.2 via 🦀 v1.55.0 
❯ cargo run -- -h
    Finished dev [unoptimized + debuginfo] target(s) in 0.66s
     Running `target\debug\reserde.exe -h`
reserde 0.0.2
Transcode a self-describing format into a different format.

Currently supports Bencode, Bincode (--out only), CBOR, JSON (--pretty), TAML (--in only), XML, x-www-form-urlencoded
(as urlencoded) and YAML. All names are lowercase.

USAGE:
    reserde.exe [FLAGS] [OPTIONS] --in <in-format> --out <out-format>

FLAGS:
        --enum-bools    case-insensitively convert unit variants with name `true` or `false` into booleans
    -h, --help          Prints help information
    -p                  pretty-print (where supported)
    -V, --version       Prints version information

OPTIONS:
        --if <in-file>        where to read input from. Defaults to stdin
    -i, --in <in-format>      what to read [possible values: bencode, cbor, json, taml, urlencoded, xml, yaml]
        --of <out-file>       where to write output to. Defaults to stdout
    -o, --out <out-format>    what to write [possible values: bencode, bincode, cbor, json, urlencoded, xml, yaml]
    -s <stringify>...         stringify bytes and non-string value keys into strings where possible, possible values
                              are: utf8. (Tries encodings in the order specified.) [try with: --in bencode]

Perfect, thank you!

It incidentally also improved the error output a bit, if you pass no parameters at all.
This should make it easier for new users to discover how to use the tool.

@Tamschi Tamschi added domain: Rust Involves Rust code. hacktoberfest-accepted Thank you for your contribution! state: approved Approved to proceed. type: fix Iterations on existing features or infrastructure labels Oct 17, 2021
@Tamschi Tamschi merged commit e2b27f1 into Tamschi:develop Oct 17, 2021
@Tamschi
Copy link
Owner

Tamschi commented Oct 17, 2021

It's quite late here, so I won't release a new version right now, but I'll put it on my tasks list for tomorrow.

@Tamschi
Copy link
Owner

Tamschi commented Oct 17, 2021

(I'm going to do a little repository gardening and assign you to both the original issue and this PR too, but there's no further action needed here.
Edit: Interesting, I can't assign you to the issue since you didn't comment there. I'll leave it as-in in that case.)

@Tamschi Tamschi added this to the v0.0.3 milestone Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: Rust Involves Rust code. hacktoberfest-accepted Thank you for your contribution! state: approved Approved to proceed. type: fix Iterations on existing features or infrastructure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support -h to display help
2 participants