Skip to content

Commit 481cdfd

Browse files
Merge pull request #1 from sensmetry/ci/fix-failing-tests
ci: fix failing tests.
2 parents fae7976 + 32b026f commit 481cdfd

3 files changed

Lines changed: 35 additions & 4 deletions

File tree

sysand/src/cli.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,23 @@ pub enum Command {
6767
/// Do not try to normalise the IRI/URI when resolving
6868
#[arg(long, default_value = "false", visible_alias = "no-normalize")]
6969
no_normalise: bool,
70+
/// Use an index when resolving this usage
7071
#[arg(long, default_value = Some(DEFAULT_INDEX_URL))]
7172
use_index: Option<String>,
73+
/// Do not use any index when resolving this usage
74+
#[arg(long, default_value = "false", conflicts_with = "use_index")]
75+
no_index: bool,
7276
// TODO: Add various options, such as whether to take local environment
7377
// into consideration
7478
},
7579
/// Update lockfile
7680
Lock {
81+
/// Use an index when updating the lockfile
7782
#[arg(long, default_value = Some(DEFAULT_INDEX_URL))]
7883
use_index: Option<String>,
84+
/// Do not use any index when updating the lockfile
85+
#[arg(long, default_value = "false", conflicts_with = "use_index")]
86+
no_index: bool,
7987
},
8088
/// Add usage to project information
8189
Add {
@@ -92,6 +100,9 @@ pub enum Command {
92100
/// Use an index when resolving this usage
93101
#[arg(long, default_value = Some(DEFAULT_INDEX_URL))]
94102
use_index: Option<String>,
103+
/// Do not use any index when resolving this usage
104+
#[arg(long, default_value = "false", conflicts_with = "use_index")]
105+
no_index: bool,
95106
},
96107
/// Remove usage from project information
97108
Remove {

sysand/src/lib.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,13 @@ pub fn run_cli(args: cli::Args) -> Result<()> {
122122
no_deps,
123123
}) => command_sources_env(iri, version, !no_deps, current_environment),
124124
},
125-
cli::Command::Lock { use_index } => {
125+
cli::Command::Lock {
126+
mut use_index,
127+
no_index,
128+
} => {
129+
if no_index {
130+
use_index = None;
131+
}
126132
if let Some(path) = project_root {
127133
crate::commands::lock::command_lock(path, client, use_index)
128134
} else {
@@ -153,8 +159,12 @@ pub fn run_cli(args: cli::Args) -> Result<()> {
153159
auto,
154160
location,
155161
no_normalise,
156-
use_index,
162+
mut use_index,
163+
no_index,
157164
} => {
165+
if no_index {
166+
use_index = None;
167+
}
158168
match location {
159169
Some(actual_location) => {
160170
if iri {
@@ -195,8 +205,12 @@ pub fn run_cli(args: cli::Args) -> Result<()> {
195205
versions_constraint,
196206
no_lock,
197207
no_sync,
198-
use_index,
208+
mut use_index,
209+
no_index,
199210
} => {
211+
if no_index {
212+
use_index = None;
213+
}
200214
command_add(iri, versions_constraint, current_project)?;
201215

202216
if !no_lock {

sysand/tests/cli_source.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ fn list_sources() -> Result<(), Box<dyn std::error::Error>> {
4747

4848
let out = run_sysand_in(
4949
&path,
50-
&vec!["add", "--no-sync", "urn:kpar:list_sources_dep"],
50+
&vec![
51+
"add",
52+
"--no-sync",
53+
"urn:kpar:list_sources_dep",
54+
"--no-index",
55+
"--verbose",
56+
],
5157
None,
5258
)?;
5359
out.assert().success();

0 commit comments

Comments
 (0)