Skip to content

Commit

Permalink
Update CLI docs to use i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeltlombardi committed Oct 29, 2024
1 parent 6f45c26 commit f1a1fcc
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 26 deletions.
81 changes: 81 additions & 0 deletions registry/locales/cli.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
52 changes: 26 additions & 26 deletions registry/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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<String>,
#[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<String>,
#[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,
Expand Down

0 comments on commit f1a1fcc

Please sign in to comment.