mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
refactor(windows): move CLI things inside client.rs (#3305)
Both modules were small, and it's inconvenient to open two files to add a new subcommand, so I want to combine them.
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use cli::CliCommands as Cmd;
|
||||
use clap::{Args, Parser};
|
||||
use std::{os::windows::process::CommandExt, process::Command};
|
||||
|
||||
mod auth;
|
||||
mod cli;
|
||||
mod crash_handling;
|
||||
mod debug_commands;
|
||||
mod deep_link;
|
||||
@@ -69,7 +67,7 @@ const CREATE_NO_WINDOW: u32 = 0x08000000;
|
||||
/// In steady state, the only processes running will be the GUI and the crash handler.
|
||||
pub(crate) fn run() -> Result<()> {
|
||||
std::panic::set_hook(Box::new(tracing_panic::panic_hook));
|
||||
let cli = cli::Cli::parse();
|
||||
let cli = Cli::parse();
|
||||
|
||||
match cli.command {
|
||||
None => {
|
||||
@@ -121,6 +119,36 @@ pub(crate) fn run() -> Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
pub struct Cli {
|
||||
#[command(subcommand)]
|
||||
pub command: Option<Cmd>,
|
||||
#[arg(long, hide = true)]
|
||||
pub crash_on_purpose: bool,
|
||||
#[arg(long, hide = true)]
|
||||
pub inject_faults: bool,
|
||||
}
|
||||
|
||||
#[derive(clap::Subcommand)]
|
||||
pub enum Cmd {
|
||||
CrashHandlerServer,
|
||||
Debug,
|
||||
DebugCrash,
|
||||
DebugHostname,
|
||||
DebugNetworkChanges,
|
||||
DebugPipeServer,
|
||||
DebugWintun,
|
||||
Elevated,
|
||||
OpenDeepLink(DeepLink),
|
||||
RegisterDeepLink,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct DeepLink {
|
||||
pub url: url::Url,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use anyhow::Result;
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
use clap::{Args, Parser};
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
pub struct Cli {
|
||||
#[command(subcommand)]
|
||||
pub command: Option<CliCommands>,
|
||||
#[arg(long, hide = true)]
|
||||
pub crash_on_purpose: bool,
|
||||
#[arg(long, hide = true)]
|
||||
pub inject_faults: bool,
|
||||
}
|
||||
|
||||
#[derive(clap::Subcommand)]
|
||||
pub enum CliCommands {
|
||||
CrashHandlerServer,
|
||||
Debug,
|
||||
DebugCrash,
|
||||
DebugHostname,
|
||||
DebugNetworkChanges,
|
||||
DebugPipeServer,
|
||||
DebugWintun,
|
||||
Elevated,
|
||||
OpenDeepLink(DeepLink),
|
||||
RegisterDeepLink,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct DeepLink {
|
||||
pub url: url::Url,
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
//! CLI subcommands used to test features / dependencies before integrating
|
||||
//! them with the GUI, or to exercise features programmatically.
|
||||
|
||||
use crate::client::cli::Cli;
|
||||
use crate::client::Cli;
|
||||
use anyhow::Result;
|
||||
use tokio::runtime::Runtime;
|
||||
use windows::Win32::System::Com::{CoInitializeEx, CoUninitialize, COINIT_MULTITHREADED};
|
||||
|
||||
Reference in New Issue
Block a user