summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 08c88f5..4c528da 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -51,8 +51,17 @@ struct Cli {
enum Action {
#[command(about = "Run the experimental local chat or initialize its single .env")]
Chat {
- #[arg(long)]
+ #[arg(long, conflicts_with_all = ["reset_owner", "owner_fingerprint"])]
init: bool,
+ #[arg(
+ long,
+ value_name = "FINGERPRINT",
+ conflicts_with = "owner_fingerprint",
+ help = "Permanently clear owner registration and chat history after key loss"
+ )]
+ reset_owner: Option<String>,
+ #[arg(long, help = "Print the registered owner's public fingerprint")]
+ owner_fingerprint: bool,
},
#[command(about = "Start the local development services")]
Dev {
@@ -132,7 +141,12 @@ fn execute(arguments: Cli) -> Result<()> {
return archive::restore(&absolute(archive)?, &absolute(destination)?);
}
let project = Project::discover(arguments.root.as_deref())?;
- if let Action::Chat { init } = arguments.command {
+ if let Action::Chat {
+ init,
+ reset_owner,
+ owner_fingerprint,
+ } = arguments.command
+ {
let mut command = project.command("cargo")?;
command
.args(["run", "--locked", "-p", "stack-chat-server", "--", "--root"])
@@ -140,6 +154,12 @@ fn execute(arguments: Cli) -> Result<()> {
if init {
command.arg("--init");
}
+ if let Some(fingerprint) = reset_owner {
+ command.arg("--reset-owner").arg(fingerprint);
+ }
+ if owner_fingerprint {
+ command.arg("--owner-fingerprint");
+ }
return process::run(&mut command);
}
let _operation = project.lock()?;