Last 12 weeks · 0 commits
4 of 6 standards met
On Windows, exits 0 but deletes nothing. Any input with backslash separators — or on any platform, a literal filename containing glob special characters like — is a silent no-op. Repro (Windows 11, trash-cli 7.2.0): Root cause: passes all input through globby, and fast-glob treats as a glob escape character, so backslash paths match zero files and gets an empty array. Fix: union the globby matches with literal input paths that exist per , then de-dupe — the same approach the package's own already uses (which is why calling the API directly is unaffected). Glob behavior is unchanged; only inputs that name an existing path are added. Testing: added a cross-platform AVA regression test (literal via , so it also exercises backslash separators on Windows). Manually verified on Windows 11: absolute/relative backslash paths, forward-slash paths, and plain filenames all land in the Recycle Bin with correct original locations; , , , and nonexistent-path behavior are unchanged; (xo + AVA) passes on Linux-equivalent paths. Known remaining gap (pre-existing, out of scope here):** a glob pattern whose directory portion uses backslashes () still matches nothing, since that genuinely reaches globby as a pattern. Fixing that would mean normalizing in patterns on Windows (e.g. fast-glob's or ), which changes escape semantics — left for a separate discussion. This is also why two of the existing tests ( ones, which build from a backslash base) fail on Windows both before and after this change; CI runs Ubuntu only, where the full suite passes. 🤖 Generated with Claude Code
Description silently fails to trash directories. The command returns exit code 0 but nothing is moved to trash. Steps to Reproduce ```bash mkdir test-folder echo "test" > test-folder/test.txt trash test-folder ls test-folder # folder still exists With --verbose, no output is produced either: trash -v test-folder (no output, folder still exists) Expected Behavior The directory should be moved to the trash. Actual Behavior The directory is silently ignored. Exit code is 0, no error message, no verbose output. Root Cause In cli.js line 49: const files = await globby(cli.input, {expandDirectories: false}); globby defaults to onlyFiles: true, which excludes directories from the results. When a directory path is passed, globby returns an empty array, so nothing gets trashed. Fix Add onlyFiles: false to the globby options: const files = await globby(cli.input, {expandDirectories: false, onlyFiles: false}); Environment trash-cli: 7.1.0 Node.js: v25.4.0 macOS: Tahoe 26.2 (25C56)
Repository: sindresorhus/trash-cli. Description: Move files and folders to the trash Stars: 1412, Forks: 39. Primary language: JavaScript. Languages: JavaScript (100%). License: MIT. Latest release: v7.2.0 (6mo ago). Open PRs: 1, open issues: 2. Last activity: 6mo ago. Community health: 85%. Top contributors: sindresorhus, jv-k, MoOx, Richienb.