Skip to content

Commit

Permalink
style: more clear progress message (#198)
Browse files Browse the repository at this point in the history
For example if you format a single file, we shouldn't say we're formatting code in all languages.
What we're really doing is checking which languages your argv are written in.

fixes #197
  • Loading branch information
alexeagle authored Apr 8, 2024
1 parent c212ae3 commit 7e8f210
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docs/format.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion format/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _format_attr_factory(target_name, lang, toolname, tool_label, mode):
"data": [tool_label],
}

def format_multirun(name, jobs = 4, **kwargs):
def format_multirun(name, jobs = 4, print_command = False, **kwargs):
"""Create a multirun binary for the given formatters.
Intended to be used with `bazel run` to update source files in-place.
Expand All @@ -76,6 +76,8 @@ def format_multirun(name, jobs = 4, **kwargs):
Args:
name: name of the resulting target, typically "format"
jobs: how many language formatters to spawn in parallel, ideally matching how many CPUs are available
print_command: whether to print a progress message before calling the formatter of each language.
Note that a line is printed for a formatter even if no files of that language are to be formatted.
**kwargs: attributes named for each language, providing Label of a tool that formats it
"""
commands = []
Expand All @@ -99,6 +101,7 @@ def format_multirun(name, jobs = 4, **kwargs):
commands = commands,
jobs = jobs,
keep_going = True,
print_command = print_command,
**common_attrs
)

Expand All @@ -107,6 +110,7 @@ def format_multirun(name, jobs = 4, **kwargs):
commands = [c + ".check" for c in commands],
jobs = jobs,
keep_going = True,
print_command = print_command,
**common_attrs
)

Expand Down

0 comments on commit 7e8f210

Please sign in to comment.