Skip to content

Commit

Permalink
delete more code
Browse files Browse the repository at this point in the history
  • Loading branch information
morgante committed Aug 15, 2024
1 parent 414890b commit dabe5ad
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 42 deletions.
2 changes: 1 addition & 1 deletion crates/cli/src/commands/install.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::{bail, Result};
use anyhow::{Result};
use clap::Args;
use log::info;
use serde::Serialize;
Expand Down
1 change: 0 additions & 1 deletion crates/cli/src/updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use anyhow::{Context, Result};
use axoupdater::{AxoUpdater, ReleaseSource, ReleaseSourceType, Version};
use chrono::{DateTime, NaiveDateTime, Utc};
use colored::Colorize;
use futures_util::StreamExt;
use indicatif::ProgressBar;
use log::info;
use marzano_auth::info::AuthInfo;
Expand Down
42 changes: 2 additions & 40 deletions crates/cli/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,50 +1,12 @@
use clap::ValueEnum;

use git2::{Repository, StatusOptions};
use marzano_gritmodule::searcher::find_git_dir_from;
use serde::{Deserialize, Serialize};

use std::{
fmt::{Display, Formatter},
net::{SocketAddr, TcpListener},
path::PathBuf,
};

#[derive(Debug, PartialEq, PartialOrd, Clone, Copy, Serialize, Deserialize, ValueEnum)]
pub enum OperatingSystem {
#[serde(rename = "windows")]
Windows,
#[serde(rename = "linux")]
Linux,
#[serde(rename = "macos")]
MacOS,
}

impl Display for OperatingSystem {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
OperatingSystem::Windows => write!(f, "windows"),
OperatingSystem::Linux => write!(f, "linux"),
OperatingSystem::MacOS => write!(f, "macos"),
}
}
}

#[derive(Debug, PartialEq, PartialOrd, Clone, Copy, Serialize, Deserialize, ValueEnum)]
pub enum Architecture {
#[serde(rename = "x64")]
X64,
#[serde(rename = "arm64")]
Arm64,
}

impl Display for Architecture {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
Architecture::X64 => write!(f, "x64"),
Architecture::Arm64 => write!(f, "arm64"),
}
}
}

#[allow(dead_code)]
pub fn get_random_port() -> Option<u16> {
let listener = TcpListener::bind(SocketAddr::from(([127, 0, 0, 1], 0))).ok()?;
Expand Down

0 comments on commit dabe5ad

Please sign in to comment.