From e806e6420b64585303e6a7a1d8688c139cbffed8 Mon Sep 17 00:00:00 2001 From: Wryhder Date: Mon, 18 Nov 2024 19:06:21 +0100 Subject: [PATCH] feat(rust): add "unsafe" tag to commands that are considered unsafe Signed-off-by: Wryhder --- implementations/rust/ockam/ockam_command/src/completion/mod.rs | 3 +++ .../rust/ockam/ockam_command/src/static/unsafe_tag.txt | 1 + .../rust/ockam/ockam_command/src/static/unsafe_tooltip.txt | 2 ++ 3 files changed, 6 insertions(+) create mode 100644 implementations/rust/ockam/ockam_command/src/static/unsafe_tag.txt create mode 100644 implementations/rust/ockam/ockam_command/src/static/unsafe_tooltip.txt diff --git a/implementations/rust/ockam/ockam_command/src/completion/mod.rs b/implementations/rust/ockam/ockam_command/src/completion/mod.rs index 669e7ec4a44..83004097297 100644 --- a/implementations/rust/ockam/ockam_command/src/completion/mod.rs +++ b/implementations/rust/ockam/ockam_command/src/completion/mod.rs @@ -7,6 +7,7 @@ use crate::{docs, OckamCommand}; const LONG_ABOUT: &str = include_str!("./static/long_about.txt"); const PREVIEW_TAG: &str = include_str!("../static/preview_tag.txt"); +const UNSAFE_TAG: &str = include_str!("../static/unsafe_tag.txt"); const AFTER_LONG_HELP: &str = include_str!("./static/after_long_help.txt"); /// Generate shell completion scripts @@ -15,6 +16,8 @@ const AFTER_LONG_HELP: &str = include_str!("./static/after_long_help.txt"); arg_required_else_help = true, long_about = docs::about(LONG_ABOUT), before_help = docs::before_help(PREVIEW_TAG), + // TODO: What's the correct way to include the unsafe tag here? + before_help = docs::before_help(UNSAFE_TAG), after_long_help = docs::after_help(AFTER_LONG_HELP) )] pub struct CompletionCommand { diff --git a/implementations/rust/ockam/ockam_command/src/static/unsafe_tag.txt b/implementations/rust/ockam/ockam_command/src/static/unsafe_tag.txt new file mode 100644 index 00000000000..2471647e634 --- /dev/null +++ b/implementations/rust/ockam/ockam_command/src/static/unsafe_tag.txt @@ -0,0 +1 @@ +[Unsafe] diff --git a/implementations/rust/ockam/ockam_command/src/static/unsafe_tooltip.txt b/implementations/rust/ockam/ockam_command/src/static/unsafe_tooltip.txt new file mode 100644 index 00000000000..087d7c5aad8 --- /dev/null +++ b/implementations/rust/ockam/ockam_command/src/static/unsafe_tooltip.txt @@ -0,0 +1,2 @@ +Unsafe features are considered dangerous and are best avoided. Use with caution if at all. +