diff options
| author | Naz <ndpm13@noreply.git.ch-naseem.com> | 2025-07-28 19:24:41 +0100 |
|---|---|---|
| committer | Naz <ndpm13@noreply.git.ch-naseem.com> | 2025-07-28 19:24:41 +0100 |
| commit | d3c84b04d7a46735dd19a2dae9448e811a609291 (patch) | |
| tree | 706f6c7a496917388b94a942d6faeb1ccde9b9e4 | |
| parent | 3c65c61a1a688c9af72855dbf9d3a6eb598299d9 (diff) | |
| parent | d3b4feefd49cd3f2f730a7629bfca6d6ebf3e220 (diff) | |
Merge pull request '✨feat: add list command to show installed AppImages' (#10) from feat/issue-3 into main
Reviewed-on: https://git.ch-naseem.com/ndpm13/zap-rs/pulls/10
| -rw-r--r-- | src/args.rs | 4 | ||||
| -rw-r--r-- | src/main.rs | 9 |
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(()) |
