summaryrefslogtreecommitdiff
path: root/src/appimage.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/appimage.rs')
-rw-r--r--src/appimage.rs25
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(),
+ },
+ },
+ }
+ }
+}