Skip to content

feat: add ignore flag for ignoring directories - #102

Open
elliottcrif wants to merge 1 commit into
imsnif:mainfrom
elliottcrif:feat/exclude-directory-flag
Open

feat: add ignore flag for ignoring directories#102
elliottcrif wants to merge 1 commit into
imsnif:mainfrom
elliottcrif:feat/exclude-directory-flag

Conversation

@elliottcrif

@elliottcrif elliottcrif commented Dec 27, 2024

Copy link
Copy Markdown
  • adds ignore flag to optionally ignore directories from being scanned
  • tests coming soon

Resolves #93

@elliottcrif
elliottcrif force-pushed the feat/exclude-directory-flag branch from ed6d1c5 to 03939b1 Compare December 27, 2024 21:08
Comment thread src/main.rs
@@ -103,6 +112,7 @@ pub fn start<B>(
terminal_backend: B,

@elliottcrif elliottcrif Dec 28, 2024

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, the start function takes a growing list of parameters for various options and flags (e.g., show_apparent_size, disable_delete_confirmation). As we continue to add more options, this signature risks becoming unwieldy and harder to maintain. The challenge became especially apparent when updating the UI tests, which required significant changes due to the expanded parameter list.

To address this, I鈥檝e started a WIP implementation that uses the Opt struct as the last argument in start. This encapsulates all optional parameters into a single structure, aiming to reduce churn when adding or modifying options.

I鈥檇 appreciate input on the following:

  • Is encapsulating options in a configuration struct like Opt an idiomatic approach in Rust?
  • Would a builder pattern provide better flexibility and maintainability for this use case?
  • Are there other patterns or techniques in Rust that would align well with the goal of minimizing signature changes?

I鈥檓 especially interested in feedback on how this impacts code readability, maintainability, and idiomatic usage in Rust.

@elliottcrif
elliottcrif marked this pull request as ready for review December 28, 2024 19:38
Comment thread src/main.rs
folder: Option<PathBuf>,
#[structopt(short, long)]
/// The directories to ignore
ignore: Vec<PathBuf>,

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have opted to use an ignore option but wondering if we would prefer to use exclude with shorthand x, I have seen that preference voiced in other issues.

@elliottcrif

Copy link
Copy Markdown
Author

cc @imsnif @pjsier @pm100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: option --ignore to skip certain directory/directories

1 participant