Skip to content

feat: added --disable-size flag and related handling#246

Merged
zaldih merged 2 commits intovoidcosmos:mainfrom
yetanotheraryan:main
Apr 25, 2026
Merged

feat: added --disable-size flag and related handling#246
zaldih merged 2 commits intovoidcosmos:mainfrom
yetanotheraryan:main

Conversation

@yetanotheraryan
Copy link
Copy Markdown
Contributor

@yetanotheraryan yetanotheraryan commented Apr 7, 2026

For #240

Changes

  • Added disableSize to the CLI config interface and default config.
  • Registered the --disable-size option in CLI help/options.
  • Passed CLI config into ResultsUi so result rendering can react to disableSize.
  • Updated result display to show placeholder size text when size calculation is disabled.
  • Updated UI scan flow to skip calculateFolderStats() when disableSize is enabled.
  • Updated --delete-all handling so folders can be deleted as soon as they are found when size calculation is disabled.
  • Updated test config fixture to include the new disableSize field.

Validation

  • npm run build passes.
  • npm test passes.
  • Verified node lib/index.js --help shows --disable-size.

Note

--disable-size currently affects interactive UI mode.

@zaldih
Copy link
Copy Markdown
Member

zaldih commented Apr 13, 2026

Thanks for opening this PR!

I've been reviewing it and found a bug: when --disable-size is enabled, the age column also stops working.
This happens because calculateFolderStats handles both the size and the modification time calculations, so skipping it entirely also skips the age (and other side effects).

The fix should keep calling calculateFolderStats and move the disableSize check inside it, skipping only the size part.

Comment thread src/cli/cli.controller.ts Outdated
Comment on lines +771 to +791
if (this.config.disableSize) {
this.scanSubscription = scan$.subscribe({
next: () => this.printFoldersSection(),
error: (error) => this.newError(error),
complete: () => this.completeSearch(),
});
} else {
this.scanSubscription = scan$
.pipe(
mergeMap(
(nodeFolder) => this.scanService.calculateFolderStats(nodeFolder),
10, // Limit to 10 concurrent stat calculations at a time
),
tap((folder) => this.processFolderStatsForUi(folder)),
)
.subscribe({
next: () => this.printFoldersSection(),
error: (error) => this.newError(error),
complete: () => this.completeSearch(),
});
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of branching here, keep callng calculateFolderStats always. Move the disableSize check inside that emthod so it skips only the size calculation but still computes modificationTime.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@zaldih Alright, thanks for the review, I have done the required changes, now the age section works as expected, verified the same as well.

image

@zaldih
Copy link
Copy Markdown
Member

zaldih commented Apr 25, 2026

It works like a charm. Thank you so much for your contribution!!

I'll work on this to hide the column if the option is enabled. The TUI is a bit tricky, so I'll take care of it myself.

@zaldih zaldih merged commit 72561db into voidcosmos:main Apr 25, 2026
28 checks passed
@yetanotheraryan
Copy link
Copy Markdown
Contributor Author

@zaldih Btw you should know I benchmarked this, and its like 17x faster with disable-size, seems like a good win for performance as expected.
Best part was that it didnt even need like a very big node_modules, 308 MB of node_modules, 91ms -> 6 ms

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.

2 participants