From 8d2256ab1d0ba288fb6ba9b9248bc2210ca01059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Sat, 31 Dec 2022 15:53:55 +0100 Subject: feat(hg_branch): Add support for mercurial topics and find hg root dir (#4771) * feat(hg_branch): Add support for mercurial topics and find hg root dir * Fix clippy errors * Use crate::utils::read_file * Update config-schema.json * Extend PathExt to retrieve device ID of Path * Break hg root search when switching to another device * Fix clippy and formatting errors * Update docs/config/README.md Co-authored-by: David Knaack * Update src/modules/utils/path.rs Co-authored-by: David Knaack * Update src/configs/hg_branch.rs Co-authored-by: David Knaack * Update hg_branch description * Revert to lazy loading, use truncate_text from utils and use fake topic * Format code and fix clippy error * Revert to previous test string as topic is optional in the config * Fix doc formatting * Stub device_id for windows * Update config-schema.json * Update src/modules/hg_branch.rs Co-authored-by: David Knaack * Do not use unwrap in device_id * Fix formatter error * Use dev under non linux unixes Co-authored-by: David Knaack --- docs/config/README.md | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'docs/config/README.md') diff --git a/docs/config/README.md b/docs/config/README.md index f8b27bfd1..1fc4968fe 100644 --- a/docs/config/README.md +++ b/docs/config/README.md @@ -2643,26 +2643,27 @@ style = 'bold dimmed green' ## Mercurial Branch -The `hg_branch` module shows the active branch of the repo in your current directory. +The `hg_branch` module shows the active branch and topic of the repo in your current directory. ### Options -| Option | Default | Description | -| ------------------- | -------------------------------- | -------------------------------------------------------------------------------------------- | -| `symbol` | `' '` | The symbol used before the hg bookmark or branch name of the repo in your current directory. | -| `style` | `'bold purple'` | The style for the module. | -| `format` | `'on [$symbol$branch]($style) '` | The format for the module. | -| `truncation_length` | `2^63 - 1` | Truncates the hg branch name to `N` graphemes | -| `truncation_symbol` | `'…'` | The symbol used to indicate a branch name was truncated. | -| `disabled` | `true` | Disables the `hg_branch` module. | +| Option | Default | Description | +| ------------------- | ----------------------------------------- | -------------------------------------------------------------------------------------------- | +| `symbol` | `' '` | The symbol used before the hg bookmark or branch name of the repo in your current directory. | +| `style` | `'bold purple'` | The style for the module. | +| `format` | `'on [$symbol$branch(:$topic)]($style) '` | The format for the module. | +| `truncation_length` | `2^63 - 1` | Truncates the hg branch / topic name to `N` graphemes | +| `truncation_symbol` | `'…'` | The symbol used to indicate a branch name was truncated. | +| `disabled` | `true` | Disables the `hg_branch` module. | ### Variables -| Variable | Example | Description | -| -------- | -------- | ------------------------------------ | -| branch | `master` | The active mercurial branch | -| symbol | | Mirrors the value of option `symbol` | -| style\* | | Mirrors the value of option `style` | +| Variable | Example | Description | +| -------- | --------- | ------------------------------------ | +| branch | `master` | The active mercurial branch | +| topic | `feature` | The active mercurial topic | +| symbol | | Mirrors the value of option `symbol` | +| style\* | | Mirrors the value of option `style` | *: This variable can only be used as a part of a style string -- cgit v1.2.3