You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,7 +84,7 @@ Something else!
84
84
(Important stuff)
85
85
```
86
86
87
-
Let's say you wanted just `"[!h]"` to end all sections. Instead of modifying `./core/defaults/config.lua`, you can create a custom configuration in `./configs.lua`. The file should export a table where each config is mapped to a string. If you have a config mapped to `"DEFAULT"` (caps-sensitive), then crazywall will give this config priority over the other one, and fall back to the global defaults only when necessary. To use a specific custom config (e.g. `"foo"`), run `$ cw --config foo` or `$ cw -c foo`.
87
+
Let's say you wanted just `"[!h]"` to end all sections. Instead of modifying `./crazywall/core/defaults/config.lua`, you can create a custom configuration in `./configs.lua`. The file should export a table where each config is mapped to a string. If you have a config mapped to `"DEFAULT"` (caps-sensitive), then crazywall will give this config priority over the other one, and fall back to the global defaults only when necessary. To use a specific custom config (e.g. `"foo"`), run `$ cw --config foo` or `$ cw -c foo`.
88
88
89
89
Here's an example `./configs.lua` setup to use `"[!h]"` for all close tags.
90
90
@@ -127,11 +127,11 @@ To understand what each config option does, it's helpful to explain what happens
127
127
1. **Command-line arguments are parsed**
128
128
- See [Arguments](#arguments).
129
129
2. **Some initialization is done.**
130
-
- A [`Config`](./core/config.lua) object is created, based on the specified `--config` or `"DEFAULT"`. Missing options are filled in using global defaults from `./core/defaults/config.lua`.
131
-
- A [`Context`](./core/context.lua) object is created using the config, the text of the source file, and the command line arguments.
132
-
3. **The source text is parsed (see [`fold.parse`](./core/fold.lua)).**
130
+
- A [`Config`](./crazywall/core/config.lua) object is created, based on the specified `--config` or `"DEFAULT"`. Missing options are filled in using global defaults from `./crazywall/core/defaults/config.lua`.
131
+
- A [`Context`](./crazywall/core/context.lua) object is created using the config, the text of the source file, and the command line arguments.
132
+
3. **The source text is parsed (see [`fold.parse`](./crazywall/core/fold.lua)).**
133
133
- The entire source file is modeled as a doubly-linked tree of `Section` nodes, which can be traversed via `section.parent` and `section.children`.
134
-
- A [`Section`](./core/section.lua) object is created with note type `{ "ROOT" }`, representing the entire source text.
134
+
- A [`Section`](./crazywall/core/section.lua) object is created with note type `{ "ROOT" }`, representing the entire source text.
135
135
- crazywall then parses the file using `config.note_schema`. `config.note_schema` should be a list of "note types", where each "note type" is a list of 3 strings:
136
136
- the name of the note type
137
137
- the open tag
@@ -161,7 +161,7 @@ To understand what each config option does, it's helpful to explain what happens
161
161
└── * h1 section (lines 11 - 11)
162
162
```
163
163
164
-
4. **Some preparation is done (see [`fold.prepare`](./core/fold.lua)).**
164
+
4. **Some preparation is done (see [`fold.prepare`](./crazywall/core/fold.lua)).**
165
165
- First, paths are resolved for each section.
166
166
- The root section has its `section.path` manually set to the destination path speciffied by the command-line arguments (defaults to the same path as the source file).
167
167
- All other sections are visited [in preorder](https://commons.wikimedia.org/wiki/File:Preorder-traversal.gif) (i.e. outtermost-in). For each section,
@@ -180,8 +180,8 @@ To understand what each config option does, it's helpful to explain what happens
180
180
- If the function returns `false`, then *all* of the lines of the section will be deleted in the source text.
181
181
- `config.transform_lines(...)` will not be called on the root sectoin.
182
182
183
-
5. **crazywall executes the fold in dry-run mode (see [`fold.prepare`](./core/fold.lua)).**
184
-
- Regardless of whether or not `--dry-run` was actually passed, crazywall will always do a dry-run before executing. In this step, a [`Plan`](./core/plan/plan.lua) gets created, detailing all the filesystem changes that will be made.
183
+
5. **crazywall executes the fold in dry-run mode (see [`fold.prepare`](./crazywall/core/fold.lua)).**
184
+
- Regardless of whether or not `--dry-run` was actually passed, crazywall will always do a dry-run before executing. In this step, a [`Plan`](./crazywall/core/plan/plan.lua) gets created, detailing all the filesystem changes that will be made.
185
185
- The sections are preorder traversed. For each section:
186
186
- If a file or directory already exists at `section.path`
187
187
- and `config.allow_overwrite == true`, then crazywall will continue to the next step.
@@ -244,5 +244,5 @@ So, for example, if a section was assigned the path `Path.void()` and the refere
244
244
245
245
crazywall makes two important assumptions to keep behavior simple and predictable:
246
246
247
-
- Two paths with the same string reprsentation are the same, and two paths with different string representations are different. Because of this, **the [`Path`](./core/path.lua) class used only works with absolute paths**, and will throw an error if a relative path is given. To use `"~/"` and `"./"`, see [`Path:join()`](./core/path.lua).
247
+
- Two paths with the same string reprsentation are the same, and two paths with different string representations are different. Because of this, **the [`Path`](./crazywall/core/path.lua) class used only works with absolute paths**, and will throw an error if a relative path is given. To use `"~/"` and `"./"`, see [`Path:join()`](./crazywall/core/path.lua).
248
248
- No relevant filesystem changes occur between running `cw` and confirming. As stated previously, regardless of whether `--dry-run` was passed, crazywall will always do a dry-run before making any filesystem changes. If you run `cw`, then add or delete files, and then confirm, crazywall might nto be able to stick to the plan object it presented to you.
0 commit comments