-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add info in docs fix docs commit-id:2ccf4af8
- Loading branch information
1 parent
7fdff63
commit 2d1611e
Showing
13 changed files
with
225 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
pub trait SectionArgs { | ||
fn dev(&self) -> bool; | ||
} | ||
|
||
#[derive(Clone, Debug, Default)] | ||
pub enum DepType { | ||
#[default] | ||
Normal, | ||
Dev, | ||
} | ||
|
||
impl DepType { | ||
pub fn toml_section_str(&self) -> &str { | ||
match self { | ||
DepType::Normal => "dependencies", | ||
DepType::Dev => "dev-dependencies" | ||
} | ||
} | ||
} | ||
impl DepType { | ||
pub fn from_section(section_args: &impl SectionArgs) -> DepType { | ||
if section_args.dev() { | ||
DepType::Dev | ||
} else { | ||
DepType::Normal | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -464,3 +464,23 @@ fn should_not_sort_if_already_unsorted() { | |
"#}) | ||
.run(); | ||
} | ||
|
||
#[test] | ||
fn add_dev_dep() { | ||
ManifestEditHarness::offline() | ||
.args(["add", "--dev", "[email protected]"]) | ||
.input(indoc! {r#" | ||
[package] | ||
name = "hello" | ||
version = "1.0.0" | ||
"#}) | ||
.output(indoc! {r#" | ||
[package] | ||
name = "hello" | ||
version = "1.0.0" | ||
[dev-dependencies] | ||
foo = "1.0.0" | ||
"#}) | ||
.run(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,6 +84,10 @@ You can add `branch`, `tag` and `rev` fields to Git dependencies. | |
You can use `ssh://` URLs, Scarb uses local `git` installation for all network operations. | ||
::: | ||
|
||
::: info | ||
You can add development dependencies in `[dev-dependencies]` section. | ||
::: | ||
|
||
### Via `scarb add` | ||
|
||
Add dependency hosted on a Git repository: | ||
|
@@ -110,6 +114,10 @@ You can specify package version like this: `[email protected]`, but see rema | |
`scarb rm` removes a dependency. | ||
::: | ||
|
||
::: info | ||
`--dev` flag adds/removes a dev-dependency. | ||
::: | ||
|
||
## Formatting | ||
|
||
Format Cairo code: | ||
|
Oops, something went wrong.