Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

More idiomatic argument parsing #3

Closed
kjvalencik opened this issue Feb 19, 2021 · 0 comments
Closed

More idiomatic argument parsing #3

kjvalencik opened this issue Feb 19, 2021 · 0 comments

Comments

@kjvalencik
Copy link
Member

kjvalencik commented Feb 19, 2021

There is currently some strange argument parsing with = delimiters and a magic $npm_package_name variable. Instead we should parse as follows:

# All flags can be declared many times

# Default. Always exactly 3 arguments following `--artifact`
--artifact crate-type crate-name output-file

# Shorthand
-a crate-type crate-name output-file

# NPM special version that uses the `$npm_package_name` environment variable for crate-name
# Always exactly 2 arguments
--npm crate-type output-file

# Shorthand
-n crate-type output-file

# Lastly, modifiers can be added to the shorthand versions to apply the crate type
# b = bin
# c = cdylib
# d = dylib
# Modifiers take the place of crate-type and reduce the arguments followed by 1
# Neon would default to using
-nc output-file

We will keep the -- separator for clarity.

cargo-cp-artifact -nc index.node -- cargo build --message-format=json-render-diagnostics
kjvalencik added a commit that referenced this issue Feb 19, 2021
kjvalencik added a commit that referenced this issue Feb 24, 2021
Improve command line parsing

Implements #3
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant