diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/args.rs | 29 | ||||
| -rw-r--r-- | src/lib.rs | 7 | ||||
| -rw-r--r-- | src/types.rs | 20 |
3 files changed, 55 insertions, 1 deletions
diff --git a/src/args.rs b/src/args.rs new file mode 100644 index 0000000..274bb1e --- /dev/null +++ b/src/args.rs @@ -0,0 +1,29 @@ +use clap::{Args, Parser, Subcommand}; + +/// A command line interface to install AppImages +#[derive(Debug, Parser)] +#[command(version, about, long_about = None)] +pub struct Cli { + #[command(subcommand)] + pub command: Command, +} + +#[derive(Debug, Subcommand)] +pub enum Command { + /// Installs an AppImage + #[command(name = "install", alias = "i")] + Install(InstallArgs), +} + +#[derive(Debug, Args)] +pub struct InstallArgs { + pub appname: String, + + /// Provide a repository slug, or a direct URL to an appimage. + #[arg(long)] + pub from: String, + + /// Name of the executable + #[arg(long)] + pub executable: Option<String>, +} @@ -1,5 +1,10 @@ -use std::path::PathBuf; +mod args; +mod types; + +pub use crate::args::*; +pub use crate::types::*; +use std::path::PathBuf; pub fn ndpm_ai_home() -> PathBuf { let home = std::env::var("HOME").expect("HOME not set"); diff --git a/src/types.rs b/src/types.rs new file mode 100644 index 0000000..bd903df --- /dev/null +++ b/src/types.rs @@ -0,0 +1,20 @@ +use serde::Serialize; +use std::path::PathBuf; + +#[derive(Debug, Serialize)] +pub struct AppImage { + pub file_path: PathBuf, + pub executable: String, + pub source: Source, +} + +#[derive(Debug, Serialize)] +pub struct Source { + pub identifier: String, + pub meta: SourceMetadata, +} + +#[derive(Debug, Serialize)] +pub struct SourceMetadata { + pub url: String, +} |
