cli: Add `--config` option to `rad self`

This commit is contained in:
cloudhead 2023-08-14 14:50:45 +02:00
parent d9240c9ae9
commit a46c6ff36d
No known key found for this signature in database
2 changed files with 14 additions and 0 deletions

View File

@ -189,6 +189,12 @@ description and default branch by running:
$ rad inspect --payload $ rad inspect --payload
=== Configuration
Radicle keeps a configuration file at *~/.radicle/config.json* by default. To
display its exact location on your system, you can use the *rad self --config*
command.
=== Environment === Environment
Various environment variables are used by *rad*. Various environment variables are used by *rad*.

View File

@ -22,6 +22,7 @@ Options
--nid Show your Node ID (NID) --nid Show your Node ID (NID)
--did Show your DID --did Show your DID
--home Show your Radicle home --home Show your Radicle home
--config Show the location of your configuration file
--ssh-key Show your public key in OpenSSH format --ssh-key Show your public key in OpenSSH format
--ssh-fingerprint Show your public key fingerprint in OpenSSH format --ssh-fingerprint Show your public key fingerprint in OpenSSH format
--help Show help --help Show help
@ -34,6 +35,7 @@ enum Show {
NodeId, NodeId,
Did, Did,
Home, Home,
Config,
SshKey, SshKey,
SshFingerprint, SshFingerprint,
All, All,
@ -65,6 +67,9 @@ impl Args for Options {
Long("home") if show.is_none() => { Long("home") if show.is_none() => {
show = Some(Show::Home); show = Some(Show::Home);
} }
Long("config") if show.is_none() => {
show = Some(Show::Config);
}
Long("ssh-key") if show.is_none() => { Long("ssh-key") if show.is_none() => {
show = Some(Show::SshKey); show = Some(Show::SshKey);
} }
@ -103,6 +108,9 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
Show::Home => { Show::Home => {
term::print(profile.home().display()); term::print(profile.home().display());
} }
Show::Config => {
term::print(profile.home.config().display());
}
Show::SshKey => { Show::SshKey => {
term::print(ssh::fmt::key(profile.id())); term::print(ssh::fmt::key(profile.id()));
} }