Skip to content

Commit 25d2507

Browse files
committed
fix: local/remote individual services
1 parent aac1a2a commit 25d2507

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

linkup-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "linkup-cli"
3-
version = "1.1.0"
3+
version = "1.1.1"
44
edition = "2021"
55

66
[[bin]]

linkup-cli/src/remote_local.rs

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,18 @@ pub fn remote(service_names: &[String], all: bool) -> Result<(), CliError> {
1515

1616
let mut state = LocalState::load()?;
1717

18-
for service in state.services.iter_mut() {
19-
if all {
18+
if all {
19+
for service in state.services.iter_mut() {
2020
service.current = ServiceTarget::Remote;
21-
continue;
2221
}
23-
24-
if service_names.contains(&service.name) {
22+
} else {
23+
for service_name in service_names {
24+
let service = state
25+
.services
26+
.iter_mut()
27+
.find(|s| s.name.as_str() == service_name)
28+
.ok_or_else(|| CliError::NoSuchService(service_name.to_string()))?;
2529
service.current = ServiceTarget::Remote;
26-
} else {
27-
return Err(CliError::NoSuchService(service.name.clone()));
2830
}
2931
}
3032

@@ -52,16 +54,18 @@ pub fn local(service_names: &[String], all: bool) -> Result<(), CliError> {
5254

5355
let mut state = LocalState::load()?;
5456

55-
for service in state.services.iter_mut() {
56-
if all {
57+
if all {
58+
for service in state.services.iter_mut() {
5759
service.current = ServiceTarget::Local;
58-
continue;
5960
}
60-
61-
if service_names.contains(&service.name) {
61+
} else {
62+
for service_name in service_names {
63+
let service = state
64+
.services
65+
.iter_mut()
66+
.find(|s| s.name.as_str() == service_name)
67+
.ok_or_else(|| CliError::NoSuchService(service_name.to_string()))?;
6268
service.current = ServiceTarget::Local;
63-
} else {
64-
return Err(CliError::NoSuchService(service.name.clone()));
6569
}
6670
}
6771

0 commit comments

Comments
 (0)