TUI: Use rage binary in example commands if installed
This commit is contained in:
Generated
+17
@@ -64,6 +64,7 @@ dependencies = [
|
|||||||
"rand 0.7.3",
|
"rand 0.7.3",
|
||||||
"secrecy",
|
"secrecy",
|
||||||
"sha2",
|
"sha2",
|
||||||
|
"which",
|
||||||
"x509",
|
"x509",
|
||||||
"x509-parser",
|
"x509-parser",
|
||||||
"yubikey-piv",
|
"yubikey-piv",
|
||||||
@@ -353,6 +354,12 @@ dependencies = [
|
|||||||
"signature",
|
"signature",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "either"
|
||||||
|
version = "1.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "elliptic-curve"
|
name = "elliptic-curve"
|
||||||
version = "0.8.5"
|
version = "0.8.5"
|
||||||
@@ -1212,6 +1219,16 @@ version = "0.10.0+wasi-snapshot-preview1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
|
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "which"
|
||||||
|
version = "4.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b55551e42cbdf2ce2bedd2203d0cc08dba002c27510f86dab6d0ce304cba3dfe"
|
||||||
|
dependencies = [
|
||||||
|
"either",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "winapi"
|
||||||
version = "0.3.9"
|
version = "0.3.9"
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ pcsc = "2.4"
|
|||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
secrecy = "0.7"
|
secrecy = "0.7"
|
||||||
sha2 = "0.9"
|
sha2 = "0.9"
|
||||||
|
which = "4.1"
|
||||||
x509 = "0.2"
|
x509 = "0.2"
|
||||||
x509-parser = "0.9"
|
x509-parser = "0.9"
|
||||||
yubikey-piv = { version = "0.3", features = ["untested"] }
|
yubikey-piv = { version = "0.3", features = ["untested"] }
|
||||||
|
|||||||
+11
-2
@@ -551,6 +551,9 @@ fn main() -> Result<(), Error> {
|
|||||||
writeln!(file, "# Recipient: {}", recipient)?;
|
writeln!(file, "# Recipient: {}", recipient)?;
|
||||||
writeln!(file, "{}", stub.to_string())?;
|
writeln!(file, "{}", stub.to_string())?;
|
||||||
|
|
||||||
|
// If `rage` binary is installed, use it in examples. Otherwise default to `age`.
|
||||||
|
let age_binary = which::which("rage").map(|_| "rage").unwrap_or("age");
|
||||||
|
|
||||||
eprintln!();
|
eprintln!();
|
||||||
eprintln!("✅ Done! This YubiKey identity is ready to go.");
|
eprintln!("✅ Done! This YubiKey identity is ready to go.");
|
||||||
eprintln!();
|
eprintln!();
|
||||||
@@ -564,10 +567,16 @@ fn main() -> Result<(), Error> {
|
|||||||
eprintln!("Here are some example things you can do with it:");
|
eprintln!("Here are some example things you can do with it:");
|
||||||
eprintln!();
|
eprintln!();
|
||||||
eprintln!("- Encrypt a file to this identity:");
|
eprintln!("- Encrypt a file to this identity:");
|
||||||
eprintln!(" $ cat foo.txt | age -r {} -o foo.txt.age", recipient);
|
eprintln!(
|
||||||
|
" $ cat foo.txt | {} -r {} -o foo.txt.age",
|
||||||
|
age_binary, recipient
|
||||||
|
);
|
||||||
eprintln!();
|
eprintln!();
|
||||||
eprintln!("- Decrypt a file with this identity:");
|
eprintln!("- Decrypt a file with this identity:");
|
||||||
eprintln!(" $ cat foo.txt.age | age -d -i {} > foo.txt", file_name);
|
eprintln!(
|
||||||
|
" $ cat foo.txt.age | {} -d -i {} > foo.txt",
|
||||||
|
age_binary, file_name
|
||||||
|
);
|
||||||
eprintln!();
|
eprintln!();
|
||||||
eprintln!("- Recreate the identity file:");
|
eprintln!("- Recreate the identity file:");
|
||||||
eprintln!(
|
eprintln!(
|
||||||
|
|||||||
Reference in New Issue
Block a user