Skip to content

Commit 89d70ef

Browse files
committed
Improve code format
1 parent f993f10 commit 89d70ef

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
UseTab: ForIndentation,
44
IndentWidth: 3,
55
TabWidth: 3,
6+
AlignAfterOpenBracket: BlockIndent,
67
AlignEscapedNewlines: Left,
78
AllowShortFunctionsOnASingleLine: Empty,
89
AlwaysBreakTemplateDeclarations: Yes,

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ end_of_line = lf
66
charset = utf-8
77
trim_trailing_whitespace = true
88
insert_final_newline = true
9+
10+
[{.clang-format,.clangd}]
11+
indent_style = space
12+
indent_size = 2

d.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ void fail(struct Failure failure) {
3131
#define MAGENTA "\033[0;35m"
3232
#define RESET "\033[0m"
3333

34-
fprintf(stderr,
35-
"Application reached a " RED "terminating failure" RESET "...\n" BLUE "Operation: " RESET
36-
"Failed to %s\n" CYAN "Reason: " RESET "%s\n",
37-
failure.operation, failure.reason);
34+
fprintf(
35+
stderr,
36+
"Application reached a " RED "terminating failure" RESET "...\n" BLUE "Operation: " RESET "Failed to %s\n" CYAN
37+
"Reason: " RESET "%s\n",
38+
failure.operation, failure.reason
39+
);
3840
if (failure.info != NULL) {
3941
fprintf(stderr, YELLOW "Extra Information: " RESET "%s\n", failure.info);
4042
}
@@ -130,8 +132,10 @@ int main(int argc, char *argv[]) {
130132
}
131133

132134
if (command == CommandPrint) {
133-
printf("\t{ \"category\": \"%s\", \"source\": \"%s\", \"destination\": \"%s\" }", entry.category,
134-
entry.source, entry.destination);
135+
printf(
136+
"\t{ \"category\": \"%s\", \"source\": \"%s\", \"destination\": \"%s\" }", entry.category, entry.source,
137+
entry.destination
138+
);
135139
if (configuration[i + 1] == NULL) {
136140
printf("\n");
137141
} else {
@@ -179,8 +183,9 @@ void deploy(char *source_path, char *destination_path, bool debug) {
179183
{
180184
if (destination_path[strlen(destination_path) - 1] == '/') {
181185
if (source_path[strlen(source_path) - 1] != '/') {
182-
fprintf(stderr,
183-
"Error: If destination path does have trailing slash, then source path must have it too.\n");
186+
fprintf(
187+
stderr, "Error: If destination path does have trailing slash, then source path must have it too.\n"
188+
);
184189
exit(1);
185190
}
186191

@@ -190,7 +195,8 @@ void deploy(char *source_path, char *destination_path, bool debug) {
190195
if (source_path[strlen(source_path) - 1] == '/') {
191196
fprintf(
192197
stderr,
193-
"Error: If destination path does not have trailing slash, then source path must not have it either.\n");
198+
"Error: If destination path does not have trailing slash, then source path must not have it either.\n"
199+
);
194200
exit(1);
195201
}
196202
}

0 commit comments

Comments
 (0)