diff --git a/docs/config/README.md b/docs/config/README.md index 390fe5f322c6..b150ad901300 100644 --- a/docs/config/README.md +++ b/docs/config/README.md @@ -493,13 +493,6 @@ truncation_symbol = "" The `git_commit` module shows the current commit hash of the repo in your current directory. -::: tip - -This module is disabled by default. -To enable it, set `disabled` to `false` in your configuration file. - -::: - ### Options | Variable | Default | Description | @@ -508,8 +501,8 @@ To enable it, set `disabled` to `false` in your configuration file. | `prefix` | `"("` | Prefix to display immediately before git commit. | | `suffix` | `")"` | Suffix to display immediately after git commit. | | `style` | `"bold green"` | The style for the module. | -| `only_detached` | `false` | Only show git commit hash when in detached HEAD state | -| `disabled` | `true` | Disables the `git_commit` module. | +| `only_detached` | `true` | Only show git commit hash when in detached HEAD state | +| `disabled` | `false` | Disables the `git_commit` module. | ### Example @@ -517,7 +510,6 @@ To enable it, set `disabled` to `false` in your configuration file. # ~/.config/starship.toml [git_commit] -disabled = false commit_hash_length = 4 ``` diff --git a/docs/de-DE/config/README.md b/docs/de-DE/config/README.md index debfdba0ac48..68d3d34bffb5 100644 --- a/docs/de-DE/config/README.md +++ b/docs/de-DE/config/README.md @@ -463,21 +463,16 @@ truncation_symbol = "" The `git_commit` module shows the current commit hash of the repo in your current directory. -::: tip - -Dieses Modul ist standardmäßig deaktiviert. Setze in deiner Konfiguration `disabled` auf `false` um es zu aktivieren. - -::: - ### Optionen -| Variable | Standardwert | Beschreibung | -| -------------------- | -------------- | ------------------------------------------------ | -| `commit_hash_length` | `7` | The length of the displayed git commit hash. | -| `prefix` | `"("` | Prefix to display immediately before git commit. | -| `suffix` | `")"` | Suffix to display immediately after git commit. | -| `style` | `"bold green"` | Stil für dieses Modul. | -| `disabled` | `true` | Disables the `git_commit` module. | +| Variable | Standardwert | Beschreibung | +| -------------------- | -------------- | ------------------------------------------------------- | +| `commit_hash_length` | `7` | The length of the displayed git commit hash. | +| `prefix` | `"("` | Prefix to display immediately before git commit. | +| `suffix` | `")"` | Suffix to display immediately after git commit. | +| `style` | `"bold green"` | Stil für dieses Modul. | +| `only_detached` | `true` | Zeigt den Commit Hash nur im Status "detached HEAD" an. | +| `disabled` | `false` | Disables the `git_commit` module. | ### Beispiel @@ -485,7 +480,6 @@ Dieses Modul ist standardmäßig deaktiviert. Setze in deiner Konfiguration `dis # ~/.config/starship.toml [git_commit] -disabled = false commit_hash_length = 4 ``` diff --git a/docs/es-ES/config/README.md b/docs/es-ES/config/README.md index 9591967aca55..10db5881d1e0 100644 --- a/docs/es-ES/config/README.md +++ b/docs/es-ES/config/README.md @@ -463,21 +463,16 @@ truncation_symbol = "" The `git_commit` module shows the current commit hash of the repo in your current directory. -::: tip - -This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file. - -::: - ### Options -| Variable | Default | Description | -| -------------------- | -------------- | ------------------------------------------------ | -| `commit_hash_length` | `7` | The length of the displayed git commit hash. | -| `prefix` | `"("` | Prefix to display immediately before git commit. | -| `suffix` | `")"` | Suffix to display immediately after git commit. | -| `style` | `"bold green"` | The style for the module. | -| `disabled` | `true` | Disables the `git_commit` module. | +| Variable | Default | Description | +| -------------------- | -------------- | ----------------------------------------------------- | +| `commit_hash_length` | `7` | The length of the displayed git commit hash. | +| `prefix` | `"("` | Prefix to display immediately before git commit. | +| `suffix` | `")"` | Suffix to display immediately after git commit. | +| `style` | `"bold green"` | The style for the module. | +| `only_detached` | `true` | Only show git commit hash when in detached HEAD state | +| `disabled` | `false` | Disables the `git_commit` module. | ### Example @@ -485,7 +480,6 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y # ~/.config/starship.toml [git_commit] -disabled = false commit_hash_length = 4 ``` diff --git a/docs/fr-FR/config/README.md b/docs/fr-FR/config/README.md index 5452dd9f7407..a6af38929f4a 100644 --- a/docs/fr-FR/config/README.md +++ b/docs/fr-FR/config/README.md @@ -463,21 +463,16 @@ truncation_symbol = "" The `git_commit` module shows the current commit hash of the repo in your current directory. -::: tip - -This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file. - -::: - ### Options -| Variable | Default | Description | -| -------------------- | -------------- | ------------------------------------------------ | -| `commit_hash_length` | `7` | The length of the displayed git commit hash. | -| `prefix` | `"("` | Prefix to display immediately before git commit. | -| `suffix` | `")"` | Suffix to display immediately after git commit. | -| `style` | `"bold green"` | The style for the module. | -| `disabled` | `true` | Disables the `git_commit` module. | +| Variable | Default | Description | +| -------------------- | -------------- | ----------------------------------------------------- | +| `commit_hash_length` | `7` | The length of the displayed git commit hash. | +| `prefix` | `"("` | Prefix to display immediately before git commit. | +| `suffix` | `")"` | Suffix to display immediately after git commit. | +| `style` | `"bold green"` | The style for the module. | +| `only_detached` | `true` | Only show git commit hash when in detached HEAD state | +| `disabled` | `false` | Disables the `git_commit` module. | ### Example @@ -485,7 +480,6 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y # ~/.config/starship.toml [git_commit] -disabled = false commit_hash_length = 4 ``` diff --git a/docs/ja-JP/config/README.md b/docs/ja-JP/config/README.md index a25518961000..13ac5db305df 100644 --- a/docs/ja-JP/config/README.md +++ b/docs/ja-JP/config/README.md @@ -463,12 +463,6 @@ truncation_symbol = "" `git_commit`モジュールは、現在のディレクトリにあるリポジトリの現在のコミットハッシュを表示します。 -::: tip - -このモジュールはデフォルトで無効になっています。 有効にするには、設定ファイルで`disabled`を`false`に設定します。 - -::: - ### オプション | 変数 | デフォルト | 説明 | @@ -477,7 +471,8 @@ truncation_symbol = "" | `prefix` | `"("` | このモジュールの先頭に表示される文字列です。 | | `suffix` | `")"` | このモジュールの末尾に表示される文字列です。 | | `style` | `"bold green"` | モジュールのスタイルです。 | -| `disabled` | `true` | `git_commit`モジュールを無効にします。 | +| `only_detached` | `true` | Only show git commit hash when in detached HEAD state | +| `disabled` | `false` | `git_commit`モジュールを無効にします。 | ### 設定例 @@ -485,7 +480,6 @@ truncation_symbol = "" # ~/.config/starship.toml [git_commit] -disabled = false commit_hash_length = 4 ``` diff --git a/docs/ru-RU/config/README.md b/docs/ru-RU/config/README.md index 6eeb0059e116..9371fd0a25ba 100644 --- a/docs/ru-RU/config/README.md +++ b/docs/ru-RU/config/README.md @@ -463,21 +463,16 @@ truncation_symbol = "" Модуль `git_commit` показывает хэш текущего коммита репозитория в вашем текущем каталоге. -::: tip Подсказка - -По умолчанию этот модуль отключен. Чтобы включить его, установите `disabled` на `false` в файле конфигурации. - -::: - ### Опции -| Переменная | По умолчанию | Описание | -| -------------------- | -------------- | ---------------------------------------------- | -| `commit_hash_length` | `7` | Длина отображаемого хэша коммита git. | -| `prefix` | `"("` | Префикс, отображаемый сразу после коммита. | -| `suffix` | `")"` | Суффикс, отображаемый сразу после коммита git. | -| `style` | `"bold green"` | Стиль модуля. | -| `disabled` | `true` | Отключает модуль `git_commit`. | +| Переменная | По умолчанию | Описание | +| -------------------- | -------------- | ----------------------------------------------------- | +| `commit_hash_length` | `7` | Длина отображаемого хэша коммита git. | +| `prefix` | `"("` | Префикс, отображаемый сразу после коммита. | +| `suffix` | `")"` | Суффикс, отображаемый сразу после коммита git. | +| `style` | `"bold green"` | Стиль модуля. | +| `only_detached` | `true` | Only show git commit hash when in detached HEAD state | +| `disabled` | `false` | Отключает модуль `git_commit`. | ### Пример @@ -485,7 +480,6 @@ truncation_symbol = "" # ~/.config/starship.toml [git_commit] -disabled = false commit_hash_length = 4 ``` diff --git a/docs/zh-CN/config/README.md b/docs/zh-CN/config/README.md index 486485731ad5..ef77cf629bb9 100644 --- a/docs/zh-CN/config/README.md +++ b/docs/zh-CN/config/README.md @@ -463,12 +463,6 @@ truncation_symbol = "" `git_commit` 组件显示当前目录的 git 仓库的当前提交的哈希值。 -::: tip - -此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`。 - -::: - ### 配置项 | 字段 | 默认值 | 描述 | @@ -477,7 +471,8 @@ truncation_symbol = "" | `prefix` | `"("` | 直接在 git 提交哈希值前显示的前缀。 | | `suffix` | `")"` | 直接在 git 提交哈希值后显示的后缀。 | | `style` | `"bold green"` | 此组件的样式。 | -| `disabled` | `true` | 禁用 `git_commit` 组件。 | +| `only_detached` | `true` | Only show git commit hash when in detached HEAD state | +| `disabled` | `false` | 禁用 `git_commit` 组件。 | ### 示例 @@ -485,7 +480,6 @@ truncation_symbol = "" # ~/.config/starship.toml [git_commit] -disabled = false commit_hash_length = 4 ``` diff --git a/docs/zh-TW/config/README.md b/docs/zh-TW/config/README.md index 36ded60f1409..2df02e4d806d 100644 --- a/docs/zh-TW/config/README.md +++ b/docs/zh-TW/config/README.md @@ -463,12 +463,6 @@ truncation_symbol = "" The `git_commit` module shows the current commit hash of the repo in your current directory. -::: tip - -這個模組預設是停用的。 想要啟用它的話,請在設定檔中將 `disabled` 設定為 `false`。 - -::: - ### 選項 | 變數 | 預設 | 說明 | @@ -477,7 +471,8 @@ The `git_commit` module shows the current commit hash of the repo in your curren | `prefix` | `"("` | Prefix to display immediately before git commit. | | `suffix` | `")"` | Suffix to display immediately after git commit. | | `style` | `"bold green"` | 這個模組的風格。 | -| `disabled` | `true` | Disables the `git_commit` module. | +| `only_detached` | `true` | Only show git commit hash when in detached HEAD state | +| `disabled` | `false` | Disables the `git_commit` module. | ### 範例 @@ -485,7 +480,6 @@ The `git_commit` module shows the current commit hash of the repo in your curren # ~/.config/starship.toml [git_commit] -disabled = false commit_hash_length = 4 ``` diff --git a/src/configs/git_commit.rs b/src/configs/git_commit.rs index f32b6453942e..2efe0e3fb64e 100644 --- a/src/configs/git_commit.rs +++ b/src/configs/git_commit.rs @@ -23,8 +23,8 @@ impl<'a> RootModuleConfig<'a> for GitCommitConfig<'a> { prefix: "(", suffix: ") ", style: Color::Green.bold(), - only_detached: false, - disabled: true, + only_detached: true, + disabled: false, } } } diff --git a/src/modules/git_commit.rs b/src/modules/git_commit.rs index 3265fc887de1..36e68913de35 100644 --- a/src/modules/git_commit.rs +++ b/src/modules/git_commit.rs @@ -9,9 +9,6 @@ use crate::configs::git_commit::GitCommitConfig; pub fn module<'a>(context: &'a Context) -> Option> { let mut module = context.new_module("git_commit"); let config = GitCommitConfig::try_load(module.config); - if config.disabled { - return None; - }; module .get_prefix() diff --git a/tests/testsuite/git_commit.rs b/tests/testsuite/git_commit.rs index 9fe3c70526f5..fdae075ab908 100644 --- a/tests/testsuite/git_commit.rs +++ b/tests/testsuite/git_commit.rs @@ -19,7 +19,7 @@ fn test_render_commit_hash() -> io::Result<()> { let output = common::render_module("git_commit") .use_config(toml::toml! { [git_commit] - disabled = false + only_detached = false }) .arg("--path") .arg(repo_dir) @@ -50,7 +50,7 @@ fn test_render_commit_hash_len_override() -> io::Result<()> { let output = common::render_module("git_commit") .use_config(toml::toml! { [git_commit] - disabled = false + only_detached = false commit_hash_length = 14 }) .arg("--path") @@ -72,11 +72,6 @@ fn test_render_commit_hash_only_detached_on_branch() -> io::Result<()> { let repo_dir = common::create_fixture_repo()?; let output = common::render_module("git_commit") - .use_config(toml::toml! { - [git_commit] - disabled = false - only_detached = true - }) .arg("--path") .arg(repo_dir) .output()?; @@ -105,11 +100,6 @@ fn test_render_commit_hash_only_detached_on_detached() -> io::Result<()> { let expected_hash = str::from_utf8(&git_output).unwrap(); let output = common::render_module("git_commit") - .use_config(toml::toml! { - [git_commit] - disabled = false - only_detached = true - }) .arg("--path") .arg(repo_dir) .output()?;