From c829045b8dd3db49fa4b2732a04cd165d6bda2e3 Mon Sep 17 00:00:00 2001 From: xphoniex Date: Tue, 8 Nov 2022 11:05:25 +0100 Subject: [PATCH] Add `rad-self` command Signed-off-by: xphoniex --- radicle-cli/src/commands.rs | 14 ++-- radicle-cli/src/commands/help.rs | 15 ++-- radicle-cli/src/commands/self.rs | 113 +++++++++++++++++++++++++++++++ radicle-cli/src/main.rs | 13 ++-- 4 files changed, 142 insertions(+), 13 deletions(-) create mode 100644 radicle-cli/src/commands/self.rs diff --git a/radicle-cli/src/commands.rs b/radicle-cli/src/commands.rs index 019c7bbb..64e5cf32 100644 --- a/radicle-cli/src/commands.rs +++ b/radicle-cli/src/commands.rs @@ -1,4 +1,10 @@ -pub mod auth; -pub mod checkout; -pub mod help; -pub mod init; +#[path = "commands/auth.rs"] +pub mod rad_auth; +#[path = "commands/checkout.rs"] +pub mod rad_checkout; +#[path = "commands/help.rs"] +pub mod rad_help; +#[path = "commands/init.rs"] +pub mod rad_init; +#[path = "commands/self.rs"] +pub mod rad_self; diff --git a/radicle-cli/src/commands/help.rs b/radicle-cli/src/commands/help.rs index 4192a37a..30e442b5 100644 --- a/radicle-cli/src/commands/help.rs +++ b/radicle-cli/src/commands/help.rs @@ -3,9 +3,10 @@ use std::ffi::OsString; use crate::terminal as term; use crate::terminal::args::{Args, Error, Help}; -use super::auth as rad_auth; -use super::checkout as rad_checkout; -use super::init as rad_init; +use super::rad_auth; +use super::rad_checkout; +use super::rad_init; +use super::rad_self; pub const HELP: Help = Help { name: "help", @@ -14,7 +15,13 @@ pub const HELP: Help = Help { usage: "Usage: rad help [--help]", }; -const COMMANDS: &[Help] = &[rad_auth::HELP, rad_init::HELP, rad_checkout::HELP, HELP]; +const COMMANDS: &[Help] = &[ + rad_auth::HELP, + rad_init::HELP, + rad_checkout::HELP, + rad_self::HELP, + HELP, +]; #[derive(Default)] pub struct Options {} diff --git a/radicle-cli/src/commands/self.rs b/radicle-cli/src/commands/self.rs new file mode 100644 index 00000000..b02a0200 --- /dev/null +++ b/radicle-cli/src/commands/self.rs @@ -0,0 +1,113 @@ +use std::ffi::OsString; + +use radicle::crypto::ssh; +use radicle::Profile; + +use crate::terminal as term; +use crate::terminal::args::{Args, Error, Help}; + +pub const HELP: Help = Help { + name: "self", + description: "Show information about your radicle identity and device", + version: env!("CARGO_PKG_VERSION"), + usage: r#" +Usage + + rad self [