diff options
| author | Naz <ndpm13@ch-naseem.com> | 2025-08-08 15:52:51 +0100 |
|---|---|---|
| committer | Naz <ndpm13@ch-naseem.com> | 2025-08-08 15:52:51 +0100 |
| commit | b0d4e60e525e2438e02fa3e3b5ffaba374a03a71 (patch) | |
| tree | b9a637848f690de879dd11dd6f667a52c49c3a6f /src/appimage.rs | |
| parent | 32bda21c93754359335f8826b5edf931d551d2e8 (diff) | |
🔧refactor: move AppImage construction logic to new() method
Diffstat (limited to 'src/appimage.rs')
| -rw-r--r-- | src/appimage.rs | 25 |
1 files changed, 25 insertions, 0 deletions
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(), + }, + }, + } + } +} |
