Skip to content

How do the --lib and --bin flags work? #362

Answered by sassman
mscofield0 asked this question in Q&A
Discussion options

You must be logged in to vote

There is this example in the README

[package]
# the usual stuff

[dependencies]
{% if crate_type == "bin" %}
structopt = "0.3.21"
{% endif %}
# other general dependencies

{% if crate_type == "bin" %}
[[bin]]
path = "src/main.rs"
name = "{{crate_name}}-cli"
{% endif %}

that illustrates the behaviour.

So as a template author you can provide both files, and offer both capabilities.
A user must then delete the not needed file after generating the project.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mscofield0
Comment options

Answer selected by mscofield0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants