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

Pipe found list files to single cmake-format call #3

Merged
merged 1 commit into from
Jun 26, 2022

Conversation

bwrsandman
Copy link
Contributor

@bwrsandman bwrsandman commented Jun 26, 2022

Fixes running with arg --check and other reasons why cmake-format would fail such as with a bad config.

Using \; invokes multiple calls to cmake-format with each file as an arguments, while + pipes all files into the arguments.

  • With \;:
cmake-format $* ./test/CMakeLists.txt
cmake-format $* ./CMakeLists.txt
cmake-format $* ./CMakeModules/FindSDL2.cmake
cmake-format $* ./CMakeModules/Findspdlog.cmake
cmake-format $* ./CMakeModules/vcpkg_android.cmake
cmake-format $* ./src/CMakeLists.txt

exit codes of cmake-format are disposed of

  • With +:
cmake-format $* ./test/CMakeLists.txt ./CMakeLists.txt ./CMakeModules/FindSDL2.cmake ./CMakeModules/Findspdlog.cmake ./CMakeModules/vcpkg_android.cmake ./src/CMakeLists.txt

exit code is maintained

Fixes running with arg `--check`

Using `\;` invokes multiple calls to cmake-format with each file as an arguments, while `+` pipes all files into the arguments.

* With `\;`:
```bash
cmake-format $* ./test/CMakeLists.txt
cmake-format $* ./CMakeLists.txt
cmake-format $* ./CMakeModules/FindSDL2.cmake
cmake-format $* ./CMakeModules/Findspdlog.cmake
cmake-format $* ./CMakeModules/vcpkg_android.cmake
cmake-format $* ./src/CMakeLists.txt
```
exit codes of cmake-format are disposed of

* With `+`:
```bash
cmake-format $* ./test/CMakeLists.txt ./CMakeLists.txt ./CMakeModules/FindSDL2.cmake ./CMakeModules/Findspdlog.cmake ./CMakeModules/vcpkg_android.cmake ./src/CMakeLists.txt
```
exit code is maintained
@puneetmatharu
Copy link
Owner

Nice catch! Thanks for the PR

@puneetmatharu puneetmatharu merged commit a7e22ed into puneetmatharu:main Jun 26, 2022
@bwrsandman bwrsandman deleted the patch-1 branch June 26, 2022 17:48
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

Successfully merging this pull request may close these issues.

2 participants