Skip to content

Commit e9cbb9e

Browse files
committed
Housekeeping
1 parent 08fc8f7 commit e9cbb9e

File tree

6 files changed

+17
-31
lines changed

6 files changed

+17
-31
lines changed

.clang-format

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
UseTab: ForIndentation,
44
IndentWidth: 3,
55
TabWidth: 3,
6-
AlignAfterOpenBracket: BlockIndent,
76
AlignEscapedNewlines: Left,
87
AllowShortFunctionsOnASingleLine: Empty,
98
AlwaysBreakTemplateDeclarations: Yes,

.clangd

Lines changed: 0 additions & 2 deletions
This file was deleted.

.lefthook.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
assert_lefthook_installed: true

Bakefile.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
# shellcheck shell=bash
2-
# shellcheck disable=SC2086
32

43
init() {
5-
CFLAGS='-Wall -Wextra -Wpedantic -fsanitize=address -g -Wno-unused-variable -Wno-unused-parameter'
4+
CFLAGS=(-Wall -Wextra -Wpedantic -fsanitize=address -g -Wno-unused-variable -Wno-unused-parameter)
65
}
76

87
task.build() {
98
local dir=$1
109
bake.assert_not_empty dir
1110

12-
bear -- gcc $CFLAGS -DCONFIG_FILE="\"$dir\"" d.c -o ./d
11+
bear -- gcc "${CFLAGS[@]}" -DCONFIG_FILE="\"$dir\"" d.c -o ./d
1312
}
1413

1514
task.run() {

README.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,32 +42,30 @@ struct Entry {
4242
char const *source;
4343
char const *destination;
4444
};
45-
#define Done { \
46-
.category = NULL, .source = NULL, .destination = NULL \
47-
}
45+
#define Done { .source = NULL, .destination = NULL }
46+
#define Home CONFIG_HOME
4847

48+
// Each application corresponds to an "entry".
4949
static struct Entry bash[] = {
5050
{
51-
.category = "bash",
52-
.source = "/home/edwin/.dotfiles/.bashrc",
53-
.destination = "/home/edwin/.bashrc"
51+
.source = Home "/.dotfiles/.bashrc",
52+
.destination = Home "/.bashrc"
5453
},
5554
{
56-
.category = "bash",
57-
.source = "/home/edwin/.dotfiles/.bash_login",
58-
.destination = "/home/edwin/.bash_login"
55+
.source = Home "/.dotfiles/.bash_login",
56+
.destination = Home "/.bash_login"
5957
},
6058
Done
6159
};
6260
static struct Entry zsh[] = {
6361
{
64-
.category = "zsh",
65-
.source = "/home/edwin/.dotfiles/.zshrc",
66-
.destination = "/home/edwin/.zshrc"
62+
.source = Home "/.dotfiles/.zshrc",
63+
.destination = Home "/.zshrc"
6764
},
6865
Done
6966
};
7067

68+
// Group entries that should be deployed together.
7169
static struct Group group1 = {
7270
.name = "Linux desktop",
7371
.entries = (struct Entry *[]){
@@ -83,12 +81,13 @@ static struct Group group2 = {
8381
NULL
8482
}
8583
};
84+
85+
// Finally, list all groups and configure a default group.
8686
static struct Group** groups = (struct Group *[]){
8787
&group1,
8888
&group2,
8989
NULL
9090
};
91-
9291
struct Group **getGroups() {
9392
return groups;
9493
}
@@ -99,9 +98,8 @@ struct Group *getDefaultGroup() {
9998

10099
In summary, each dotfile entry corresponds to some application and can have multiple dotfile files or directories. Then, group them by how you would like to deploy them. You must write `getGroups()` and `getDefaultGroup()` so `d` can see and use the groups that you have.
101100

102-
The really cool part about this, is that you can use macros. If you don't like
103-
macros, then maybe this software isn't for you. For an example, see my own
104-
[dotfiles.c](https://github.com/hyperupcall/dotfiles/blob/trunk/os-unix/data/dotfiles.c).
101+
The really cool part about this, is that you can use macros! This is your chance to be creative! See
102+
[my dotfiles.c](https://github.com/hyperupcall/dotfiles/blob/trunk/os-unix/data/dotfiles.c) for inspiration.
105103

106104
Now, you can use `d` like any other dotfile manager:
107105

config/d.service

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)