summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNaz <ndpm13@ch-naseem.com>2025-07-28 19:18:21 +0100
committerNaz <ndpm13@ch-naseem.com>2025-07-28 19:18:21 +0100
commitd3b4feefd49cd3f2f730a7629bfca6d6ebf3e220 (patch)
tree706f6c7a496917388b94a942d6faeb1ccde9b9e4 /src
parent3c65c61a1a688c9af72855dbf9d3a6eb598299d9 (diff)
✨feat: add list command to show installed AppImages
Diffstat (limited to 'src')
-rw-r--r--src/args.rs4
-rw-r--r--src/main.rs9
2 files changed, 13 insertions, 0 deletions
diff --git a/src/args.rs b/src/args.rs
index 7f7ca3a..03f6b51 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -17,6 +17,10 @@ pub enum Command {
/// Removes an AppImage
#[command(name = "remove", alias = "rm")]
Remove(RemoveArgs),
+
+ /// List the installed AppImages
+ #[command(name = "list", alias = "ls")]
+ List,
}
#[derive(Debug, Args)]
diff --git a/src/main.rs b/src/main.rs
index 3092c43..4c3d5d7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -42,6 +42,15 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
appimage.remove().await?;
}
+ Command::List => {
+ let mut appimages = fs::read_dir(index_dir()).await?;
+
+ while let Some(appimage) = appimages.next_entry().await? {
+ if let Some(name) = appimage.file_name().to_str() {
+ println!("- {}", name.strip_suffix(".json").unwrap());
+ }
+ }
+ }
};
Ok(())