Skip to content

Commit da56a4d

Browse files
Travis Davisoknozor
authored andcommitted
docs: updated documentation for hooks
1 parent 4a21843 commit da56a4d

File tree

8 files changed

+143
-132
lines changed

8 files changed

+143
-132
lines changed

README.md

Lines changed: 101 additions & 95 deletions
Large diffs are not rendered by default.

cog.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ authors = [
2929
{ signature = "Paul Delafosse", username = "oknozor" },
3030
{ signature = "Dustin Speckhals", username = "DSpeckhals" },
3131
{ signature = "Lucas Declercq", username = "lucas-dclrcq" },
32-
]
32+
{ signature = "Travis Davis", username = "travisdavis-ops" },
33+
]

website/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ link = "https://googlechrome.github.io/lighthouse/viewer/?gist=7731347bb8ce999ef
3737

3838
[[extra.home.list]]
3939
title = "Installation hooks"
40-
content = "Live reload your window manager components with post installation hooks"
40+
content = "Live reload your window manager components with pre and post installation hooks"
4141

4242
[[extra.home.list]]
4343
title = "Themes and profiles"

website/content/docs/config-import/import.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ top = false
2020

2121
## Config imports
2222

23-
Instead of having all your configs defined in a single toml file, you can split it into multiple file :
23+
Instead of having all your configs defined in a single toml file, you can split it into multiple file :
2424

2525
```toml
2626

@@ -35,15 +35,15 @@ path = "sway/sway.toml"
3535
path = "i3/i3.toml"
3636
```
3737

38-
In this example we have defined our `i3` and `sway` profile in separate files :
38+
In this example we have defined our `i3` and `sway` profile in separate files :
3939

4040
```toml
4141
# {dotfile_dir}/i3/i3.toml
4242
[profiles.i3]
43-
hooks = ["i3-msg reload"]
43+
posthooks = ["i3-msg reload"]
4444

4545
[profiles.i3.dots]
4646
i3 = { source = "i3/wm", target = ".config/i3" }
4747
polybar = { source = "i3/polybar", target = ".config/polybar" }
4848
rofi = { source = "i3/rofi", target = ".config/rofi" }
49-
```
49+
```

website/content/docs/getting-started/quick-start.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ top = false
1616

1717
## Installation
1818

19-
Toml Bombadil is a single rust binary. Currently, you can install it via [cargo](https://doc.rust-lang.org/cargo/),
20-
the rust package manager, or via the Arch User Repository if you use an Arch based distro.
19+
Toml Bombadil is a single rust binary. Currently, you can install it via [cargo](https://doc.rust-lang.org/cargo/),
20+
the rust package manager, or via the Arch User Repository if you use an Arch based distro.
2121

22-
### Cargo
22+
### Cargo
2323

2424
```bash
2525
cargo install toml-bombadil
@@ -34,7 +34,7 @@ yay -S bombadil-bin
3434

3535
### Setup
3636

37-
If you already have some dotfiles on a git repository, no need to start from scratch :
37+
If you already have some dotfiles on a git repository, no need to start from scratch :
3838

3939
```bash
4040
git clone https://github.com/my_org/dotfiles
@@ -55,12 +55,12 @@ For Bombadil to be able to run from any directory and use different config files
5555
bombadil install -c my_dotfiles/bombadil.toml
5656
```
5757

58-
⚠️ : Toml Bombadil will generate a copy of your dotfiles under `.dots`. If you use git to manage your dotfiles,
58+
⚠️ : Toml Bombadil will generate a copy of your dotfiles under `.dots`. If you use git to manage your dotfiles,
5959
you need to add `.dots` to your `.gitignore`.
6060

6161
### Configuration
6262

63-
Toml Bombadil obviously uses the toml configuration format. here is a sample configuration :
63+
Toml Bombadil obviously uses the toml configuration format. here is a sample configuration :
6464

6565
```toml
6666
# {dotfiles}/bombadil.toml
@@ -70,31 +70,31 @@ dotfiles_dir = "my_dotfiles"
7070

7171
[settings]
7272
# An array of toml files paths containing the variables to inject in your templatized dotfiles
73-
# You can have multiple var files as long as variable names does not colide.
73+
# You can have multiple var files as long as variable names does not colide.
7474
vars = [ "vars.toml" ]
7575

7676
# An array of post install shell commands
77-
hooks = [ "sway reload" ]
77+
posthooks = [ "sway reload" ]
7878

7979
[settings.dots]
8080

81-
# A dot entry representing a symlink, `source` is relative to `dotfiles_dir`
81+
# A dot entry representing a symlink, `source` is relative to `dotfiles_dir`
8282
# and `target` shall be relative to $HOME directory or absolute.
8383
sway = { source = "sway", target = ".config/sway" }
8484

8585
# You can have as many dot entry as you want, linking files or directories
8686
alacritty = { source = "alacritty", target = ".config/alacritty/alacritty.yml" }
8787
```
8888

89-
Once you are satisfied with your config, you can install your dotfiles :
89+
Once you are satisfied with your config, you can install your dotfiles :
9090

9191
```bash
9292
bombadil link
9393
```
9494

9595
### Clean up
9696

97-
If you want to remove symlinks generated by Toml Bombadil run the following :
97+
If you want to remove symlinks generated by Toml Bombadil run the following :
9898
```bash
9999
bombadil unlink
100100
```
@@ -106,9 +106,9 @@ to their target locations. Instead, Toml Bombadil will create a copy of your dot
106106
those copy.
107107

108108
The idea behind this is to inject variables into your dotfiles and allow you to compose various themes and profiles.
109-
Because of this, you will need to reload your dotfiles with `bombadil link` whenever you make change.
109+
Because of this, you will need to reload your dotfiles with `bombadil link` whenever you make change.
110110

111-
A convenient way to work with Toml Bombadil would be to add a keyboard shortcut for `bombadil link` in your window manager.
111+
A convenient way to work with Toml Bombadil would be to add a keyboard shortcut for `bombadil link` in your window manager.
112112

113113
### Going further
114114

website/content/docs/hooks/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
+++
22
title = "Hooks"
3-
description = "Manage post install hook"
3+
description = "Manage pre & post install hook"
44
date = 2021-05-16
55
updated = 2021-05-16
66
template = "docs/section.html"

website/content/docs/hooks/hooks.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ template = "docs/page.html"
1010

1111
[extra]
1212
lead = """
13-
Bombadil's hooks are shell commands invoked after your dotfiles have been symlinked. They are useful if you need
14-
to reload some component manually after updating your dotfiles.
13+
Bombadil's hooks are shell commands invoked before and after your dotfiles have been symlinked. They are useful if you need
14+
to reload some component manually after updating your dotfiles.
1515
"""
1616
toc = true
1717
top = false
@@ -21,50 +21,54 @@ top = false
2121

2222
## Default profile hook
2323

24-
Hooks are defined under the default profile section in Bombadil's configuration. In the example above,
24+
Hooks are defined under the default profile section in Bombadil's configuration. In the example above,
2525
`sway reload` will run when running `bombadil link` to update any changes made to sway UI.
2626

2727
```toml
2828
dotfiles_dir = "bombadil-example.toml"
2929

3030
[settings]
31-
hooks = [ "sway reload" ]
31+
prehooks = [ "echo \"Updating dots\""]
32+
posthooks = [ "sway reload" ]
3233
```
3334

3435
The default hooks will always run regardless of the activated profiles.
3536

3637
## Profile hooks
3738

38-
If you maintain a profile per window manager you might want to leave the default profile hooks empty and manage
39-
per profile hooks :
39+
If you maintain a profile per window manager you might want to leave the default profile hooks empty and manage
40+
per profile hooks :
4041

4142
```toml
4243
[settings]
43-
hooks = [ "echo \"Default profile\"" ]
44+
prehooks = [ "echo \"Updating dots\""]
45+
posthooks = [ "echo \"Default profile\"" ]
4446

4547
[profiles.sway]
46-
hooks = [ "sway reload", "echo \"Sway profile\"" ]
48+
prehooks = [ "echo \"Sway profile\"" ]
49+
posthooks = [ "sway reload" ]
4750

4851
[profiles.i3]
49-
hooks = [ "i3-msg reload", "echo \"i3 profile\"" ]
52+
prehooks = [ "echo \"i3 profile\"" ]
53+
posthooks = [ "i3-msg reload" ]
5054
```
5155

5256
### Limitations
5357

5458
- Hooks run in a sub-shell therefore, **command meant to change your current shell environment won't work** :
5559

5660
```toml
57-
hooks = [ "source /home/user/.zshrc" ] # This does not work !
61+
posthooks = [ "source /home/user/.zshrc" ] # This does not work !
5862
```
5963

6064
- Environment variables won't be expanded unless you explicitly call a sub-shell :
6165

6266
```toml
63-
hooks = [ "echo $HOME" ] # This will print "$HOME"
67+
posthooks = [ "echo $HOME" ] # This will print "$HOME"
6468
```
6569

6670
```toml
67-
hooks = [ "zsh -c \"echo $HOME\"" ] # This works
71+
posthooks = [ "zsh -c \"echo $HOME\"" ] # This works
6872
```
6973

70-
That's it for hooks, in the next chapter we will see how to split your Bombadil config into multiple files.
74+
That's it for hooks, in the next chapter we will see how to split your Bombadil config into multiple files.

website/content/docs/profiles-and-themes/profiles.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Bombadil allow you two do this in several ways :
2626
- add hooks to the profile.
2727

2828

29-
Before going further, let's take a look at a real life example. In the following config, we have defined some
29+
Before going further, let's take a look at a real life example. In the following config, we have defined some
3030
post-install hooks and dot entries for two profiles : `sway` and `i3`.
3131

3232
```toml
@@ -38,7 +38,7 @@ alacritty = { source = "alacritty", target = ".config/alacritty" }
3838

3939
[profiles.sway]
4040
# Sway profile hook : running `bombadil link -p sway` will exectute `sway reload`
41-
hooks = ["sway reload"]
41+
posthooks = ["sway reload"]
4242

4343
# Sway profile dot entries
4444
[profiles.sway.dots]
@@ -48,7 +48,7 @@ wofi = { source = "sway/wofi", target = ".config/wofi" }
4848

4949
# i3 profile hook : running `bombadil link -p i3` will exectute `i3-msg reload`
5050
[profiles.i3]
51-
hooks = ["i3-msg reload"]
51+
posthooks = ["i3-msg reload"]
5252

5353
# i3 profile dot entries
5454
[profiles.i3.dots]
@@ -73,7 +73,7 @@ OPTIONS:
7373
-p, --profiles <profiles>... A list of comma separated profiles to activate [possible values: sway, i3]
7474
```
7575

76-
Alternatively the `bombadil get profiles` produce a one profiles per line output, suited for shell scripting :
76+
Alternatively the `bombadil get profiles` produce a one profiles per line output, suited for shell scripting :
7777
```
7878
❯ bombadil get profiles
7979
sway

0 commit comments

Comments
 (0)