separate dev and production instances and add visual indicators of dev mode
This commit is contained in:
		@@ -102,7 +102,7 @@ pub struct ExecArgs {
 | 
			
		||||
#[derive(Debug, Args)]
 | 
			
		||||
pub struct InvokeArgs {
 | 
			
		||||
    #[arg(value_name = "ACTION", value_enum)]
 | 
			
		||||
    shortcut_action: ShortcutAction,
 | 
			
		||||
    pub shortcut_action: ShortcutAction,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,12 @@
 | 
			
		||||
mod cli;
 | 
			
		||||
pub use cli::{
 | 
			
		||||
    Cli,
 | 
			
		||||
    Action,
 | 
			
		||||
    Cli,
 | 
			
		||||
    docker_credential_helper,
 | 
			
		||||
    exec,
 | 
			
		||||
    get,
 | 
			
		||||
    GlobalArgs,
 | 
			
		||||
    invoke_shortcut,
 | 
			
		||||
    docker_credential_helper,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
pub(crate) use platform::connect;
 | 
			
		||||
@@ -14,13 +15,20 @@ pub use platform::server_addr;
 | 
			
		||||
pub mod proto;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
pub fn show_window(global_args: GlobalArgs) -> anyhow::Result<()> {
 | 
			
		||||
    let invoke = cli::InvokeArgs { shortcut_action: proto::ShortcutAction::ShowWindow };
 | 
			
		||||
    cli::invoke_shortcut(invoke, global_args)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#[cfg(unix)]
 | 
			
		||||
mod platform {
 | 
			
		||||
    use std::path::PathBuf;
 | 
			
		||||
    use tokio::net::UnixStream;
 | 
			
		||||
 | 
			
		||||
    pub async fn connect(addr: Option<PathBuf>) -> Result<UnixStream, std::io::Error> {
 | 
			
		||||
        let path = addr.unwrap_or_else(|| server_addr("creddy-server"));
 | 
			
		||||
        let default = if cfg!(debug_assertions) { "creddy-server-dev" } else { "creddy-server" };
 | 
			
		||||
        let path = addr.unwrap_or_else(|| server_addr(default));
 | 
			
		||||
        UnixStream::connect(&path).await
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user