Skip to content

Commit

Permalink
Improve output ref parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
lucperkins committed Jul 25, 2024
1 parent 5c5073d commit 8dd7d2a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/cli/cmd/apply/home_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ fn parse_output_ref(output_ref: &str) -> Result<String, FhError> {

Ok(match output_ref.split('#').collect::<Vec<_>>()[..] {
[_release, _output_path] => parse_release_ref(output_ref)?,
[release] => format!("{release}#homeConfigurations.{username}"),
[release] => format!(
"{}#homeConfigurations.{username}",
parse_release_ref(release)?
),
_ => return Err(FhError::MalformedOutputRef(output_ref.to_string())),
})
}
Expand Down
5 changes: 4 additions & 1 deletion src/cli/cmd/apply/nix_darwin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ fn parse_output_ref(output_ref: &str) -> Result<String, FhError> {

Ok(match output_ref.split('#').collect::<Vec<_>>()[..] {
[_release, _output_path] => parse_release_ref(output_ref)?,
[release] => format!("{release}#darwinConfigurations.{devicename}.system"),
[release] => format!(
"{}#darwinConfigurations.{devicename}.system",
parse_release_ref(release)?
),
_ => return Err(FhError::MalformedOutputRef(output_ref.to_string())),
})
}
Expand Down
5 changes: 4 additions & 1 deletion src/cli/cmd/apply/nixos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ fn parse_output_ref(output_ref: &str) -> Result<String, FhError> {

Ok(match output_ref.split('#').collect::<Vec<_>>()[..] {
[_release, _output_path] => parse_release_ref(output_ref)?,
[release] => format!("{release}#nixosConfigurations.{hostname}"),
[release] => format!(
"{}#nixosConfigurations.{hostname}",
parse_release_ref(release)?
),
_ => return Err(FhError::MalformedOutputRef(output_ref.to_string())),
})
}
Expand Down

0 comments on commit 8dd7d2a

Please sign in to comment.