From f1a1fccd8e6ffa8f2296160663ca663435e5ae31 Mon Sep 17 00:00:00 2001 From: Mikey Lombardi Date: Thu, 24 Oct 2024 15:55:57 -0500 Subject: [PATCH] Update CLI docs to use i18n --- registry/locales/cli.yml | 81 ++++++++++++++++++++++++++++++++++++++++ registry/src/args.rs | 52 +++++++++++++------------- 2 files changed, 107 insertions(+), 26 deletions(-) diff --git a/registry/locales/cli.yml b/registry/locales/cli.yml index 638bc890..ae97ad82 100644 --- a/registry/locales/cli.yml +++ b/registry/locales/cli.yml @@ -1,5 +1,86 @@ _version: 2 cli: + about: + en: Manage state of Windows registry + # config command help + config: + about: + en: Manage registry configuration. + args: + input: + help: + en: The registry JSON input. + what_if: + help: + en: Run as a what-if operation instead of applying the registry configuration. + get: + about: + en: Retrieve registry configuration. + set: + about: + en: Apply registry configuration. + delete: + about: + en: Delete registry configuration. + # query command help + query: + about: + en: Query a registry key or value. + args: + key_path: + help: + en: The registry key path to query. + value_name: + help: + en: The name of the value to query. + recurse: + help: + en: Recursively query subkeys. + # set command help + set: + about: + en: Set a registry key or value. + args: + key_path: + help: + en: The registry key path to set. + value: + help: + en: The value to set. + # remove command help + remove: + about: + en: Remove a registry key or value. + args: + key_path: + help: + en: The registry key path to remove. + value_name: + help: + en: The name of the value to remove. + recurse: + help: + en: Recursively remove subkeys. + # find command help + find: + about: + en: Find a registry key or value. + args: + key_path: + help: + en: The registry key path to start find. + find: + help: + en: The string to find. + recurse: + help: + en: Recursively find. + keys_only: + help: + en: Only find keys. + values_only: + help: + en: Only find values. # schema command help schema: about: diff --git a/registry/src/args.rs b/registry/src/args.rs index 96c498f7..0104ac8b 100644 --- a/registry/src/args.rs +++ b/registry/src/args.rs @@ -4,7 +4,7 @@ use clap::{Parser, Subcommand}; #[derive(Parser)] -#[clap(name = "registry", version = "0.0.1", about = "Manage state of Windows registry", long_about = None)] +#[clap(name = "registry", version = "0.0.1", about = t!("cli.about").to_string(), long_about = None)] pub struct Arguments { #[clap(subcommand)] @@ -13,66 +13,66 @@ pub struct Arguments { #[derive(Debug, PartialEq, Eq, Subcommand)] pub enum ConfigSubCommand { - #[clap(name = "get", about = "Retrieve registry configuration.")] + #[clap(name = "get", about = t!("cli.config.get.about").to_string())] Get { - #[clap(short, long, required = true, help = "The registry JSON input.")] + #[clap(short, long, required = true, help = t!("cli.config.args.input.help").to_string())] input: String, }, - #[clap(name = "set", about = "Apply registry configuration.")] + #[clap(name = "set", about = t!("cli.config.set.about").to_string())] Set { - #[clap(short, long, required = true, help = "The registry JSON input.")] + #[clap(short, long, required = true, help = t!("cli.config.args.input.help").to_string())] input: String, - #[clap(short = 'w', long, help = "Run as a what-if operation instead of applying the registry configuration")] + #[clap(short = 'w', long, help = t!("cli.config.args.what_if.help").to_string())] what_if: bool, }, - #[clap(name = "delete", about = "Delete registry configuration.")] + #[clap(name = "delete", about = t!("cli.config.delete.about").to_string())] Delete { - #[clap(short, long, required = true, help = "The registry JSON input.")] + #[clap(short, long, required = true, help = t!("cli.config.args.input.help").to_string())] input: String, }, } #[derive(Debug, PartialEq, Eq, Subcommand)] pub enum SubCommand { - #[clap(name = "query", about = "Query a registry key or value.", arg_required_else_help = true)] + #[clap(name = "query", about = t!("cli.query.about").to_string(), arg_required_else_help = true)] Query { - #[clap(short, long, required = true, help = "The registry key path to query.")] + #[clap(short, long, required = true, help = t!("cli.query.args.key_path.help").to_string())] key_path: String, - #[clap(short, long, help = "The name of the value to query.")] + #[clap(short, long, help = t!("cli.query.args.value_name.help").to_string())] value_name: Option, - #[clap(short, long, help = "Recursively query subkeys.")] + #[clap(short, long, help = t!("cli.query.args.recurse.help").to_string())] recurse: bool, }, - #[clap(name = "set", about = "Set a registry key or value.")] + #[clap(name = "set", about = t!("cli.set.about").to_string())] Set { - #[clap(short, long, required = true, help = "The registry key path to set.")] + #[clap(short, long, required = true, help = t!("cli.set.args.key_path.help").to_string())] key_path: String, - #[clap(short, long, help = "The value to set.")] + #[clap(short, long, help = t!("cli.set.args.value.help").to_string())] value: String, }, - #[clap(name = "remove", about = "Remove a registry key or value.", arg_required_else_help = true)] + #[clap(name = "remove", about = t!("cli.remove.about").to_string(), arg_required_else_help = true)] Remove { - #[clap(short, long, required = true, help = "The registry key path to remove.")] + #[clap(short, long, required = true, help = t!("cli.remove.args.key_path.help").to_string())] key_path: String, - #[clap(short, long, help = "The name of the value to remove.")] + #[clap(short, long, help = t!("cli.remove.args.value_name.help").to_string())] value_name: Option, - #[clap(short, long, help = "Recursively remove subkeys.")] + #[clap(short, long, help = t!("cli.remove.args.recurse.help").to_string())] recurse: bool, }, - #[clap(name = "find", about = "Find a registry key or value.", arg_required_else_help = true)] + #[clap(name = "find", about = t!("cli.find.about").to_string(), arg_required_else_help = true)] Find { - #[clap(short, long, required = true, help = "The registry key path to start find.")] + #[clap(short, long, required = true, help = t!("cli.find.args.key_path.help").to_string())] key_path: String, - #[clap(short, long, required = true, help = "The string to find.")] + #[clap(short, long, required = true, help = t!("cli.find.args.find.help").to_string())] find: String, - #[clap(short, long, help = "Recursively find.")] + #[clap(short, long, help = t!("cli.find.args.recurse.help").to_string())] recurse: bool, - #[clap(long, help = "Only find keys.")] + #[clap(long, help = t!("cli.find.args.keys_only.help").to_string())] keys_only: bool, - #[clap(long, help = "Only find values.")] + #[clap(long, help = t!("cli.find.args.values_only.help").to_string())] values_only: bool, }, - #[clap(name = "config", about = "Manage registry configuration.", arg_required_else_help = true)] + #[clap(name = "config", about = t!("cli.config.about").to_string(), arg_required_else_help = true)] Config { #[clap(subcommand)] subcommand: ConfigSubCommand,