Skip to content

Commit e098ec8

Browse files
committed
{1password,lastpass}: clear message on missing cli
1 parent 964065d commit e098ec8

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/provider/lastpass.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,15 @@ impl LastPassProvider {
2222
let mut cmd = Command::new("lpass");
2323
cmd.args(args);
2424

25-
let output = cmd.output()?;
25+
let output = match cmd.output() {
26+
Ok(output) => output,
27+
Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
28+
return Err(SecretSpecError::ProviderOperationFailed(
29+
"LastPass CLI (lpass) is not installed.\n\nTo install it:\n - macOS: brew install lastpass-cli\n - Linux: Check your package manager (apt install lastpass-cli, yum install lastpass-cli, etc.)\n - NixOS: nix-env -iA nixpkgs.lastpass-cli\n\nAfter installation, run 'lpass login <your-email>' to authenticate.".to_string(),
30+
));
31+
}
32+
Err(e) => return Err(e.into()),
33+
};
2634

2735
if !output.status.success() {
2836
let error_msg = String::from_utf8_lossy(&output.stderr);

src/provider/onepassword.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,15 @@ impl OnePasswordProvider {
6767

6868
cmd.args(args);
6969

70-
let output = cmd.output()?;
70+
let output = match cmd.output() {
71+
Ok(output) => output,
72+
Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
73+
return Err(SecretSpecError::ProviderOperationFailed(
74+
"1Password CLI (op) is not installed.\n\nTo install it:\n - macOS: brew install 1password-cli\n - Linux: Download from https://1password.com/downloads/command-line/\n - Windows: Download from https://1password.com/downloads/command-line/\n - NixOS: nix-env -iA nixpkgs.onepassword\n\nAfter installation, run 'op signin' to authenticate.".to_string(),
75+
));
76+
}
77+
Err(e) => return Err(e.into()),
78+
};
7179

7280
if !output.status.success() {
7381
let error_msg = String::from_utf8_lossy(&output.stderr);

0 commit comments

Comments
 (0)