Skip to content
This repository has been archived by the owner on May 26, 2024. It is now read-only.

Commit

Permalink
refactor(core): Fixed ascii // app name over the app
Browse files Browse the repository at this point in the history
  • Loading branch information
pwnwriter committed Nov 21, 2023
1 parent 72c6b3d commit 4a6f0ee
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 47 deletions.
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "seren"
name = "hysp"
version = "0.1.0"
edition = "2021"
authors = [ "PwnWriter < [email protected] >" ]
description = "📦 An independent package manager for the nix"
readme = "README.md"
repository = "https://github.com/pwnwriter/seren"
homepage = "https://github.com/pwnwriter/seren.git"
repository = "https://github.com/pwnwriter/hysp"
homepage = "https://github.com/pwnwriter/hysp.git"
license = "MIT"
keywords = ["package-manager", "ctf-tool-download", "pentesting", "pkgs"]
categories = ["accessibility", "web-programming", "command-line" ]
Expand Down
4 changes: 2 additions & 2 deletions src/commands/install.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::seren_helpers::RESET;
use super::hysp_helpers::RESET;
use crate::engine::parser::fetch_package_info;
use crate::engine::{check_conflicts, check_dependencies, InstallArgs};
use crate::engine::{dirs::*, print_package_info};
Expand Down Expand Up @@ -64,7 +64,7 @@ async fn download_binary(binary_url: String) -> Result<(), anyhow::Error> {
.and_then(|segments| segments.last())
.unwrap_or_default();

let file_path = SEREN_BIN_DIR.join(fname);
let file_path = HYSP_BIN_DIR.join(fname);
let mut dest = File::create(&file_path)?;

let content = response.bytes().await?;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pub mod install;
pub mod search;
pub mod uninstall;

pub mod seren_helpers {
pub mod hysp_helpers {

use tokio::fs::File;
use tokio::io::AsyncReadExt;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/search.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::commands::seren_helpers::{ASCII, BAR};
use crate::commands::hysp_helpers::{ASCII, BAR};
use crate::engine::pkg_info::available_packages::Available;
use crate::engine::{parser::build_package_toml_url, SearchArgs};
use anyhow::anyhow;
Expand Down
8 changes: 4 additions & 4 deletions src/commands/uninstall.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::commands::seren_helpers::read_local_file;
use crate::commands::hysp_helpers::read_local_file;
use crate::engine::dirs::*;
use crate::engine::essentials::print_package_info;
use crate::engine::pkg_info::PackageInfo;
Expand All @@ -21,7 +21,7 @@ pub async fn remove_pkgs(uninstall_pkgs: RemoveArgs) -> Result<(), anyhow::Error
}

pub async fn get_local_toml(pkgname: &str) -> Result<PackageInfo, anyhow::Error> {
let package_file = format!("{}/{}.toml", SEREN_DATA_DIR.to_string_lossy(), pkgname);
let package_file = format!("{}/{}.toml", HYSP_DATA_DIR.to_string_lossy(), pkgname);
let toml_text = read_local_file(&package_file)
.await
.with_context(|| format!("Failed to read TOML file: {}", package_file))?;
Expand All @@ -36,8 +36,8 @@ fn remove_binary_file(binary_name: &str) -> Result<(), anyhow::Error> {
Color::Yellow,
Streams::Stderr,
);
let bin_file_path = format!("{}/{}", SEREN_BIN_DIR.to_string_lossy(), binary_name);
let bin_data_file_path = format!("{}/{}.toml", SEREN_DATA_DIR.to_string_lossy(), binary_name);
let bin_file_path = format!("{}/{}", HYSP_BIN_DIR.to_string_lossy(), binary_name);
let bin_data_file_path = format!("{}/{}.toml", HYSP_DATA_DIR.to_string_lossy(), binary_name);
fs::remove_file(&bin_file_path)
.with_context(|| format!("Failed to remove binary file: {}", bin_file_path))?;

Expand Down
24 changes: 12 additions & 12 deletions src/engine/dirs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ pub fn get_xdg_path(key: &str, default: &str) -> PathBuf {
}

lazy_static! {
pub static ref SEREN_HOME_DIR: PathBuf = get_xdg_path("SEREN_HOME_DIR", "seren");
pub static ref SEREN_BIN_DIR: PathBuf = get_xdg_path("SEREN_BIN_DIR", "seren/bin");
pub static ref SEREN_DATA_DIR: PathBuf = get_xdg_path("SEREN_DATA_DIR", "seren/data");
pub static ref HYSP_HOME_DIR: PathBuf = get_xdg_path("HYSP_HOME_DIR", "hysp");
pub static ref HYSP_BIN_DIR: PathBuf = get_xdg_path(" HYSP_BIN_DIR", "hysp/bin");
pub static ref HYSP_DATA_DIR: PathBuf = get_xdg_path("HYSP_DATA_DIR", "hysp/data");
}

#[cfg(test)]
Expand All @@ -37,26 +37,26 @@ mod tests {
}

#[test]
fn test_seren_home_dir() {
fn test_hysp_home_dir() {
assert!(
check_path(&SEREN_HOME_DIR).is_ok(),
"SEREN_HOME_DIR does not exist or is not an absolute path"
check_path(&HYSP_HOME_DIR).is_ok(),
"HYSP_HOME_DIR does not exist or is not an absolute path"
);
}

#[test]
fn test_seren_bin_dir() {
fn test_hysp_bin_dir() {
assert!(
check_path(&SEREN_BIN_DIR).is_ok(),
"SEREN_BIN_DIR does not exist or is not an absolute path"
check_path(&HYSP_BIN_DIR).is_ok(),
"HYSP_BIN_DIR does not exist or is not an absolute path"
);
}

#[test]
fn test_seren_data_dir() {
fn test_hysp_data_dir() {
assert!(
check_path(&SEREN_DATA_DIR).is_ok(),
"SEREN_DATA_DIR does not exist or is not an absolute path"
check_path(&HYSP_DATA_DIR).is_ok(),
"HYSP_DATA_DIR does not exist or is not an absolute path"
);
}
}
2 changes: 1 addition & 1 deletion src/engine/essentials.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::engine::InstallArgs;
use crate::{
commands::seren_helpers::{ASCII, BAR},
commands::hysp_helpers::{ASCII, BAR},
engine::parser::fetch_package_info,
};
use anyhow::Result;
Expand Down
11 changes: 6 additions & 5 deletions src/engine/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use colored::Colorize;
pub static SPLASHES: &[&str] = &[
"There are reasons to use rust. - PwnWriter",
"whatsoever a man soweth, that shall he also reap. - Dylanaraps",
"Harmonizing Your System",
];

fn generate_random_number() -> usize {
Expand All @@ -23,16 +24,16 @@ pub fn show_splashes() -> String {

let logo = format!(
r#"
✮ ┓┏ ✮
┣┫┓┏┏┏┓
┛┗┗┫┛┣┛
┛ ┛ v{}
✮ ┏┓┏┓┳┓┏┓┳┓ ✮
┗┓┣ ┣┫┣ ┃┃
┗┛┗┛┛┗┗┛┛┗ v{}
"#,
app_version,
)
.bold()
.purple();
let splash = SPLASHES[rng].italic();
let splash = SPLASHES[rng].italic().white();
format!("{logo} {splash}")
}
4 changes: 2 additions & 2 deletions src/engine/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::io::prelude::*;

pub fn build_package_toml_url(pkg_name: Option<&str>) -> String {
let repo_url =
std::env::var("SEREN_REPO_URL").unwrap_or_else(|_| "metis-os/seren-pkgs".to_string());
std::env::var("SEREN_REPO_URL").unwrap_or_else(|_| "metis-os/hysp-pkgs".to_string());

let available_url = format!(
"https://raw.githubusercontent.com/{}/main/available.toml",
Expand Down Expand Up @@ -48,7 +48,7 @@ pub async fn fetch_package_info(pkg_name: &str) -> Result<PackageInfo> {
let parsed_toml: PackageInfo = toml::from_str(&toml_text)?;
// dbg!("{}", &parsed_toml);
let file_name = format!("{}.toml", pkg_name);
let data_dir = &*SEREN_DATA_DIR;
let data_dir = &*HYSP_DATA_DIR;
let file_path = data_dir.join(file_name);

let mut file = File::create(file_path)?;
Expand Down

0 comments on commit 4a6f0ee

Please sign in to comment.