From b0d4e60e525e2438e02fa3e3b5ffaba374a03a71 Mon Sep 17 00:00:00 2001 From: Naz Date: Fri, 8 Aug 2025 15:52:51 +0100 Subject: =?UTF-8?q?=F0=9F=94=A7refactor:=20move=20AppImage=20construction?= =?UTF-8?q?=20logic=20to=20new()=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/appimage.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/appimage.rs') diff --git a/src/appimage.rs b/src/appimage.rs index 5d0f8e5..c3f61b1 100644 --- a/src/appimage.rs +++ b/src/appimage.rs @@ -1,6 +1,8 @@ use serde::{Deserialize, Serialize}; use std::path::PathBuf; +use crate::InstallArgs; + #[derive(Debug, Serialize, Deserialize)] pub struct AppImage { pub file_path: PathBuf, @@ -18,3 +20,26 @@ pub struct Source { pub struct SourceMetadata { pub url: String, } + +impl AppImage { + pub fn new(options: &InstallArgs) -> Self { + Self { + file_path: PathBuf::new(), + executable: options + .executable + .as_ref() + .unwrap_or(&options.appname) + .to_string(), + source: Source { + identifier: if options.github { + "git.github".to_string() + } else { + "raw_url".to_string() + }, + meta: SourceMetadata { + url: options.from.clone(), + }, + }, + } + } +} -- cgit v1.2.3