Skip to content

Commit

Permalink
v1.0.3
Browse files Browse the repository at this point in the history
- Improved output formatting by manually handling selected items display
- Ensured each selected item appears on a new line
  • Loading branch information
valsaven committed Aug 14, 2024
1 parent e424de6 commit 03a96bc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "npkl"
version = "1.0.2"
version = "1.0.3"
edition = "2021"
description = "Like npkill, but written in Rust."
authors=["Val Saven <val.saven@gmail.com>"]
Expand All @@ -10,7 +10,7 @@ repository = "https://github.com/valsaven/npkl"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
itertools = "0.12.0"
itertools = "0.13.0"
byte-unit = "5.1.3"
dialoguer = "0.11.0"
walkdir = "2.4.0"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ This utility recursively searches for node_modules directories from the point it
- Review the path and size of each found directory.
- Selectively delete unwanted node_modules directories with a simple interface.


## Building

To build it from source you need Rust 1.73 or later, preferably via rustup.
Expand All @@ -25,6 +24,7 @@ cargo install npkl
### Local Building

Clone this repo and then:

```bash
cargo build --release
# Optionally, you can compress the executable file (Windows example, reduces the file size from ~338KB to ~123KB):
Expand Down
10 changes: 7 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,18 @@ fn main() -> std::io::Result<()> {
println!("{}\n", node_items.len());

let selection_result = MultiSelect::with_theme(&ColorfulTheme::default())
.with_prompt("Select with CURSORS and SPACE. Press ENTER to delete")
.with_prompt("Select with CURSORS and SPACE. Press ENTER to delete\n")
.items(&node_items)
.report(false)
.clear(true)
.interact_on_opt(&Term::stderr());

match selection_result {
Ok(Some(positions)) => {
for index in positions {
let selected_item = &node_items[index];
println!("Selected items:");
for index in &positions {
let selected_item = &node_items[*index];
println!("{}", selected_item);
let selected_item_path = get_selected_item_path(selected_item);
fs::remove_dir_all(selected_item_path)?;
}
Expand Down

0 comments on commit 03a96bc

Please sign in to comment.