Skip to content

Instantly share code, notes, and snippets.

@miku
Forked from paulfryzel/gist:3947535
Created November 26, 2017 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miku/5cb6bc5c75eb772c944f15faf1755948 to your computer and use it in GitHub Desktop.
Save miku/5cb6bc5c75eb772c944f15faf1755948 to your computer and use it in GitHub Desktop.
like gofmt but for c... and using astyle
#!/usr/bin/env bash
# mostly from http://word.bitly.com/post/31921713978/static-analysis
function cfmt {
if [[ $# -ne 1 ]]; then
echo "Usage: cfmt <file>"
else
astyle \
--style=1tbs \
--lineend=linux \
--convert-tabs \
--preserve-date \
--pad-header \
--indent-switches \
--align-pointer=name \
--align-reference=name \
--pad-oper \
--suffix=none \
$1
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment