cbfmt
cbfmt copied to clipboard
Does not handle spaces in arguments well
trafficstars
I'm trying to have cbfmt autoformat my C code blocks using clang-format with the following config:
[languages]
c = ["clang-format -style=\"{BasedOnStyle: Google, IndentWidth: 4, UseTab: Never, TabWidth: 4}\""]
However, it seems to split args on spaces without respecting the escaped quote. clang-format thinks that it has received 6 filenames which yields the error:
$ cbfmt -w test.md
[Error]: test.md:3 [c] -> [clang-format]
No such file or directory
No such file or directory
No such file or directory
No such file or directory
No such file or directory
No such file or directory
No such file or directory
[0/1] files were written.
Here's my test markdown file:
Hello
```c
struct MailStructure {
unsigned int data : 18; // Assuming data is 18 bits
unsigned int reserved : 10;
unsigned int channel : 4;
};
```
Yeah it naively just splits by whitespace at the moment.
I'll look into this when I have some time.
For now, I guess an easy workaround is to just not use spaces.
Thanks, please take your time. I'm using .clang-format for the time being, as the style argument strictly requires spaces.