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

zig fmt: Add --check-formatted flag #1558

wants to merge 1 commit into from


None yet
2 participants
Copy link

commented Sep 19, 2018

Took a stab at fixing #1555

Sorry if this is a funky solution! I'm brand new to Zig and low-level programming in general. Please let me know if there is a better approach here.

Fixes #1555

@xtian xtian force-pushed the xtian:feature/fmt-check-formatted branch from 41aa8fb to 1afde52 Sep 19, 2018


This comment has been minimized.

Copy link

commented Sep 20, 2018

Sorry for the delay! I'll try to get to this today or tomorrow.

@andrewrk andrewrk added this to the 0.3.0 milestone Sep 21, 2018

Copy link

left a comment

Looks good so far. I think this is missing 2 things:

  • the part where it calls exit(1) at the end if anything failed the check.
  • --stdin is special cased above, so you will have to add code to handle that case as well. --stdin --check should print nothing to stdout and simply exit(1) or exit(0) depending on whether the source is already formatted.
@@ -525,6 +525,7 @@ const usage_fmt =

const args_fmt_spec = []Flag{

This comment has been minimized.

Copy link

andrewrk Sep 21, 2018


Let's go with simply --check. This flag is namespaced under zig fmt so the concept of "format" is already implied

@andrewrk andrewrk modified the milestones: 0.3.0, 0.4.0 Sep 21, 2018

@andrewrk andrewrk closed this in 0c3bd0c Nov 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.