Fetch User Keys - simple tool for fetching SSH keys from various sources
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

ft: add SSH authorized_keys output format

+18 -3
+16 -1
cli/src/output/mod.rs
··· 10 10 JSON, 11 11 TOML, 12 12 CSV, 13 + SSH, 13 14 } 14 15 15 16 impl Format { ··· 20 21 writeln!(w, "") 21 22 } 22 23 Format::TOML => write!(w, "{}", toml::to_string_pretty(&output.keys).unwrap()), 23 - Format::CSV => as_csv(w, &output), 24 + Format::CSV => as_csv(w, output), 25 + Format::SSH => authorized_keys(w, output), 24 26 } 25 27 } 26 28 } ··· 31 33 Format::JSON => f.write_str("json"), 32 34 Format::TOML => f.write_str("toml"), 33 35 Format::CSV => f.write_str("csv"), 36 + Format::SSH => f.write_str("ssh"), 34 37 } 35 38 } 36 39 } ··· 41 44 "json" => Format::JSON, 42 45 "toml" => Format::TOML, 43 46 "csv" => Format::CSV, 47 + "ssh" => Format::SSH, 44 48 _ => unreachable!(), 45 49 } 46 50 } ··· 61 65 62 66 Ok(()) 63 67 } 68 + 69 + fn authorized_keys<W: Write>(w: &mut W, output: &Output) -> io::Result<()> { 70 + for (name, keys) in &output.keys { 71 + for key in keys { 72 + let commented = ssh_key::PublicKey::new(key.key_data().clone(), name); 73 + writeln!(w, "{}", commented.to_string())?; 74 + } 75 + } 76 + 77 + Ok(()) 78 + }
+2 -2
docs/fuk.1.scd
··· 8 8 9 9 *fuk* -h++ 10 10 *fuk* --help++ 11 - *fuk* [--format (json|toml|csv)] _config.toml_ 11 + *fuk* [--format (json|toml|csv|ssh)] _config.toml_ 12 12 13 13 # DESCRIPTION 14 14 ··· 74 74 equality. If comments for duplicated keys are different, then there is no 75 75 guarantee about comment content. 76 76 77 - Possible formats - JSON, TOML, CSV. 77 + Possible formats - JSON, TOML, CSV, SSH authorized_keys. 78 78 79 79 Example output: 80 80