mirror of
https://github.com/rust-lang/cargo
synced 2024-10-02 14:04:23 +00:00
Switch cargo new
default to --bin
This commit is contained in:
parent
9e5721c2b7
commit
9cb10e68a2
|
@ -32,8 +32,8 @@ Options:
|
|||
control system (git, hg, pijul, or fossil) or do not
|
||||
initialize any version control at all (none), overriding
|
||||
a global configuration.
|
||||
--bin Use a binary (application) template
|
||||
--lib Use a library template [default]
|
||||
--bin Use a binary (application) template [default]
|
||||
--lib Use a library template
|
||||
--name NAME Set the resulting package name
|
||||
-v, --verbose ... Use verbose output (-vv very verbose/build.rs output)
|
||||
-q, --quiet No output printed to stdout
|
||||
|
|
|
@ -32,8 +32,8 @@ Options:
|
|||
control system (git, hg, pijul, or fossil) or do not
|
||||
initialize any version control at all (none), overriding
|
||||
a global configuration.
|
||||
--bin Use a binary (application) template
|
||||
--lib Use a library template [default]
|
||||
--bin Use a binary (application) template [default]
|
||||
--lib Use a library template
|
||||
--name NAME Set the resulting package name, defaults to the value of <path>
|
||||
-v, --verbose ... Use verbose output (-vv very verbose/build.rs output)
|
||||
-q, --quiet No output printed to stdout
|
||||
|
|
|
@ -92,8 +92,8 @@ impl<'a> NewOptions<'a> {
|
|||
(true, true) => bail!("can't specify both lib and binary outputs"),
|
||||
(true, false) => NewProjectKind::Bin,
|
||||
(false, true) => NewProjectKind::Lib,
|
||||
// default to lib
|
||||
(false, false) => NewProjectKind::Lib,
|
||||
// default to bin
|
||||
(false, false) => NewProjectKind::Bin,
|
||||
};
|
||||
|
||||
let opts = NewOptions { version_control, kind, path, name };
|
||||
|
|
|
@ -7,7 +7,7 @@ $ cargo new hello_world --bin
|
|||
```
|
||||
|
||||
We’re passing `--bin` because we’re making a binary program: if we
|
||||
were making a library, we’d leave it off.
|
||||
were making a library, we’d pass `--lib`.
|
||||
|
||||
Let’s check out what Cargo has generated for us:
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ $ cargo new hello_world --bin
|
|||
```
|
||||
|
||||
We’re passing `--bin` because we’re making a binary program: if we
|
||||
were making a library, we’d leave it off. This also initializes a new `git`
|
||||
were making a library, we’d pass `--lib`. This also initializes a new `git`
|
||||
repository by default. If you don't want it to do that, pass `--vcs none`.
|
||||
|
||||
Let’s check out what Cargo has generated for us:
|
||||
|
@ -23,9 +23,7 @@ $ tree .
|
|||
1 directory, 2 files
|
||||
```
|
||||
|
||||
If we had just used `cargo new hello_world` without the `--bin` flag, then
|
||||
we would have a `lib.rs` instead of a `main.rs`. For now, however, this is all
|
||||
we need to get started. First, let’s check out `Cargo.toml`:
|
||||
Let’s take a closer look at `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
[package]
|
||||
|
|
Loading…
Reference in a new issue