Merge pull request #454 from kinode-dao/dr/terminal-detach

terminal: detach actually detaches
This commit is contained in:
doria 2024-07-20 02:35:35 +09:00 committed by GitHub
commit b44bd36a57
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 702 additions and 536 deletions

View File

@ -77,14 +77,12 @@ async fn main() {
let rpc = matches.get_one::<String>("rpc");
let password = matches.get_one::<String>("password");
// if we are in sim-mode, detached determines whether terminal is interactive
#[cfg(not(feature = "simulation-mode"))]
let is_detached = false;
// detached determines whether terminal is interactive
let is_detached = *matches.get_one::<bool>("detached").unwrap();
#[cfg(feature = "simulation-mode")]
let (fake_node_name, is_detached, fakechain_port) = (
let (fake_node_name, fakechain_port) = (
matches.get_one::<String>("fake-node-name"),
*matches.get_one::<bool>("detached").unwrap(),
matches.get_one::<u16>("fakechain-port").cloned(),
);
@ -654,6 +652,10 @@ fn build_command() -> Command {
.default_value("true")
.value_parser(value_parser!(bool)),
)
.arg(
arg!(--detached <IS_DETACHED> "Run in detached mode (don't accept input)")
.action(clap::ArgAction::SetTrue),
)
.arg(arg!(--rpc <RPC> "Add a WebSockets RPC URL at boot"))
.arg(arg!(--password <PASSWORD> "Node password (in double quotes)"));
@ -663,10 +665,6 @@ fn build_command() -> Command {
.arg(
arg!(--"fakechain-port" <FAKECHAIN_PORT> "Port to bind to for fakechain")
.value_parser(value_parser!(u16)),
)
.arg(
arg!(--detached <IS_DETACHED> "Run in detached mode (don't accept input)")
.action(clap::ArgAction::SetTrue),
);
app
}

File diff suppressed because it is too large Load Diff

View File

@ -63,6 +63,7 @@ pub fn startup(
,/ /` `
.*`
networking public key: {}
{}
"#,
our.name,
if our.is_direct() {
@ -72,6 +73,7 @@ pub fn startup(
},
version,
our.networking_key,
if is_detached { "(detached)" } else { "" }
)),
crossterm::style::ResetColor
)
@ -95,6 +97,7 @@ pub fn startup(
version {}
a general purpose sovereign cloud computer
net pubkey: {}
{}
"#,
our.name,
if our.is_direct() {
@ -104,6 +107,7 @@ pub fn startup(
},
version,
our.networking_key,
if is_detached { "(detached)" } else { "" }
)),
crossterm::style::ResetColor
)?;