Skip to content

Commit

Permalink
Renamed misnamed config keys
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Jun 20, 2023
1 parent b52aa64 commit a036162
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ that were not yet released.

_Unreleased_

- Renamed the config key `default.dependency_operator` to `default.dependency-operator`
and `behavior.force_rye_managed` to `behavior.force-rye-managed`. #338

<!-- released start -->

## 0.8.0
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/guide/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ license = "MIT"
# The dependency operator to use by default for dependencies. The options are
# '>=', '~=', and '=='. The default currently is '>='. This affects the behavior
# of `rye add`.
dependency_operator = ">="
dependency-operator = ">="

[proxy]
# the proxy to use for HTTP (overridden by the http_proxy environment variable)
Expand All @@ -70,7 +70,7 @@ https = "http://127.0.0.1:4000"

[behavior]
# When set to true the `managed` flag is always assumed to be true.
force_rye_managed = false
force-rye-managed = false

# a array of tables with optional sources. Same format as in pyproject.toml
[[sources]]
Expand Down
12 changes: 10 additions & 2 deletions rye/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ impl Config {
pub fn default_dependency_operator(&self) -> Operator {
self.doc
.get("default")
.and_then(|x| x.get("dependency_operator"))
.and_then(|x| {
x.get("dependency-operator")
// legacy typo key
.or_else(|| x.get("dependency_operator"))
})
.and_then(|x| x.as_str())
.map_or(Operator::GreaterThanEqual, |x| match x {
"==" => Operator::Equal,
Expand All @@ -130,7 +134,11 @@ impl Config {
pub fn force_rye_managed(&self) -> bool {
self.doc
.get("behavior")
.and_then(|x| x.get("force_rye_managed"))
.and_then(|x| {
x.get("force-rye-managed")
// legacy typo key
.or_else(|| x.get("force_rye_managed"))
})
.and_then(|x| x.as_bool())
.unwrap_or(false)
}
Expand Down

0 comments on commit a036162

Please sign in to comment.