Skip to content

Commit 02c53b3

Browse files
committed
Revamp everything
1 parent b8d405d commit 02c53b3

File tree

19 files changed

+347
-1095
lines changed

19 files changed

+347
-1095
lines changed

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
*.o
2-
cosmopolitan/
3-
inih/
4-
.vscode/
5-
.cache/
2+
/d

Bakefile.sh

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
# shellcheck shell=bash
2-
32
# shellcheck disable=SC2086
43

54
init() {
6-
export LD_LIBRARY_PATH=./inih/build
75
CFLAGS='-Wall -Wextra -Wpedantic -g -Wno-unused-variable -Wno-unused-parameter'
86
}
97

8+
task.install() {
9+
make CONFIG_FILE="$HOME/.dotfiles/os-unix/data/dotfiles.h" install
10+
}
11+
1012
task.build() {
11-
gcc -L ./inih/build $CFLAGS main.c -DIS_NOT_TEST -linih -o ./main
13+
gcc $CFLAGS d.c -o ./d
1214
}
1315

1416
task.run() {
1517
task.build
1618
DEBUG=1 ./main "$@"
1719
}
18-
19-
task.test() {
20-
gcc -L ./inih/build $CFLAGS main.c test.c -linih -o ./test \
21-
&& DEBUG=1 ./test "$@"
22-
}

Makefile

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

README.md

Lines changed: 49 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,69 @@
11
# d
22

3-
I'm implementing another dotfile manager 😮‍💨
3+
![Sun God](./assets/sun-god.png)
44

5-
- I stopped working on [dotfox](https://github.com/fox-archives/dotfox) because I [lost confidence](https://forum.nim-lang.org/t/10312#68553) in the [social](https://forum.dlang.org/post/[email protected]) and [technical](https://news.ycombinator.com/threads?id=carterza) leadership for the language I was using, Nim
6-
- [dotmgr](https://github.com/hyperupcall/dotmgr) was supposed to replace it, but it grew too much in scope and it doesn't work on all platforms (Cygwin)
5+
---
76

8-
I've learned some things:
7+
A dotfile manager.
98

10-
- Continue to use symlinks
11-
- Continue to implement undeploy
12-
- Continue to properly test
13-
- Explicitly specify if file/directory
14-
- That way, a directory can exist at source location (with multiple choices)
15-
- Implement interactive mode
16-
- Implement command to interactively swap out file
17-
- Make status updates one line
9+
## Features
1810

19-
## Additional Goals
20-
21-
- Heapless (TODO)
22-
- Multi-platform
11+
- NOT "SUCKLESS" (IF YOU HAVE TO CONVINCE ME THAT YOUR SOFTWARE "SUCKS LESS", THEN IT ACTUALLY SUCKS!)
12+
- NO "CONFIGURATION FILES" (THE CONCEPT OF "CONFIGURATION FILES" SHOULD NOT EXIST!)
13+
- NO "DOCUMENTATION" (WHAT IS THAT?)
14+
- NOT WRITTEN IN RUST (NO, I'M NOT INSANE!)
2315

2416
## Summary
2517

26-
### Config
18+
On a more serious note, `d` is your standard dotfile manager, with the twist that it can be configured using C, hopefully leveraging the ~~cursed~~ C preprocessor. It's meant to be small and only does what it says it does.
2719

28-
Configure which files to manage with an INI-style file.
20+
It approaches reconciliation using symlinks. It doesn't support templates or any of that nonsense.
2921

30-
First, label the location of the source and target directories. All paths are relative to these
22+
A disclaimer for those curious to use `d`: currently, the code is dogshit. But I'm sure that many of you wouldn't mind one bit.
3123

32-
```ini
33-
source_root_dir = $pwd/source
34-
target_root_dir = $pwd/target
35-
```
24+
### Usage
3625

37-
Then, come the variables. By default, `$home` and `$pwd` (relative to the file) are defined, but you can define more (TODO)
26+
```bash
27+
git clone [email protected]:fox-incubating/d
28+
cd ./d
29+
# Currently a few things are hardcoded. If you're still as brave as you think you are,
30+
# you can check the TODO comments in the source
31+
make CONFIG_FILE="$HOME/dotfiles.c" install
32+
```
3833

39-
```ini
40-
[vars]
41-
cfg = ${XDG_CONFIG_HOME:-$HOME/.config}
42-
data = ${XDG_DATA_HOME:-$HOME/.local/share}
43-
state = ${XDG_DATA_HOME:-$HOME/.local/state}
34+
`CONFIG_FILE` should look something like:
35+
36+
```c
37+
struct Entry {
38+
char const *category;
39+
char const *source;
40+
char const *destination;
41+
};
42+
#define Done { \
43+
.category = NULL, .source = NULL, .destination = NULL \
44+
}
45+
46+
static struct Entry bash[] = {
47+
{
48+
.category = "bash"
49+
.source = "/home/edwin/.dotfiles/.bashrc",
50+
.destination = "/home/edwin/.bashrc"
51+
},
52+
Done
53+
};
54+
55+
struct Entry *configuration[] = {
56+
bash
57+
};
4458
```
4559

46-
Lastly, list your entries. There are two types:
60+
The really cool part about this, is that you can use macros. If you don't like macros, then maybe this software isn't for you. For an example, see my own [dotfiles.c](https://github.com/hyperupcall/dotfiles/blob/trunk/os-unix/data/dotfiles.c). Later I'll probably support some sort of `get_configuration()` to allow the use of runtime shenanigans.
4761

48-
Tags are TODO
62+
Whenever you edit, you must run `./d compile` to compile the C program into a shared object file. It'll be dynamically loaded on subsequent invocations. Maybe I'll add a file watcher sometime.
4963

50-
```ini
51-
[entry]
52-
path = .bashrc
53-
what = file
54-
tags = [Bash]
64+
Now, you can use `d` like any other dotfile manager:
5565

56-
[entry]
57-
source = $cfg/X11/xinitrc
58-
target = $home/.xinitrc
59-
what = file
60-
tags = [X11]
66+
```console
67+
$ d deploy
68+
$ d undeploy
6169
```

assets/sun-god.png

83.4 KB
Loading

bin/d.c

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

config/d.service

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[Unit]
2+
Description=Antarctica
3+
4+
[Service]
5+
Type=notify
6+
ExecStart=%h/bin/d watch-config
7+
8+
[Install]
9+
WantedBy=default.target

0 commit comments

Comments
 (0)