================ @@ -205,6 +205,12 @@ def main(): "commits" ), ) + p.add_argument( + "-0", + "--null", + action="store_true", + help="print the affected paths with null-terminated characters", ---------------- createyourpersonalaccount wrote:
> > I'm wondering if `-0` should turn off all informational messaging as well > > and _only_ print the paths. As it is, it will print things like _Running > > clang-format on the following files:_, even if a null-separated list of > > files follows. > > So right now the usage would be (example) > > ```shell > > git clang-format --staged -0 | tail -n +2 | xargs -0 git add > > ``` > > > > but perhaps it should not print informational messages and have the usage > > be simplified: > > ```shell > > git clang-format --staged -0 | xargs -0 git add > > ``` > > Aren't you really asking, just give me a list of all the files that have been > changed by clang format, in which case -0 isn't really that descriptive, what > not > > ``` > --modified or -m (similar to git ls-files) > ``` > > or `-- affected (might avoid becausee of affected/effected spelling issues > people have)` The list is already printed. The `-0` flag is printing a null separated list of files, see for example https://github.com/llvm/llvm-project/issues/123921. This allows to safely parse the list, avoiding issues with e.g. newlines in file names. > if you plan on dropping other text output (which I think perhaps you should > other wise it needs to be grep -v'd or tailed to make it work correctly, I > would perhaps rather we had a better named command line switch than -0 or > --null Okay, I will drop all other text except the list of files. Why do you say that `-0` and `--null` are bad? The standard is `-0` and `-z`, I think whichever works, but given that this will most likely be used with xargs, it makes sense to use `-0`. > I know this is likely how xargs or find works, but I think we can do a little > better than those tools in terms of clarity. What other tool is there? GNU Parallel also works with `-0` and generally any other tool that does what these tools do will have either `-0` or `-z`. https://github.com/llvm/llvm-project/pull/123926 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits