Added command 'offline'

This commit is contained in:
Mike Dilger 2024-03-13 08:17:29 +13:00
parent 7ba455d1f9
commit 3e882b7416

View File

@ -29,7 +29,7 @@ impl Command {
}
}
const COMMANDS: [Command; 29] = [
const COMMANDS: [Command; 30] = [
Command {
cmd: "oneshot",
usage_params: "{depends}",
@ -105,6 +105,11 @@ const COMMANDS: [Command; 29] = [
usage_params: "",
desc: "login on the command line before starting the gossip GUI",
},
Command {
cmd: "offline",
usage_params: "",
desc: "login on the command line before starting the gossip GUI",
},
Command {
cmd: "print_event",
usage_params: "<idhex>",
@ -212,6 +217,10 @@ pub fn handle_command(mut args: env::Args, runtime: &Runtime) -> Result<bool, Er
login()?;
return Ok(false);
}
"offline" => {
offline()?;
return Ok(false);
}
"print_event" => print_event(command, args)?,
"print_followed" => print_followed(command)?,
"print_muted" => print_muted(command)?,
@ -934,3 +943,8 @@ pub fn login() -> Result<(), Error> {
}
Ok(())
}
pub fn offline() -> Result<(), Error> {
GLOBALS.storage.write_setting_offline(&true, None)?;
Ok(())
}