Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add check mode #27

Closed
thnee opened this issue Jul 11, 2018 · 4 comments
Closed

Feature: Add check mode #27

thnee opened this issue Jul 11, 2018 · 4 comments

Comments

@thnee
Copy link

thnee commented Jul 11, 2018

Would be useful if it could just verify if something would change, without actually changing the files. So that it can be used as part of a test suite.

See the --check flag in black for comparison.

It could print something like "x number of changes would be made to file zzz", and exit with 0 if there are no changes, and exit with 1 if there are changes.

@f18m
Copy link
Contributor

f18m commented Jan 6, 2019

I'd love to have this feature as well.
Right now I implemented in a mixed bash/C++ process some rules like that:

all:
	@for bashfile in $$(ls *.sh); do \
		cp -f $$bashfile /tmp ; \
		rm -f /tmp/$$bashfile.bak ; \
		beautysh --backup --files /tmp/$$bashfile ; \
		if [ -f /tmp/$$bashfile.bak ]; then \
			echo "Invalid formatting for $$bashfile" ; \
			exit 2 ; \
		else \
			echo "Valid formatting for $$bashfile" ; \
		fi ; \
	done

@lovesegfault
Copy link
Owner

@thnee, @f18m Has graciously gone ahead and implemented this, I've been overloaded with work lately. Please test it on the master branch!

@f18m
Copy link
Contributor

f18m commented Jan 11, 2019

Sorry @bemeurer but I think that by mistake commit #258330f has removed the --check option previously checked in. My bad.
Do you want me to resubmit the PR for the --check option?

@lovesegfault
Copy link
Owner

@f18m No worries, please re-submit it 👍

This was referenced Jan 12, 2019
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

No branches or pull requests

3 participants