Switch cargo new default to --bin

This commit is contained in:
Aleksey Kladov 2018-02-12 20:00:59 +03:00
parent 9e5721c2b7
commit 9cb10e68a2
5 changed files with 9 additions and 11 deletions

View file

@ -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

View file

@ -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

View file

@ -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 };

View file

@ -7,7 +7,7 @@ $ cargo new hello_world --bin
```
Were passing `--bin` because were making a binary program: if we
were making a library, wed leave it off.
were making a library, wed pass `--lib`.
Lets check out what Cargo has generated for us:

View file

@ -7,7 +7,7 @@ $ cargo new hello_world --bin
```
Were passing `--bin` because were making a binary program: if we
were making a library, wed leave it off. This also initializes a new `git`
were making a library, wed pass `--lib`. This also initializes a new `git`
repository by default. If you don't want it to do that, pass `--vcs none`.
Lets 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, lets check out `Cargo.toml`:
Lets take a closer look at `Cargo.toml`:
```toml
[package]