feat(ENGKNOW-3738): re-add exec gor files rm with recursive delete gated - #135
Merged
Conversation
Re-registers RmCommand as a subcommand of `exec gor files`, which was commented out in ENGKNOW-3363. Recursive delete is off by default: `rm -r` now fails unless the JVM is started with -Dgor.cli.files.rm.recursive=true. The check runs before the path loop, so a rejected `rm -r a b c` deletes nothing. Removing empty directories with -d stays enabled, as it only deletes directories verified to be empty. Un-ignores the rm tests and adds a test asserting that -r is rejected and leaves the directory intact by default. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
janeliutw
approved these changes
Aug 20, 2026
cesarvp-gdx
approved these changes
Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ENGKNOW-3738
Re-adds
exec gor files rm, which was commented out of thefilessubcommand list in ENGKNOW-3363, and keeps the risky part disabled.Changes
FilesCommand—RmCommand.classregistered again as a subcommand.RmCommand—-r/--recursiveis gated behind the system propertygor.cli.files.rm.recursive(defaultfalse). Without it,rm -rfails with:rm: recursive delete is disabled, set -Dgor.cli.files.rm.recursive=true to enable itThe check runs before the path loop, so a rejected
rm -r a b cdeletes nothing.The property is read per invocation rather than in a static initializer, so a
-Dflag or a test setting it takes effect.-d(remove empty directories) stays enabled — it only deletes directories it has verified to be empty.-fand-vare unchanged.@Ignore("rm disabled for now")annotations are removed,testRmRecursivesets the property in a try/finally, and a newtestRmRecursiveDisabledByDefaultasserts that-ris rejected and leaves the directory and its contents intact.Testing
./gradlew :gortools:test --tests "org.gorpipe.gor.cli.files.UTestFilesCommandExec"— 31 tests pass, including all 8 rm tests.🤖 Generated with Claude Code