A command line app that puts the opening brace for an Objective-C code block on the same line as the opening clause.
Xcode is inconsistent about the placement of braces for code that it inserts for us. Sometimes it puts the opening braces on the same line, sometimes it puts it on the next line. I prefer it to be on the opening line. This command line app makes it easy to change selected source files, or all the files in a folder, or even run with the dry-run option to see what files would be changed.
$ gem install fixbraces
Clone the repository and then build and install it:
Once it is installed, you can run it from the command line. Either pass it the current directory ('.') or a path to a directory that contains source file. Alternatively, pass it a list of files.
You can pass it a directory:
or even use '.' for the current directory:
Apply it ot a single file:
or a number of files:
If you just want to see what files would be changed, then use the
fixbraces -d .
fixbraces --help for details.
--dry-run, -doption to list the files that would change, but make no actual corrections.
I have tests, you can see them for yourself. The script works, but I'm aggressive about using version control, so if anything did get messed up I'm not left in an unrecoverable state.
I suggest you do the same.
git checkout -b my-new-feature)
git commit -am 'Added some feature')
git push origin my-new-feature)
Standard MIT license. Knock yourself out.