1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-09-28 05:09:01 +00:00

New translations README.md (Chinese Simplified)

This commit is contained in:
Matan Kushner 2023-09-03 02:05:47 +01:00
parent 373d6c17e2
commit 468bc1607f

View File

@ -1638,7 +1638,7 @@ very-long-project-name = 'vlpn'
## Git Branch
The `git_branch` module shows the active branch of the repo in your current directory.
`git_branch` 组件显示当前目录的 git 仓库的活动分支。
### 配置项
@ -1652,7 +1652,7 @@ The `git_branch` module shows the active branch of the repo in your current dire
| `truncation_symbol` | `'…'` | 此字段的内容用来表示分支名称被截断。 You can use `''` for no symbol. |
| `only_attached` | `false` | Only show the branch name when not in a detached `HEAD` state. |
| `ignore_branches` | `[]` | A list of names to avoid displaying. Useful for 'master' or 'main'. |
| `disabled` | `false` | Disables the `git_branch` module. |
| `disabled` | `false` | 禁用 `git_branch` 组件。 |
### 变量
@ -1686,14 +1686,14 @@ The `git_commit` module shows the current commit hash and also the tag (if any)
| 选项 | 默认值 | 描述 |
| -------------------- | ------------------------------ | ------------------------------------------------------------------------------------ |
| `commit_hash_length` | `7` | The length of the displayed git commit hash. |
| `commit_hash_length` | `7` | 显示的 git 提交哈希值的长度。 |
| `format` | `'[\($hash$tag\)]($style) '` | 组件格式化模板。 |
| `style` | `'bold green'` | 此组件的样式。 |
| `only_detached` | `true` | Only show git commit hash when in detached `HEAD` state |
| `tag_disabled` | `true` | Disables showing tag info in `git_commit` module. |
| `tag_max_candidates` | `0` | How many commits to consider for tag display. The default only allows exact matches. |
| `tag_symbol` | `' 🏷 '` | Tag symbol prefixing the info shown |
| `disabled` | `false` | Disables the `git_commit` module. |
| `disabled` | `false` | 禁用 `git_commit` 组件。 |
### 变量
@ -1717,7 +1717,7 @@ tag_symbol = '🔖 '
## Git State
The `git_state` module will show in directories which are part of a git repository, and where there is an operation in progress, such as: _REBASING_, _BISECTING_, etc. If there is progress information (e.g., REBASING 3/10), that information will be shown too.
`git_state` 组件会显示当前目录在哪个 git 仓库中以及正在进行的操作例如_REBASING__BISECTING_ 等。 进度信息(例如 REBASING 3/10如果存在则也会被显示。
### 配置项
@ -1732,7 +1732,7 @@ The `git_state` module will show in directories which are part of a git reposito
| `am_or_rebase` | `'AM/REBASE'` | A format string displayed when an ambiguous `apply-mailbox` or `rebase` is in progress. |
| `style` | `'bold yellow'` | 此组件的样式。 |
| `format` | `'\([$state( $progress_current/$progress_total)]($style)\) '` | 组件格式化模板。 |
| `disabled` | `false` | Disables the `git_state` module. |
| `disabled` | `false` | 禁用 `git_state` 组件。 |
### 变量
@ -1761,7 +1761,7 @@ The `git_metrics` module will show the number of added and deleted lines in the
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
:::
@ -1774,7 +1774,7 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
| `only_nonzero_diffs` | `true` | Render status only for changed items. |
| `format` | `'([+$added]($added_style) )([-$deleted]($deleted_style) )'` | 组件格式化模板。 |
| `disabled` | `true` | Disables the `git_metrics` module. |
| `ignore_submodules` | `false` | Ignore changes to submodules |
| `忽略子模块` | `false` | 忽略子模块的更改 |
### 变量
@ -1799,7 +1799,7 @@ format = '[+$added]($added_style)/[-$deleted]($deleted_style) '
## Git Status
The `git_status` module shows symbols representing the state of the repo in your current directory.
`git_status`组件通过相应的符号显示您当前目录中 git 仓库的状态。
::: tip
@ -1809,25 +1809,25 @@ The Git Status module is very slow in Windows directories (for example under `/m
### 配置项
| 选项 | 默认值 | 描述 |
| ------------------- | ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `format` | `'([\[$all_status$ahead_behind\]]($style) )'` | The default format for `git_status` |
| `conflicted` | `'='` | This branch has merge conflicts. |
| `ahead` | `'⇡'` | The format of `ahead` |
| `behind` | `'⇣'` | The format of `behind` |
| `diverged` | `'⇕'` | The format of `diverged` |
| `up_to_date` | `''` | The format of `up_to_date` |
| `untracked` | `'?'` | The format of `untracked` |
| `stashed` | `'$'` | The format of `stashed` |
| `modified` | `'!'` | The format of `modified` |
| `staged` | `'+'` | The format of `staged` |
| `renamed` | `'»'` | The format of `renamed` |
| `deleted` | `'✘'` | The format of `deleted` |
| `typechanged` | `""` | The format of `typechange` |
| `style` | `'bold red'` | 此组件的样式。 |
| `ignore_submodules` | `false` | Ignore changes to submodules. |
| `disabled` | `false` | Disables the `git_status` module. |
| `windows_starship` | | Use this (Linux) path to a Windows Starship executable to render `git_status` when on Windows paths in WSL. |
| 选项 | 默认值 | 描述 |
| ------------------ | ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `format` | `'([\[$all_status$ahead_behind\]]($style) )'` | The default format for `git_status` |
| `conflicted` | `'='` | 这个分支有合并冲突。 |
| `ahead` | `'⇡'` | The format of `ahead` |
| `behind` | `'⇣'` | The format of `behind` |
| `diverged` | `'⇕'` | The format of `diverged` |
| `up_to_date` | `''` | The format of `up_to_date` |
| `untracked` | `'?'` | The format of `untracked` |
| `stashed` | `'$'` | The format of `stashed` |
| `modified` | `'!'` | The format of `modified` |
| `staged` | `'+'` | The format of `staged` |
| `renamed` | `'»'` | The format of `renamed` |
| `deleted` | `'✘'` | The format of `deleted` |
| `typechanged` | `""` | The format of `typechange` |
| `style` | `'bold red'` | 此组件的样式。 |
| `忽略子模块` | `false` | 忽略子模块的更改. |
| `disabled` | `false` | 禁用 `git_status` 组件。 |
| `windows_starship` | | Use this (Linux) path to a Windows Starship executable to render `git_status` when on Windows paths in WSL. |
### 变量
@ -1858,9 +1858,9 @@ The following variables can be used in `diverged`:
The following variables can be used in `conflicted`, `ahead`, `behind`, `untracked`, `stashed`, `modified`, `staged`, `renamed` and `deleted`:
| 字段 | 描述 |
| ------- | ------------------------ |
| `count` | Show the number of files |
| 字段 | 描述 |
| ------- | --------- |
| `count` | 显示相应的文件数量 |
### 示例
@ -1927,7 +1927,7 @@ The `golang` module shows the currently installed version of [Go](https://golang
| `detect_folders` | `['Godeps']` | Which folders should trigger this module. |
| `style` | `'bold cyan'` | 此组件的样式。 |
| `not_capable_style` | `'bold red'` | The style for the module when the go directive in the go.mod file does not match the installed Go version. |
| `disabled` | `false` | Disables the `golang` module. |
| `disabled` | `false` | 禁用 `golang` 组件。 |
### 变量
@ -2044,7 +2044,7 @@ By default the module will be shown if any of the following conditions are met:
| `detect_files` | `['stack.yaml', 'cabal.project']` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `'bold purple'` | 此组件的样式。 |
| `disabled` | `false` | Disables the `haskell` module. |
| `disabled` | `false` | 禁用 `haskell` 组件。 |
### 变量
@ -2139,18 +2139,18 @@ format = 'via [⎈ $version](bold white) '
## Hostname
The `hostname` module shows the system hostname.
`hostname` 组件显示系统主机名。
### 配置项
| 选项 | 默认值 | 描述 |
| ------------ | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `ssh_only` | `true` | Only show hostname when connected to an SSH session. |
| `ssh_symbol` | `'🌐 '` | A format string representing the symbol when connected to SSH session. |
| `trim_at` | `'.'` | String that the hostname is cut off at, after the first match. `'.'` will stop after the first dot. `''` will disable any truncation |
| `format` | `'[$ssh_symbol$hostname]($style) in '` | 组件格式化模板。 |
| `style` | `'bold dimmed green'` | 此组件的样式。 |
| `disabled` | `false` | Disables the `hostname` module. |
| 选项 | 默认值 | 描述 |
| ------------ | -------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| `ssh_only` | `true` | 仅在连接到 SSH 会话时显示主机名。 |
| `ssh_symbol` | `'🌐 '` | A format string representing the symbol when connected to SSH session. |
| `trim_at` | `'.'` | 当主机名过长被截断时,会截断成第一次匹配该字符串之前的主机名。 `'.'` will stop after the first dot. `''` will disable any truncation |
| `format` | `'[$ssh_symbol$hostname]($style) in '` | 组件格式化模板。 |
| `style` | `'bold dimmed green'` | 此组件的样式。 |
| `disabled` | `false` | 禁用 `hostname` 组件。 |
### 变量
@ -2192,7 +2192,7 @@ The `java` module shows the currently installed version of [Java](https://www.or
| `detect_folders` | `[]` | Which folders should trigger this modules. |
| `符号` | `'☕ '` | A format string representing the symbol of Java |
| `style` | `'red dimmed'` | 此组件的样式。 |
| `disabled` | `false` | Disables the `java` module. |
| `disabled` | `false` | 禁用 `java` 组件。 |
### 变量
@ -2215,7 +2215,7 @@ symbol = '🌟 '
## Jobs
The `jobs` module shows the current number of jobs running. The module will be shown only if there are background jobs running. The module will show the number of jobs running if there are at least 2 jobs, or more than the `number_threshold` config value, if it exists. The module will show a symbol if there is at least 1 job, or more than the `symbol_threshold` config value, if it exists. You can set both values to 0 in order to _always_ show the symbol and number of jobs, even if there are 0 jobs running.
`jobs` 组件显示当前正在运行的任务数量。 仅当有后台任务运行时,此组件才会显示。 The module will show the number of jobs running if there are at least 2 jobs, or more than the `number_threshold` config value, if it exists. The module will show a symbol if there is at least 1 job, or more than the `symbol_threshold` config value, if it exists. You can set both values to 0 in order to _always_ show the symbol and number of jobs, even if there are 0 jobs running.
The default functionality is:
@ -2239,13 +2239,13 @@ The `threshold` option is deprecated, but if you want to use it, the module will
| 选项 | 默认值 | 描述 |
| ------------------ | ----------------------------- | ------------------------------------------------------------------------ |
| `threshold`* | `1` | Show number of jobs if exceeded. |
| `threshold`* | `1` | 如果超过此字段的值,显示任务数量。 |
| `symbol_threshold` | `1` | Show `symbol` if the job count is at least `symbol_threshold`. |
| `number_threshold` | `2` | Show the number of jobs if the job count is at least `number_threshold`. |
| `format` | `'[$symbol$number]($style) '` | 组件格式化模板。 |
| `符号` | `'✦'` | The string used to represent the `symbol` variable. |
| `style` | `'bold blue'` | 此组件的样式。 |
| `disabled` | `false` | Disables the `jobs` module. |
| `disabled` | `false` | 禁用 `jobs` 组件。 |
*: This option is deprecated, please use the `number_threshold` and `symbol_threshold` options instead.
@ -2363,7 +2363,7 @@ Displays the current [Kubernetes context](https://kubernetes.io/docs/concepts/co
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
When the module is enabled it will always be active, unless any of `detect_extensions`, `detect_files` or `detect_folders` have been set in which case the module will only be active in directories that match those conditions.
@ -2475,13 +2475,13 @@ context_alias = "gke-$cluster"
## Line Break
The `line_break` module separates the prompt into two lines.
`line_break` 组件将提示分隔为两行。
### 配置项
| 选项 | 默认值 | 描述 |
| ---------- | ------- | ------------------------------------------------------------------ |
| `disabled` | `false` | Disables the `line_break` module, making the prompt a single line. |
| 选项 | 默认值 | 描述 |
| ---------- | ------- | --------------------------- |
| `disabled` | `false` | 禁用 `line_break` 组件,使提示成为单行。 |
### 示例
@ -2568,25 +2568,25 @@ format = 'via [🌕 $version](bold blue) '
## Memory Usage
The `memory_usage` module shows current system memory and swap usage.
`memory_usage` 组件显示当前系统内存和交换区使用情况。
By default the swap usage is displayed if the total system swap is non-zero.
默认情况下,如果系统交换区使用不为 0则会显示交换区使用情况。
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
:::
### 配置项
| 选项 | 默认值 | 描述 |
| ----------- | ----------------------------------------------- | -------------------------------------------------------- |
| `threshold` | `75` | Hide the memory usage unless it exceeds this percentage. |
| `format` | `'via $symbol [${ram}( \| ${swap})]($style) '` | 组件格式化模板。 |
| `符号` | `'🐏'` | The symbol used before displaying the memory usage. |
| `style` | `'bold dimmed white'` | 此组件的样式。 |
| `disabled` | `true` | Disables the `memory_usage` module. |
| 选项 | 默认值 | 描述 |
| ----------- | ----------------------------------------------- | ---------------------- |
| `threshold` | `75` | 隐藏内存使用情况,除非它超过这个百分比。 |
| `format` | `'via $symbol [${ram}( \| ${swap})]($style) '` | 组件格式化模板。 |
| `符号` | `'🐏'` | 这个字段的内容会显示在当前内存使用情况之前。 |
| `style` | `'bold dimmed white'` | 此组件的样式。 |
| `disabled` | `true` | 禁用 `memory_usage` 组件。 |
### 变量
@ -2658,14 +2658,14 @@ The `hg_branch` module shows the active branch and topic of the repo in your cur
### 配置项
| 选项 | 默认值 | 描述 |
| ------------------- | ----------------------------------------- | -------------------------------------------------------------------------------------------- |
| `符号` | `' '` | The symbol used before the hg bookmark or branch name of the repo in your current directory. |
| `style` | `'bold purple'` | 此组件的样式。 |
| `format` | `'on [$symbol$branch(:$topic)]($style) '` | 组件格式化模板。 |
| `truncation_length` | `2^63 - 1` | Truncates the hg branch / topic name to `N` graphemes |
| `truncation_symbol` | `'…'` | 此字段的内容用来表示分支名称被截断。 |
| `disabled` | `true` | Disables the `hg_branch` module. |
| 选项 | 默认值 | 描述 |
| ------------------- | ----------------------------------------- | ----------------------------------------------------- |
| `符号` | `' '` | 该字段的内容显示于当前仓库的 hg 书签或活动分支名之前。 |
| `style` | `'bold purple'` | 此组件的样式。 |
| `format` | `'on [$symbol$branch(:$topic)]($style) '` | 组件格式化模板。 |
| `truncation_length` | `2^63 - 1` | Truncates the hg branch / topic name to `N` graphemes |
| `truncation_symbol` | `'…'` | 此字段的内容用来表示分支名称被截断。 |
| `disabled` | `true` | 禁用 `hg_branch` 组件。 |
### 变量
@ -2733,7 +2733,7 @@ symbol = '🎣 '
## Nix-shell
The `nix_shell` module shows the [nix-shell](https://nixos.org/guides/nix-pills/developing-with-nix-shell.html) environment. The module will be shown when inside a nix-shell environment.
The `nix_shell` module shows the [nix-shell](https://nixos.org/guides/nix-pills/developing-with-nix-shell.html) environment. 当处于一个 nix-shell 环境中时,此组件会被显示。
### 配置项
@ -2743,16 +2743,16 @@ The `nix_shell` module shows the [nix-shell](https://nixos.org/guides/nix-pills/
| `符号` | `'❄️ '` | A format string representing the symbol of nix-shell. |
| `style` | `'bold blue'` | 此组件的样式。 |
| `impure_msg` | `'impure'` | A format string shown when the shell is impure. |
| `pure_msg` | `'pure'` | A format string shown when the shell is pure. |
| `pure_msg` | `'纯色'` | A format string shown when the shell is pure. |
| `unknown_msg` | `''` | A format string shown when it is unknown if the shell is pure/impure. |
| `disabled` | `false` | Disables the `nix_shell` module. |
| `disabled` | `false` | 禁用 `nix_shell` 组件。 |
| `heuristic` | `false` | Attempts to detect new `nix shell`-style shells with a heuristic. |
### 变量
| 字段 | 示例 | 描述 |
| --------- | ------- | -------------------------- |
| state | `pure` | The state of the nix-shell |
| state | `纯色` | The state of the nix-shell |
| name | `lorri` | The name of the nix-shell |
| 符号 | | `symbol`对应值 |
| style\* | | `style`对应值 |
@ -2794,7 +2794,7 @@ The `nodejs` module shows the currently installed version of [Node.js](https://n
| `detect_files` | `['package.json', '.node-version']` | Which filenames should trigger this module. |
| `detect_folders` | `['node_modules']` | Which folders should trigger this module. |
| `style` | `'bold green'` | 此组件的样式。 |
| `disabled` | `false` | Disables the `nodejs` module. |
| `disabled` | `false` | 禁用 `nodejs` 组件。 |
| `not_capable_style` | `bold red` | The style for the module when an engines property in package.json does not match the Node.js version. |
### 变量
@ -2947,7 +2947,7 @@ The [os_info](https://lib.rs/crates/os_info) crate used by this module is known
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
:::
@ -3039,7 +3039,7 @@ Arch = "Arch is the best! "
## Package Version
The `package` module is shown when the current directory is the repository for a package, and shows its current version. The module currently supports `npm`, `nimble`, `cargo`, `poetry`, `python`, `composer`, `gradle`, `julia`, `mix`, `helm`, `shards`, `daml` and `dart` packages.
当前目录是软件包的代码仓库时,将显示 `package` 组件,并显示软件包当前版本。 The module currently supports `npm`, `nimble`, `cargo`, `poetry`, `python`, `composer`, `gradle`, `julia`, `mix`, `helm`, `shards`, `daml` and `dart` packages.
- [**npm**](https://docs.npmjs.com/cli/commands/npm) The `npm` package version is extracted from the `package.json` present in the current directory
- [**Cargo**](https://doc.rust-lang.org/cargo/) The `cargo` package version is extracted from the `Cargo.toml` present in the current directory
@ -3066,11 +3066,11 @@ The `package` module is shown when the current directory is the repository for a
| 选项 | 默认值 | 描述 |
| ----------------- | --------------------------------- | ------------------------------------------------------------------------- |
| `format` | `'is [$symbol$version]($style) '` | 组件格式化模板。 |
| `符号` | `'📦 '` | The symbol used before displaying the version the package. |
| `符号` | `'📦 '` | 这个字段的内容会显示在当前软件包版本之前。 |
| `version_format` | `'v${raw}'` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `style` | `'bold 208'` | 此组件的样式。 |
| `display_private` | `false` | Enable displaying version for packages marked as private. |
| `disabled` | `false` | Disables the `package` module. |
| `disabled` | `false` | 禁用 `package` 组件。 |
### 变量
@ -3145,12 +3145,12 @@ The `php` module shows the currently installed version of [PHP](https://www.php.
| ------------------- | ------------------------------------ | ------------------------------------------------------------------------- |
| `format` | `'via [$symbol($version )]($style)'` | 组件格式化模板。 |
| `version_format` | `'v${raw}'` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `符号` | `'🐘 '` | The symbol used before displaying the version of PHP. |
| `符号` | `'🐘 '` | 这个字段的内容会显示在当前 PHP 版本之前。 |
| `detect_extensions` | `['php']` | Which extensions should trigger this module. |
| `detect_files` | `['composer.json', '.php-version']` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `'147 bold'` | 此组件的样式。 |
| `disabled` | `false` | Disables the `php` module. |
| `disabled` | `false` | 禁用 `php` 组件。 |
### 变量
@ -3287,7 +3287,7 @@ format = 'via [$symbol$version](bold white)'
The `python` module shows the currently installed version of [Python](https://www.python.org/) and the current [Python virtual environment](https://docs.python.org/tutorial/venv.html) if one is activated.
If `pyenv_version_name` is set to `true`, it will display the pyenv version name. Otherwise, it will display the version number from `python --version`.
如果`pyenv_version_name`被设置为`true`, 本组件将会展示pyenv版本名。 否则则显示通过`python --version`获得的版本号
By default the module will be shown if any of the following conditions are met:
@ -3307,15 +3307,15 @@ By default the module will be shown if any of the following conditions are met:
| -------------------- | ------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- |
| `format` | `'via [${symbol}${pyenv_prefix}(${version} )(\($virtualenv\) )]($style)'` | 组件格式化模板。 |
| `version_format` | `'v${raw}'` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `符号` | `'🐍 '` | A format string representing the symbol of Python |
| `符号` | `'🐍 '` | 用于表示Python的格式化字符串。 |
| `style` | `'yellow bold'` | 此组件的样式。 |
| `pyenv_version_name` | `false` | Use pyenv to get Python version |
| `pyenv_version_name` | `false` | 使用 pyenv 获取 Python 版本 |
| `pyenv_prefix` | `pyenv` | Prefix before pyenv version display, only used if pyenv is used |
| `python_binary` | `['python', 'python3', 'python2']` | Configures the python binaries that Starship should executes when getting the version. |
| `detect_extensions` | `['py']` | Which extensions should trigger this module |
| `detect_files` | `['.python-version', 'Pipfile', '__init__.py', 'pyproject.toml', 'requirements.txt', 'setup.py', 'tox.ini']` | Which filenames should trigger this module |
| `detect_folders` | `[]` | Which folders should trigger this module |
| `disabled` | `false` | Disables the `python` module. |
| `disabled` | `false` | 禁用 `python` 组件。 |
::: tip
@ -3329,11 +3329,11 @@ The default values and order for `python_binary` was chosen to first identify th
| 字段 | 示例 | 描述 |
| ------------ | --------------- | ------------------------------------------ |
| version | `'v3.8.1'` | The version of `python` |
| version | `'v3.8.1'` | `python`版本 |
| 符号 | `'🐍 '` | `symbol`对应值 |
| style | `'yellow bold'` | `style`对应值 |
| pyenv_prefix | `'pyenv '` | Mirrors the value of option `pyenv_prefix` |
| virtualenv | `'venv'` | The current `virtualenv` name |
| virtualenv | `'venv'` | 当前`virtualenv`名称 |
### 示例
@ -3454,7 +3454,7 @@ format = 'via [🦪 $version]($style) '
## Red
By default the `red` module shows the currently installed version of [Red](https://www.red-lang.org/). The module will be shown if any of the following conditions are met:
By default the `red` module shows the currently installed version of [Red](https://www.red-lang.org/). 此组件将在符合以下任意条件时显示:
- The current directory contains a file with `.red` or `.reds` extension
@ -3492,7 +3492,7 @@ symbol = '🔴 '
## Ruby
By default the `ruby` module shows the currently installed version of [Ruby](https://www.ruby-lang.org/). The module will be shown if any of the following conditions are met:
By default the `ruby` module shows the currently installed version of [Ruby](https://www.ruby-lang.org/). 此组件将在符合以下任意条件时显示:
- 当前目录包含 `Gemfile` 文件
- The current directory contains a `.ruby-version` file
@ -3513,7 +3513,7 @@ Starship gets the current Ruby version by running `ruby -v`.
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `detect_variables` | `['RUBY_VERSION', 'RBENV_VERSION']` | Which environment variables should trigger this module. |
| `style` | `'bold red'` | 此组件的样式。 |
| `disabled` | `false` | Disables the `ruby` module. |
| `disabled` | `false` | 禁用 `ruby` 组件。 |
### 变量
@ -3536,7 +3536,7 @@ symbol = '🔺 '
## Rust
By default the `rust` module shows the currently installed version of [Rust](https://www.rust-lang.org/). The module will be shown if any of the following conditions are met:
By default the `rust` module shows the currently installed version of [Rust](https://www.rust-lang.org/). 此组件将在符合以下任意条件时显示:
- 当前目录包含 `Cargo.toml` 文件
- 当前目录包含一个使用 `.rs` 扩展名的文件
@ -3552,7 +3552,7 @@ By default the `rust` module shows the currently installed version of [Rust](htt
| `detect_files` | `['Cargo.toml']` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `'bold red'` | 此组件的样式。 |
| `disabled` | `false` | Disables the `rust` module. |
| `disabled` | `false` | 禁用 `rust` 组件。 |
### 变量
@ -3621,7 +3621,7 @@ The `shell` module shows an indicator for currently used shell.
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
:::
@ -3649,7 +3649,7 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
| 字段 | 默认值 | 描述 |
| --------- | --- | ---------------------------------------------------------- |
| indicator | | Mirrors the value of `indicator` for currently used shell. |
| style\* | | Mirrors the value of option `style`. |
| style\* | | `style`对应值. |
*: 此变量只能作为样式字符串的一部分使用
@ -3826,7 +3826,7 @@ The `status` module displays the exit code of the previous command. If $success_
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
:::
@ -3887,7 +3887,7 @@ The `sudo` module displays if sudo credentials are currently cached. The module
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
:::
@ -3932,7 +3932,7 @@ disabled = false
## Swift
By default the `swift` module shows the currently installed version of [Swift](https://swift.org/). The module will be shown if any of the following conditions are met:
By default the `swift` module shows the currently installed version of [Swift](https://swift.org/). 此组件将在符合以下任意条件时显示:
- The current directory contains a `Package.swift` file
- The current directory contains a file with the `.swift` extension
@ -3995,7 +3995,7 @@ By default the module will be shown if any of the following conditions are met:
| `detect_files` | `[]` | Which filenames should trigger this module. |
| `detect_folders` | `['.terraform']` | Which folders should trigger this module. |
| `style` | `'bold 105'` | 此组件的样式。 |
| `disabled` | `false` | Disables the `terraform` module. |
| `disabled` | `false` | 禁用 `terraform` 组件。 |
### 变量
@ -4030,25 +4030,25 @@ format = '[🏎💨 $workspace]($style) '
## Time
The `time` module shows the current **local** time. The `format` configuration value is used by the [`chrono`](https://crates.io/crates/chrono) crate to control how the time is displayed. Take a look [at the chrono strftime docs](https://docs.rs/chrono/0.4.7/chrono/format/strftime/index.html) to see what options are available.
`time` 组件显示当前的 **本地** 时间。 `format` 字段值会提供给 [`chrono`](https://crates.io/crates/chrono) crate 用来控制时间显示方式。 请参阅 [chrono strftime 文档](https://docs.rs/chrono/0.4.7/chrono/format/strftime/index.html) 以了解可用格式选项。
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
:::
### 配置项
| 选项 | 默认值 | 描述 |
| ----------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `format` | `'at [$time]($style) '` | The format string for the module. |
| `use_12hr` | `false` | Enables 12 hour formatting |
| `time_format` | see below | The [chrono format string](https://docs.rs/chrono/0.4.7/chrono/format/strftime/index.html) used to format the time. |
| `style` | `'bold yellow'` | The style for the module time |
| `utc_time_offset` | `'local'` | Sets the UTC offset to use. Range from -24 < x < 24. Allows floats to accommodate 30/45 minute timezone offsets. |
| `disabled` | `true` | Disables the `time` module. |
| `time_range` | `'-'` | Sets the time range during which the module will be shown. Times must be specified in 24-hours format |
| 选项 | 默认值 | 描述 |
| ----------------- | ----------------------- | ----------------------------------------------------------------------------------------------------- |
| `format` | `'at [$time]($style) '` | The format string for the module. |
| `use_12hr` | `false` | 启用 12 小时格式 |
| `time_format` | 见下文解释 | 用来格式化时间显示的 [chrono 格式字符串](https://docs.rs/chrono/0.4.7/chrono/format/strftime/index.html) |
| `style` | `'bold yellow'` | 显示时间的样式。 |
| `utc_time_offset` | `'local'` | 设置所用 UTC 偏移量。 Range from -24 < x < 24. 允许使用浮点数来得到 30/45 分钟的时区偏移。 |
| `disabled` | `true` | 禁用 `time` 组件。 |
| `time_range` | `'-'` | Sets the time range during which the module will be shown. Times must be specified in 24-hours format |
If `use_12hr` is `true`, then `time_format` defaults to `'%r'`. Otherwise, it defaults to `'%T'`. Manually setting `time_format` will override the `use_12hr` setting.
@ -4076,7 +4076,7 @@ time_range = '10:00:00-14:00:00'
## Username
The `username` module shows active user's username. The module will be shown if any of the following conditions are met:
`username` 组件显示当前活跃的用户名。 此组件将在符合以下任意条件时显示:
- The current user is root/admin
- 当前用户与登录用户不相同
@ -4094,10 +4094,10 @@ SSH connection is detected by checking environment variables `SSH_CONNECTION`, `
| 选项 | 默认值 | 描述 |
| ------------- | ----------------------- | ------------------------------------------- |
| `style_root` | `'bold red'` | The style used when the user is root/admin. |
| `style_user` | `'bold yellow'` | The style used for non-root users. |
| `style_user` | `'bold yellow'` | 非 root 用户使用的样式。 |
| `format` | `'[$user]($style) in '` | 组件格式化模板。 |
| `show_always` | `false` | Always shows the `username` module. |
| `disabled` | `false` | Disables the `username` module. |
| `show_always` | `false` | 总是显示 `username` 组件。 |
| `disabled` | `false` | 禁用 `username` 组件。 |
### 变量
@ -4227,7 +4227,7 @@ format = '[🆅 $repo](bold blue) '
## Zig
By default the `zig` module shows the currently installed version of [Zig](https://ziglang.org/). The module will be shown if any of the following conditions are met:
By default the `zig` module shows the currently installed version of [Zig](https://ziglang.org/). 此组件将在符合以下任意条件时显示:
- The current directory contains a `.zig` file
@ -4309,7 +4309,7 @@ Format strings can also contain shell specific prompt sequences, e.g. [Bash](htt
| `when` | `false` | Either a boolean value (`true` or `false`, without quotes) or a string shell command used as a condition to show the module. In case of a string, the module will be shown if the command returns a `0` status code. |
| `require_repo` | `false` | If `true`, the module will only be shown in paths containing a (git) repository. This option alone is not sufficient display condition in absence of other options. |
| `shell` | | [See below](#custom-command-shell) |
| `description` | `'<custom module>'` | The description of the module that is shown when running `starship explain`. |
| `描述` | `'<custom module>'` | The description of the module that is shown when running `starship explain`. |
| `detect_files` | `[]` | The files that will be searched in the working directory for a match. |
| `detect_folders` | `[]` | The directories that will be searched in the working directory for a match. |
| `detect_extensions` | `[]` | The extensions that will be searched in the working directory for a match. |
@ -4323,40 +4323,40 @@ Format strings can also contain shell specific prompt sequences, e.g. [Bash](htt
### 变量
| 字段 | 描述 |
| --------- | -------------------------------------- |
| output | The output of shell command in `shell` |
| 符号 | `symbol`对应值 |
| style\* | `style`对应值 |
| 字段 | 描述 |
| --------- | -------------- |
| output | `shell` 中命令的输出 |
| 符号 | `symbol`对应值 |
| style\* | `style`对应值 |
*: 此变量只能作为样式字符串的一部分使用
#### 自定义命令 shell
`shell` accepts a non-empty list of strings, where:
`shell` 接受一个非空字符串列表:
- 第一个字符串是用于执行命令的 shell 路径。
- 剩下的将作为参数传递给 shell。
If unset, it will fallback to STARSHIP_SHELL and then to 'sh' on Linux, and 'cmd /C' on Windows.
如果未设置,它将回退到 STARSHIP_SHELL然后回退到 Linux 上的 "sh" 命令,在 Windows 上则是 "cmd /C"。
The `command` will be passed in on stdin.
`command` 将会被传递给标准输入。
If `shell` is not given or only contains one element and Starship detects PowerShell will be used, the following arguments will automatically be added: `-NoProfile -Command -`. If `shell` is not given or only contains one element and Starship detects Cmd will be used, the following argument will automatically be added: `/C` and `stdin` will be set to `false`. If `shell` is not given or only contains one element and Starship detects Nushell will be used, the following arguments will automatically be added: `-c` and `stdin` will be set to `false`. This behavior can be avoided by explicitly passing arguments to the shell, e.g.
如果 `shell` 未设置或仅包含一个元素,并且 Starship 检测到正在使用 PowerShell则会自动添加 `-NoProfile -Command -` 参数。 如果 `shell` 未设置或仅包含一个元素,并且 Starship 检测到正在使用 Cmd则会自动添加 `/C` 参数,并且将 `stdin` 设置为 `false`。 如果 `shell` 未设置或仅包含一个元素,并且 Starship 检测到正在使用 Cmd则会自动添加 `-C` 参数,并且将 `stdin` 设置为 `false`。 可以通过将参数显式传递给 shell 来避免这种行为,例如:
```toml
shell = ['pwsh', '-Command', '-']
```
::: warning Make sure your custom shell configuration exits gracefully
::: warning 请确保您的自定义 shell 配置正常退出
If you set a custom command, make sure that the default Shell used by starship will properly execute the command with a graceful exit (via the `shell` option).
如果您设置了一个自定义命令, 请确保 starship 使用的默认 shell (在 `shell` 选项设置) 执行命令后会正常退出。
For example, PowerShell requires the `-Command` parameter to execute a one liner. Omitting this parameter might throw starship into a recursive loop where the shell might try to load a full profile environment with starship itself again and hence re-execute the custom command, getting into a never ending loop.
例如PowerShell 需要 `-Command` 参数来执行单行命令。 忽略此参数可能导致 starship 无尽递归shell 可能会尝试加载带有 starship 的完整配置并重新执行自定义命令,导致无尽循环。
Parameters similar to `-NoProfile` in PowerShell are recommended for other shells as well to avoid extra loading time of a custom profile on every starship invocation.
建议使用类似于 PowerShell 中 `-NoProfile` 的启动参数,这样还能避免额外的配置加载时间。
Automatic detection of shells and proper parameters addition are currently implemented, but it's possible that not all shells are covered. [Please open an issue](https://github.com/starship/starship/issues/new/choose) with shell details and starship configuration if you hit such scenario.
自动检测 shell 和添加适当的参数的功能已被实现,但包含的 shell 支持可能有缺漏。 遇到这种情况,请[提交一个带有 shell 信息和 starship 配置的 issue](https://github.com/starship/starship/issues/new/choose)。
:::
@ -4366,19 +4366,19 @@ Automatic detection of shells and proper parameters addition are currently imple
# ~/.config/starship.toml
[custom.foo]
command = 'echo foo' # shows output of command
detect_files = ['foo'] # can specify filters but wildcards are not supported
command = 'echo foo' # 显示命令输出
detect_files = ['foo'] # 支持过滤器,但不支持通配符
when = ''' test "$HOME" = "$PWD" '''
format = ' transcending [$output]($style)'
[custom.time]
command = 'time /T'
detect_extensions = ['pst'] # filters *.pst files
detect_extensions = ['pst'] # 识别 *.pst 文件
shell = ['pwsh.exe', '-NoProfile', '-Command', '-']
[custom.time-as-arg]
command = 'time /T'
detect_extensions = ['pst'] # filters *.pst files
detect_extensions = ['pst'] # 识别 *.pst 文件
shell = ['pwsh.exe', '-NoProfile', '-Command']
use_stdin = false
```