feat(git_branch): add 'only_attached' config bool (#1910)

* feat(git_branch): add 'only_attached' config bool

This adds a new boolean, `only_attached`, to the configuration for
the `git_branch` module. This mirrors the `only_detached` config
value for the `git_commit` module: setting the value to true causes
the module to suppress its output when the user is not on a branch.

This allows users to have either a branch name or a commit hash in
their prompt, as opposed to having either a branch name or the
overly-wordy "HEAD (sha1)".

* Fix formatting
This commit is contained in:
Aaron Gable
2020-11-23 10:22:51 -08:00
committed by GitHub
parent 29117c4817
commit 4b85b40cb0
3 changed files with 63 additions and 0 deletions
+1
View File
@@ -1030,6 +1030,7 @@ The `git_branch` module shows the active branch of the repo in your current dire
| `style` | `"bold purple"` | The style for the module. |
| `truncation_length` | `2^63 - 1` | Truncates a git branch to X graphemes. |
| `truncation_symbol` | `"…"` | The symbol used to indicate a branch name was truncated. You can use `""` for no symbol. |
| `only_attached` | `false` | Only show the branch name when not in a detached HEAD state. |
| `disabled` | `false` | Disables the `git_branch` module. |
### Variables