fix: write output file when --output is given without --txt#2993
Open
ashvinctrl wants to merge 1 commit into
Open
fix: write output file when --output is given without --txt#2993ashvinctrl wants to merge 1 commit into
ashvinctrl wants to merge 1 commit into
Conversation
Passing --output myfile.txt without --txt produced no output file and no error, silently discarding the flag. The result_file variable was set correctly but the write block was gated on args.output_txt alone. Change the condition from `if args.output_txt` to `if args.output_txt or args.output` so that specifying --output alone is sufficient to write the file, matching the documented behaviour. Fixes sherlock-project#2992
9edb4e3 to
b9ce44e
Compare
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.
Summary
Fixes #2992
--output myfile.txtproduced no file and no error unless--txtwas also passed. Theresult_filevariable was set correctly but the write block was gated exclusively onargs.output_txt, making--outputsilently ignored on its own.Change
sherlock_project/sherlock.py— one-line condition change:This matches the documented behaviour: "the output of the result will be saved to this file" — no additional flag required.
Test plan
pytest tests/test_output_flag.py— new tests passpytest— full suite greensherlock --output /tmp/out.txt someuser—/tmp/out.txtis createdsherlock --txt someuser— still createssomeuser.txt(no regression)sherlock --output /tmp/out.txt --txt someuser— still works (no double-write)