aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornytpu <alex@nytpu.com>2021-06-19 10:43:17 -0600
committernytpu <alex@nytpu.com>2021-06-19 10:43:17 -0600
commit29b3400bafbc5dee649e9d83a6154e33ea51206a (patch)
tree7f9b6001f14dc817dd12fe0e269370a7163997e4
parentupdate dates in man pages (diff)
downloaded-29b3400bafbc5dee649e9d83a6154e33ea51206a.tar.bz2
ed-29b3400bafbc5dee649e9d83a6154e33ea51206a.zip
add clang format
-rw-r--r--.clang-format127
-rw-r--r--Makefile5
2 files changed, 131 insertions, 1 deletions
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..b68361b
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,127 @@
+---
+# nytpu's personal formatting style
+Language: Cpp
+BasedOnStyle: GNU
+# use to disable formatting
+DisableFormat: false
+## indent widths, line width, etc
+ColumnLimit: 80
+ContinuationIndentWidth: 8
+IndentWidth: 8
+TabWidth: 8
+UseTab: AlignWithSpaces
+# force \n as line ending
+DeriveLineEnding: false
+UseCRLF: false
+## other stuff
+AlignAfterOpenBracket: DontAlign
+AlignConsecutiveAssignments: None
+AlignConsecutiveBitFields: None
+AlignConsecutiveDeclarations: None
+AlignConsecutiveMacros: None
+AlignEscapedNewlines: Right
+AlignOperands: DontAlign
+AlignTrailingComments: false
+AllowAllArgumentsOnNextLine: false
+AllowAllParametersOfDeclarationOnNextLine: false
+AllowShortBlocksOnASingleLine: Empty
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortEnumsOnASingleLine: true
+AllowShortFunctionsOnASingleLine: Empty
+AllowShortIfStatementsOnASingleLine: WithoutElse
+AllowShortLoopsOnASingleLine: true
+AlwaysBreakAfterDefinitionReturnType: All
+AlwaysBreakAfterReturnType: AllDefinitions
+AlwaysBreakBeforeMultilineStrings: false
+BinPackArguments: true
+BinPackParameters: true
+BitFieldColonSpacing: Both
+BraceWrapping:
+ AfterCaseLabel: false
+ AfterControlStatement: Never
+ AfterEnum: false
+ AfterFunction: true
+ AfterStruct: false
+ AfterUnion: false
+ BeforeElse: false
+ BeforeWhile: false
+ IndentBraces: false
+ SplitEmptyFunction: false
+ SplitEmptyRecord: false
+BreakBeforeBinaryOperators: NonAssignment
+BreakBeforeBraces: Custom
+BreakBeforeTernaryOperators: true
+BreakStringLiterals: true
+CommentPragmas: 'For more license details'
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+ExperimentalAutoDetectBinPacking: false
+ForEachMacros:
+ - foreach
+ - Q_FOREACH
+ - BOOST_FOREACH
+IncludeBlocks: Regroup
+IncludeCategories:
+ - Regex: '^"'
+ Priority: 2
+ SortPriority: 2
+ CaseSensitive: false
+ - Regex: '.*'
+ Priority: 3
+ SortPriority: 3
+ CaseSensitive: false
+IncludeIsMainRegex: '(_test)?$'
+IncludeIsMainSourceRegex: ''
+IndentCaseBlocks: false
+IndentCaseLabels: false
+IndentGotoLabels: false
+IndentPPDirectives: None
+IndentWrappedFunctionNames: false
+KeepEmptyLinesAtTheStartOfBlocks: true
+MacroBlockBegin: ''
+MacroBlockEnd: ''
+MaxEmptyLinesToKeep: 1
+PenaltyBreakAssignment: 2
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PenaltyIndentedWhitespace: 0
+PointerAlignment: Right
+ReflowComments: true
+SortIncludes: true
+# only in clang 13
+#SortIncludes: CaseInsensitive
+SpaceAfterCStyleCast: false
+SpaceAfterLogicalNot: false
+SpaceAroundPointerQualifiers: Default
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeCaseColon: false
+SpaceBeforeCpp11BracedList: true
+SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceInEmptyBlock: false
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInCStyleCastParentheses: false
+SpacesInConditionalStatement: false
+SpacesInContainerLiterals: false
+# only in clang 13
+#SpacesInLineCommentPrefix:
+# - Minimum: 1
+# - Maximum: -1
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+SpaceBeforeSquareBrackets: false
+BitFieldColonSpacing: Both
+Standard: Latest
+WhitespaceSensitiveMacros:
+ - STRINGIZE
+ - PP_STRINGIZE
+ - BOOST_PP_STRINGIZE
+ - NS_SWIFT_NAME
+ - CF_SWIFT_NAME
+...
diff --git a/Makefile b/Makefile
index fbdc68c..dea14df 100644
--- a/Makefile
+++ b/Makefile
@@ -60,10 +60,13 @@ $(PROGNAME): $(OBJS)
# phonies
# technically .PHONY isn't POSIX, but targets with a leading period aren't
# reserved so it's still valid, it'd just be useless to actually execute
-.PHONY: all clean install uninstall
+.PHONY: all format clean install uninstall
clean:
rm -rf $(OBJS) $(PROGNAME) $(TESTS)
+format:
+ find . (-name '*.[ch]' -a (! -name 'linenoise.*')) -exec clang-format -style=file -i {} \;
+
install: $(BINS) $(MANS)
mkdir -p $(BINDIR) $(MANDIR)/man1
cp $(BINS) $(BINDIR)