From d827ef738eb873d7d39c12b6e0fb966ae9724110 Mon Sep 17 00:00:00 2001 From: Wryhder Date: Tue, 12 Nov 2024 02:54:56 +0100 Subject: [PATCH] docs(rust): update CLI documentation for the `status` and `reset` commands Signed-off-by: Wryhder --- .../ockam_command/src/{reset.rs => reset/mod.rs} | 8 ++++++++ .../src/reset/static/after_long_help.txt | 13 +++++++++++++ .../ockam_command/src/reset/static/long_about.txt | 5 +++++ .../ockam_command/src/{status.rs => status/mod.rs} | 11 ++++++++++- .../src/status/static/after_long_help.txt | 4 ++++ .../ockam_command/src/status/static/long_about.txt | 3 +++ 6 files changed, 43 insertions(+), 1 deletion(-) rename implementations/rust/ockam/ockam_command/src/{reset.rs => reset/mod.rs} (93%) create mode 100644 implementations/rust/ockam/ockam_command/src/reset/static/after_long_help.txt create mode 100644 implementations/rust/ockam/ockam_command/src/reset/static/long_about.txt rename implementations/rust/ockam/ockam_command/src/{status.rs => status/mod.rs} (95%) create mode 100644 implementations/rust/ockam/ockam_command/src/status/static/after_long_help.txt create mode 100644 implementations/rust/ockam/ockam_command/src/status/static/long_about.txt diff --git a/implementations/rust/ockam/ockam_command/src/reset.rs b/implementations/rust/ockam/ockam_command/src/reset/mod.rs similarity index 93% rename from implementations/rust/ockam/ockam_command/src/reset.rs rename to implementations/rust/ockam/ockam_command/src/reset/mod.rs index 1b4dc6291ee..2a26b5a7f67 100644 --- a/implementations/rust/ockam/ockam_command/src/reset.rs +++ b/implementations/rust/ockam/ockam_command/src/reset/mod.rs @@ -12,10 +12,18 @@ use ockam_api::terminal::ConfirmResult; use ockam_api::{color, fmt_ok, CliState}; use ockam_node::Context; +use crate::docs; use crate::util::async_cmd; +const LONG_ABOUT: &str = include_str!("./static/long_about.txt"); +const AFTER_LONG_HELP: &str = include_str!("./static/after_long_help.txt"); + /// Removes the local Ockam configuration including all Identities and Nodes #[derive(Clone, Debug, Args)] +#[command( + long_about = docs::about(LONG_ABOUT), + after_long_help = docs::after_help(AFTER_LONG_HELP) +)] pub struct ResetCommand { /// Confirm the reset without prompting #[arg(long, short)] diff --git a/implementations/rust/ockam/ockam_command/src/reset/static/after_long_help.txt b/implementations/rust/ockam/ockam_command/src/reset/static/after_long_help.txt new file mode 100644 index 00000000000..7096421a60b --- /dev/null +++ b/implementations/rust/ockam/ockam_command/src/reset/static/after_long_help.txt @@ -0,0 +1,13 @@ +```sh +# Removes the local Ockam configuration including all Identities and Nodes. +# This will prompt you for confirmation before proceeding. +$ ockam reset + +# Removes orchestrator resources (i.e. Spaces and Projects) +# in addition to deleting the local state. +# This will prompt you for confirmation before proceeding. +$ ockam reset -all + +# To confirm without prompting. +$ ockam reset -y +``` \ No newline at end of file diff --git a/implementations/rust/ockam/ockam_command/src/reset/static/long_about.txt b/implementations/rust/ockam/ockam_command/src/reset/static/long_about.txt new file mode 100644 index 00000000000..9bfadcbb5f3 --- /dev/null +++ b/implementations/rust/ockam/ockam_command/src/reset/static/long_about.txt @@ -0,0 +1,5 @@ +WARNING: + +The `reset` command is dangerous and should be used with caution as it will remove all local state PERMANENTLY. This behaviour can be useful for cleaning up your development environment and starting afresh from scratch. However, you'll typically want to use specific delete commands such as `node delete`, `identity delete`, and `space delete` for more granular control on deletes. + +Note that running `reset` will also sign you out of your Ockam account. You can sign in again and reactivate your machine with `ockam enroll`. \ No newline at end of file diff --git a/implementations/rust/ockam/ockam_command/src/status.rs b/implementations/rust/ockam/ockam_command/src/status/mod.rs similarity index 95% rename from implementations/rust/ockam/ockam_command/src/status.rs rename to implementations/rust/ockam/ockam_command/src/status/mod.rs index a38c30f303c..a2907e61253 100644 --- a/implementations/rust/ockam/ockam_command/src/status.rs +++ b/implementations/rust/ockam/ockam_command/src/status/mod.rs @@ -22,8 +22,17 @@ use ockam_api::nodes::{BackgroundNodeClient, InMemoryNode}; use ockam_api::output::Output; use ockam_api::{fmt_heading, fmt_log, fmt_separator, fmt_warn}; -/// Display information about the system's status +use crate::docs; + +const LONG_ABOUT: &str = include_str!("./static/long_about.txt"); +const AFTER_LONG_HELP: &str = include_str!("./static/after_long_help.txt"); + +/// Display information about your Ockam instance #[derive(Clone, Debug, Args)] +#[command( + long_about = docs::about(LONG_ABOUT), + after_long_help = docs::after_help(AFTER_LONG_HELP) +)] pub struct StatusCommand { #[command(flatten)] timeout: TimeoutArg, diff --git a/implementations/rust/ockam/ockam_command/src/status/static/after_long_help.txt b/implementations/rust/ockam/ockam_command/src/status/static/after_long_help.txt new file mode 100644 index 00000000000..38a7cab1437 --- /dev/null +++ b/implementations/rust/ockam/ockam_command/src/status/static/after_long_help.txt @@ -0,0 +1,4 @@ +```sh +# Display information about your Ockam instance and your Orchestrator resources. +$ ockam status +``` \ No newline at end of file diff --git a/implementations/rust/ockam/ockam_command/src/status/static/long_about.txt b/implementations/rust/ockam/ockam_command/src/status/static/long_about.txt new file mode 100644 index 00000000000..f92dbcb8e82 --- /dev/null +++ b/implementations/rust/ockam/ockam_command/src/status/static/long_about.txt @@ -0,0 +1,3 @@ +This command shows information such as the current version of Ockam in use, the Ockam Orchestrator and Project versions, as well as your Spaces and the users associated with them. +It also lists any cryptographic Identities stored in your vault and their enrollment status with the Ockam Orchestrator. +Additionally, it shows a quick overview of any available Nodes: their status, associated routes and protocols, listeners and services, and more. \ No newline at end of file