Skip to content

Commit a41cdb8

Browse files
docs(config): name every template variable format_path builds (#3782)
Found by the nightly survey while reviewing `src/config/user/accessors.rs`. `UserConfig::format_path`'s `# Arguments` block doesn't match what the function builds. It documents `{{ main_worktree }}`, `{{ branch }}`, and `{{ owner }}`, and describes the `repo` parameter as being for "template function access" — but the function also inserts `{{ repo }}` (from `main_worktree`, not from `repo`) and `{{ repo_path }}` (read off `repo`). Both omissions are in `default_worktree_path()` in the same file — `"{{ repo_path }}/../{{ repo }}.{{ branch | sanitize }}"` — so the docstring omits two of the three variables the default template uses. The `{{ owner }}` line was also a bare bullet in the middle of the parameter list, describing a template variable rather than an argument, and it didn't note that `owner` is only inserted when `primary_remote_parsed_url()` returns a URL it can parse. This corrects the parameter descriptions, moves the template-variable note out of the argument list, and links the user-facing variable list at [worktrunk.dev/config](https://worktrunk.dev/config/#worktree-path-template) rather than duplicating it here (verified: the page returns 200 and carries that anchor). No test: the change is a doc comment only, with no behavior to exercise. `cargo fmt --check` and `cargo doc --no-deps -p worktrunk` are clean. Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
1 parent ec0f3a3 commit a41cdb8

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎src/config/user/accessors.rs‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,18 @@ impl UserConfig {
229229
/// Format a worktree path using this configuration's template.
230230
///
231231
/// # Arguments
232-
/// * `main_worktree` - Main worktree directory name (replaces {{ main_worktree }} in template)
232+
/// * `main_worktree` - Main worktree directory name; supplies both
233+
/// `{{ main_worktree }}` and `{{ repo }}`
233234
/// * `branch` - Branch name (replaces {{ branch }} in template; use `{{ branch | sanitize }}` for paths)
234-
/// * `repo` - Repository for template function access
235-
/// * remote owner/namespace is available as {{ owner }}
235+
/// * `repo` - Repository, for template function access and for the
236+
/// `{{ repo_path }}` and `{{ owner }}` values read off it —
237+
/// `{{ owner }}` is absent when the primary remote has no parseable URL
236238
/// * `project` - Optional project identifier (e.g., "github.com/user/repo") to look up
237239
/// project-specific worktree-path template
240+
///
241+
/// The default template uses `{{ repo_path }}`, `{{ repo }}`, and
242+
/// `{{ branch | sanitize }}`; the full user-facing list is in
243+
/// [the config docs](https://worktrunk.dev/config/#worktree-path-template).
238244
pub fn format_path(
239245
&self,
240246
main_worktree: &str,

0 commit comments

Comments
 (0)