diff options
author | Matan Kushner <hello@matchai.dev> | 2020-09-30 16:26:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-30 16:26:13 -0400 |
commit | d8dcf04cff71794d15255e46a164a7f3633a11ec (patch) | |
tree | 989a55c405ba1d99cd1c740ffaee43e9456742ad /docs/zh-TW | |
parent | d63c7ce3f924bfe5c96bccddb49f452c9190ff7e (diff) |
docs(i18n): new Crowdin updates (#1512)
Diffstat (limited to 'docs/zh-TW')
-rw-r--r-- | docs/zh-TW/config/README.md | 801 | ||||
-rw-r--r-- | docs/zh-TW/faq/README.md | 4 | ||||
-rw-r--r-- | docs/zh-TW/guide/README.md | 2 | ||||
-rw-r--r-- | docs/zh-TW/migrating-to-0.45.0/README.md | 265 | ||||
-rw-r--r-- | docs/zh-TW/presets/README.md | 9 |
5 files changed, 816 insertions, 265 deletions
diff --git a/docs/zh-TW/config/README.md b/docs/zh-TW/config/README.md index 15868a0ff..f418ddfc8 100644 --- a/docs/zh-TW/config/README.md +++ b/docs/zh-TW/config/README.md @@ -1,18 +1,12 @@ # è¨å®š -::: tip - -🔥 「è¨å®šã€ç¾åœ¨é‚„在建置ä¸ã€‚ 許多新的è¨å®šé¸é …會在之後的版本釋出。 - -::: - -為了開始è¨å®š Starship,請建立下å³æª”案: `~/.config/starship.toml`. +To get started configuring starship, create the following file: `~/.config/starship.toml`. ```sh mkdir -p ~/.config && touch ~/.config/starship.toml ``` -所有關於 Starship çš„è¨å®šéƒ½åœ¨é€™å€‹ [TOML](https://github.com/toml-lang/toml) 檔案內: +All configuration for starship is done in this [TOML](https://github.com/toml-lang/toml) file: ```toml # Don't print a new line at the start of the prompt @@ -27,7 +21,7 @@ success_symbol = "[âžœ](bold green)" # The "success_symbol" segment is being disabled = true ``` -ä½ å¯ä»¥è—‰ç”±ä¿®æ”¹ `STARSHIP_CONFIG`環境變數而改變é è¨çš„`starship.toml` 檔案ä½ç½® +You can change default `starship.toml` file location with `STARSHIP_CONFIG` environment variable: ```sh export STARSHIP_CONFIG=~/.starship @@ -39,9 +33,23 @@ Equivalently in PowerShell (Windows) would be adding this line to your `$PROFILE $ENV:STARSHIP_CONFIG = "$HOME\.starship" ``` -### 術語 +### Logging + +By default starship logs warnings and errors into a file named `~/.cache/starship/session_${STARSHIP_SESSION_KEY}.log`, where the session key is corresponding to a instance of your terminal. This, however can be changed using the `STARSHIP_CACHE` environment variable: + +```sh +export STARSHIP_CACHE=~/.starship/cache +``` + +Equivalently in PowerShell (Windows) would be adding this line to your `$PROFILE`: + +```ps1 +$ENV:STARSHIP_CACHE = "$HOME\AppData\Local\Temp" +``` + +### Terminology -**模組 (Module)**: æ示å—å…ƒä¸çš„ä¸€å€‹å…ƒä»¶ï¼ŒåŸºæ–¼ä½ çš„ä½œæ¥ç³»çµ±æ供的背景資訊來æ供訊æ¯ã€‚ èˆ‰ä¾‹ä¾†èªªï¼Œå¦‚æžœä½ ç¾åœ¨çš„資料夾是一個 NodeJS 專案,"nodejs" 模組會顯示出ç¾åœ¨å®‰è£åœ¨ä½ 的電腦上的 NodeJS 版本。 +**Module**: A component in the prompt giving information based on contextual information from your OS. For example, the "nodejs" module shows the version of NodeJS that is currently installed on your computer, if your current directory is a NodeJS project. **Variable**: Smaller sub-components that contains information provided by the module. For example, the "version" variable in the "nodejs" module contains the current version of NodeJS. @@ -77,7 +85,7 @@ For example: #### é¢¨æ ¼å—串 -Starship 內大多數的模組å…è¨±ä½ è¨å®šä»–å€‘çš„é¡¯ç¤ºé¢¨æ ¼ã€‚ 這è¦é€éŽä¸€å€‹æ¢ç›® (通常å«åš `style`),這個æ¢ç›®ä½¿ç”¨ä¸€å€‹å—串來進行è¨å®šã€‚ é€™è£¡çµ¦å¹¾å€‹é¢¨æ ¼å—串的例å,以åŠé€™äº›å—串的功用。 å°æ–¼å®Œæ•´èªžæ³•çš„詳細說明,請åƒç…§ [進階è¨å®šæŒ‡å—](/advanced-config/)。 +Most modules in starship allow you to configure their display styles. This is done with an entry (usually called `style`) which is a string specifying the configuration. Here are some examples of style strings along with what they do. For details on the full syntax, consult the [advanced config guide](/advanced-config/). - `"fg:green bg:blue"` 在一個è—色背景上è¨å®šç¶ è‰²æ–‡å— - `"bg:blue fg:bright-green"` 在一個è—色背景上è¨å®šäº®ç¶ è‰²æ–‡å— @@ -86,7 +94,7 @@ Starship 內大多數的模組å…è¨±ä½ è¨å®šä»–å€‘çš„é¡¯ç¤ºé¢¨æ ¼ã€‚ 這è¦é€é - `"bold italic fg:purple"` è¨å®šç²—é«”ã€æ–œé«”ä¸”ç´«è‰²çš„æ–‡å— - `""` æ˜Žç¢ºåœ°é—œé–‰æ‰€æœ‰é¢¨æ ¼ -注æ„é¢¨æ ¼ç”¢å‡ºçš„æ¨£åå–æ±ºæ–¼ä½ çš„çµ‚ç«¯æ©Ÿæ¨¡æ“¬å™¨ã€‚ 例如,有些終端機模擬器會æå‡é¡è‰²çš„亮度而ä¸æ˜¯è®“æ–‡å—變粗體,而且有些色彩主題å°ä¸€èˆ¬èˆ‡åŠ 亮é¡è‰²ä½¿ç”¨çš„是相åŒè‰²ç¢¼ã€‚ 除æ¤ä¹‹å¤–,為了è¦æœ‰æ–œé«”å—ï¼Œä½ çš„çµ‚ç«¯æ©Ÿä¸€å®šè¦æ”¯æ´æ–œé«”。 +Note that what styling looks like will be controlled by your terminal emulator. For example, some terminal emulators will brighten the colors instead of bolding text, and some color themes use the same values for the normal and bright colors. Also, to get italic text, your terminal must support italics. #### Conditional Format Strings @@ -102,7 +110,7 @@ For example: The following symbols have special usage in a format string. If you want to print the following symbols, you have to escape them with a backslash (`\`). -- $ +- \$ - \\ - [ - ] @@ -130,7 +138,7 @@ format = ''' ## æ示å—å…ƒ -以下是é‡å°æ示å—元內容的è¨å®šã€‚ +This is the list of prompt-wide configuration options. ### é¸é … @@ -138,15 +146,13 @@ format = ''' | -------------- | ---------------------------- | ----------------------------------------------------- | | `format` | [連çµ](#default-prompt-format) | Configure the format of the prompt. | | `scan_timeout` | `30` | Timeout for starship to scan files (in milliseconds). | +| `add_newline` | `true` | Add a new line before the start of the prompt. | ### 範例 ```toml # ~/.config/starship.toml -# Disable the newline at the start of the prompt -format = "$all" - # Use custom format format = """ [┌───────────────────>](bold green) @@ -155,20 +161,23 @@ format = """ # Wait 10 milliseconds for starship to check files under the current directory. scan_timeout = 10 + +# Disable the newline at the start of the prompt +add_newline = false ``` ### Default Prompt Format -The default `format` is used to define the format of the prompt, if empty or no `format` is provided. é è¨å¦‚下: +The default `format` is used to define the format of the prompt, if empty or no `format` is provided. The default is as shown: ```toml -format = "\n$all" +format = "$all" # Which is equivalent to format = """ - $username\ $hostname\ +$shlvl\ $kubernetes\ $directory\ $git_branch\ @@ -179,6 +188,7 @@ $hg_branch\ $docker_context\ $package\ $cmake\ +$dart\ $dotnet\ $elixir\ $elm\ @@ -190,17 +200,20 @@ $julia\ $nim\ $nodejs\ $ocaml\ +$perl\ $php\ $purescript\ $python\ $ruby\ $rust\ +$swift\ $terraform\ $zig\ $nix_shell\ $conda\ $memory_usage\ $aws\ +$gcloud\ $env_var\ $crystal\ $cmd_duration\ @@ -209,14 +222,15 @@ $line_break\ $jobs\ $battery\ $time\ +$status\ $character""" ``` ## AWS -`aws` 模組顯示ç¾åœ¨ AWS çš„å€åŸŸèˆ‡æ¦‚æ³ã€‚ é€™æ˜¯æ ¹æ“š `AWS_REGION`ã€`AWS_DEFAULT_REGION` 與 `AWS_PROFILE` ç’°å¢ƒè®Šæ•¸åŠ `~/.aws/config` 檔案。 +The `aws` module shows the current AWS region and profile. This is based on `AWS_REGION`, `AWS_DEFAULT_REGION`, and `AWS_PROFILE` env var with `~/.aws/config` file. -從 `AWS_VAULT`讀å–而使用 [aws-vault](https://github.com/99designs/aws-vault) 這個è¨å®šæª” +When using [aws-vault](https://github.com/99designs/aws-vault) the profile is read from the `AWS_VAULT` env var. ### é¸é … @@ -282,7 +296,7 @@ symbol = "🅰 " ## é›»æ± -`battery` æ¨¡çµ„é¡¯ç¤ºé›»æ± çš„é›»é‡ä»¥åŠç¾åœ¨çš„充電狀態。 這個模組åªæœƒåœ¨è£ç½®çš„é›»é‡ä½Žæ–¼ 10% 的時候看見。 +The `battery` module shows how charged the device's battery is and its current charging status. The module is only visible when the device's battery is below 10%. ### é¸é … @@ -296,14 +310,14 @@ symbol = "🅰 " | `disabled` | `false` | åœç”¨ `battery` 模組。 | <details> -<summary>也有些é‡å°ä¸å¸¸è¦‹çš„é›»æ± ç‹€æ…‹è¨å®šçš„é¸é …。</summary> +<summary>There are also options for some uncommon battery states.</summary> | 變數 | 說明 | | ---------------- | -------------- | | `unknown_symbol` | ç•¶é›»æ± ç‹€æ…‹ä¸æ˜Žæ™‚顯示的符號。 | | `empty_symbol` | ç•¶é›»æ± æ²’é›»æ™‚é¡¯ç¤ºçš„ç¬¦è™Ÿã€‚ | -注æ„ï¼šé›»æ± æŒ‡ç¤ºæœƒåœ¨é›»æ± ç‹€æ…‹`ä¸æ˜Ž`或`æ²’é›»`時隱è—起來,除éžä½ 在è¨å®šä¹‹ä¸æœ‰ç‰¹åˆ¥æŒ‡å®šé¸é …。 +Note: Battery indicator will be hidden if the status is `unknown` or `empty` unless you specify the option in the config. </details> @@ -318,9 +332,9 @@ charging_symbol = "âš¡ï¸" discharging_symbol = "💀" ``` -### é›»æ± é¡¯ç¤º +### Battery Display -`display` è¨å®šæ˜¯ç”¨ä¾†å®šç¾©ç”šéº¼æ™‚å€™é›»æ± æŒ‡ç¤ºæœƒé¡¯ç¤ºå‡ºä¾† (threshold),以åŠå®ƒé•·ç”šéº¼æ¨£å (style)。 如果沒有æä¾› `display`。 é è¨å¦‚下: +The `display` configuration option is used to define when the battery indicator should be shown (threshold) and what it looks like (style). If no `display` is provided. The default is as shown: ```toml [[battery.display]] @@ -330,7 +344,7 @@ style = "bold red" #### é¸é … -`display` é¸é …æ˜¯ä¸€å€‹ä¸‹åˆ—è¡¨æ ¼çš„é™£åˆ—ã€‚ +The `display` option is an array of the following table. | 變數 | 說明 | | ----------- | ----------- | @@ -340,23 +354,23 @@ style = "bold red" #### 範例 ```toml -[[battery.display]] # 0% 到 10% é›»é‡ä¹‹é–“時,使用 "bold red" é¢¨æ ¼ +[[battery.display]] # "bold red" style when capacity is between 0% and 10% threshold = 10 style = "bold red" -[[battery.display]] # 10% 到 30% é›»é‡ä¹‹é–“時,使用 "bold yellow" é¢¨æ ¼ +[[battery.display]] # "bold yellow" style when capacity is between 10% and 30% threshold = 30 style = "bold yellow" -# 當電é‡è¶…éŽ 30% 時,電é‡æŒ‡ç¤ºå°±ä¸æœƒé¡¯ç¤ºå‡ºä¾† +# when capacity is over 30%, the battery indicator will not be displayed ``` ## å—å…ƒ -`character` æ¨¡çµ„åœ¨ä½ çš„æ–‡å—輸入處æ—顯示一個å—å…ƒ (通常是ç®é )。 +The `character` module shows a character (usually an arrow) beside where the text is entered in your terminal. -這個å—å…ƒæœƒå‘Šè¨´ä½ æœ€å¾Œçš„æŒ‡ä»¤æ˜¯æˆåŠŸé‚„是失敗。 It can do this in two ways: +The character will tell you whether the last command was successful or not. It can do this in two ways: - changing color (`red`/`green`) - changing shape (`â¯`/`✖`) @@ -437,15 +451,15 @@ The `cmake` module shows the currently installed version of CMake if: ## 指令æŒçºŒæ™‚é–“ -`cmd_duration` 模組顯示最後一個指令執行所花費的時間。 這個模組åªæœƒåœ¨æŒ‡ä»¤èŠ±è²»è¶…éŽå…©ç§’或是有è¨å®š `min_time` 時,超éŽè¨å®šå€¼æ™‚出ç¾ã€‚ +The `cmd_duration` module shows how long the last command took to execute. The module will be shown only if the command took longer than two seconds, or the `min_time` config value, if it exists. -::: warning ä¸è¦åœ¨ Bash ä¸è¨ç½® DEBUG trap +::: warning Do not hook the DEBUG trap in Bash -å¦‚æžœä½ åœ¨ `bash` ä¸ä½¿ç”¨ Starship,ä¸è¦åœ¨åŸ·è¡Œ `eval $(starship init $0)` 之後è¨ç½® `DEBUG` trap,ä¸ç„¶é€™å€‹æ¨¡çµ„**會**壞掉。 +If you are running Starship in `bash`, do not hook the `DEBUG` trap after running `eval $(starship init $0)`, or this module **will** break. ::: -想使用類似 preexec 功能的 Bash 使用者å¯ä»¥ [rcaloras çš„ bash_preexec 框架](https://github.com/rcaloras/bash-preexec)。 åªè¦åœ¨ `eval $(starship init $0)` 之å‰ç°¡å–®åœ°å®šç¾© `preexec_functions` 與 `precmd_functions` 兩個陣列,然後就å¯ä»¥ç…§å¸¸é€²è¡Œã€‚ +Bash users who need preexec-like functionality can use [rcaloras's bash_preexec framework](https://github.com/rcaloras/bash-preexec). Simply define the arrays `preexec_functions` and `precmd_functions` before running `eval $(starship init $0)`, and then proceed as normal. ### é¸é … @@ -478,7 +492,7 @@ format = "underwent [$duration](bold yellow)" ## Conda -如果有è¨å®š `$CONDA_DEFAULT_ENV` 時,`conda` 模組顯示ç¾åœ¨ conda 的環境。 +The `conda` module shows the current conda environment, if `$CONDA_DEFAULT_ENV` is set. ::: tip @@ -494,7 +508,8 @@ This does not suppress conda's own prompt modifier, you may want to run `conda c | `symbol` | `"🅒 "` | 環境å稱å‰ä½¿ç”¨çš„符號。 | | `style` | `"bold green"` | é€™å€‹æ¨¡çµ„çš„é¢¨æ ¼ã€‚ | | `format` | `"[$symbol$environment]($style) "` | The format for the module. | -| `disabled` | `false` | åœç”¨ `conda` 模組。 | +| `ignore_base` | `true` | Ignores `base` environment when activated. | +| `disabled` | `false` | Disables the `conda` module. | ### Variables @@ -517,7 +532,7 @@ format = "[$symbol$environment](dimmed green) " ## Crystal -`crystal` 模組顯示ç¾åœ¨æ‰€å®‰è£çš„Crystal版本 這個模組在下列其ä¸ä¸€å€‹æ¢ä»¶é”æˆæ™‚顯示: +The `crystal` module shows the currently installed version of Crystal. 這個模組在下列其ä¸ä¸€å€‹æ¢ä»¶é”æˆæ™‚顯示: - ç¾åœ¨è³‡æ–™å¤¾ä¸å«æœ‰ä¸€å€‹ `shard.yml` 檔案 - ç¾åœ¨è³‡æ–™å¤¾ä¸å«æœ‰ä¸€å€‹`.cr`檔案 @@ -550,34 +565,70 @@ format = "[$symbol$environment](dimmed green) " format = "via [✨ $version](bold blue) " ``` -## 資料夾 +## Dart + +The `dart` module shows the currently installed version of Dart. 這個模組在下列其ä¸ä¸€å€‹æ¢ä»¶é”æˆæ™‚顯示: + +- The current directory contains a file with `.dart` extension +- The current directory contains a `.dart_tool` directory +- The current directory contains a `pubspec.yaml` or `pubspec.lock` file + +### é¸é … + +| 變數 | é è¨ | 說明 | +| ---------- | ---------------------------------- | ----------------------------------------------- | +| `format` | `"via [$symbol$version]($style) "` | The format for the module. | +| `symbol` | `"🎯 "` | A format string representing the symbol of Dart | +| `style` | `"bold blue"` | é€™å€‹æ¨¡çµ„çš„é¢¨æ ¼ã€‚ | +| `disabled` | `false` | Disables the `dart` module. | + +### Variables + +| 變數 | 範例 | 說明 | +| --------- | -------- | ------------------------------------ | +| version | `v2.8.4` | The version of `dart` | +| 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 + +### 範例 + +```toml +# ~/.config/starship.toml + +[dart] +format = "via [🔰 $version](bold red) " +``` + +## Directory -`directory` 模組顯示到ç¾åœ¨è³‡æ–™å¤¾çš„路徑,並è£æ¸›åˆ°å‰ä¸‰å±¤è³‡æ–™å¤¾ã€‚ ä½ çš„è³‡æ–™å¤¾ä¹Ÿæœƒè¢«è£æ¸›åˆ°ä½ 所在的 git 儲å˜åº«çš„æ ¹ç›®éŒ„ã€‚ +The `directory` module shows the path to your current directory, truncated to three parent folders. Your directory will also be truncated to the root of the git repo that you're currently in. -如果æ£åœ¨ä½¿ç”¨ fish é¢¨æ ¼çš„ pwd é¸é …,將ä¸æœƒéš±è—被è£æ¸›çš„è³‡æ–™å¤¾ï¼Œè€Œæ˜¯æœƒæ ¹æ“šä½ åœ¨é¸é …ä¸è¨å®šçš„數å—看到æ¯ä¸€å±¤è³‡æ–™å¤¾çš„縮寫。 +When using the fish style pwd option, instead of hiding the path that is truncated, you will see a shortened name of each directory based on the number you enable for the option. -例如,給定一個å³åˆ—的路徑 `~/Dev/Nix/nixpkgs/pkgs` å…¶ä¸ `nixpkgs` 是儲å˜åº«çš„æ ¹ç›®éŒ„ï¼Œè€Œä¸”è©²é¸é …被è¨å®šç‚º `1`。 ä½ æœƒçœ‹åˆ° `~/D/N/nixpkgs/pkgs`,而在這個è¨å®šä¹‹å‰å‰‡æ˜¯ `nixpkgs/pkgs`。 +For example, given `~/Dev/Nix/nixpkgs/pkgs` where `nixpkgs` is the repo root, and the option set to `1`. You will now see `~/D/N/nixpkgs/pkgs`, whereas before it would have been `nixpkgs/pkgs`. ### é¸é … -| 變數 | é è¨ | 說明 | -| ------------------------ | ----------------------------------------------- | ----------------------------------------------------- | -| `truncation_length` | `3` | 到é”ç¾åœ¨è³‡æ–™å¤¾çš„路徑ä¸ï¼Œè¦è¢«è£æ¸›æŽ‰çš„資料夾數目。 | -| `truncate_to_repo` | `true` | 是å¦è¦è£æ¸›åˆ°ä½ ç¾åœ¨æ‰€åœ¨çš„ git 儲å˜åº«çš„æ ¹ç›®éŒ„ã€‚ | -| `format` | `"[$path]($style)[$lock_symbol]($lock_style) "` | The format for the module. | -| `style` | `"bold cyan"` | é€™å€‹æ¨¡çµ„çš„é¢¨æ ¼ã€‚ | -| `disabled` | `false` | åœç”¨ `directory` 模組。 | -| `read_only_symbol` | `"🔒"` | The symbol indicating current directory is read only. | -| `read_only_symbol_style` | `"red"` | The style for the read only symbol. | +| 變數 | é è¨ | 說明 | +| ------------------------ | ----------------------------------------------- | -------------------------------------------------------------------------------- | +| `truncation_length` | `3` | The number of parent folders that the current directory should be truncated to. | +| `truncate_to_repo` | `true` | Whether or not to truncate to the root of the git repo that you're currently in. | +| `format` | `"[$path]($style)[$lock_symbol]($lock_style) "` | The format for the module. | +| `style` | `"bold cyan"` | é€™å€‹æ¨¡çµ„çš„é¢¨æ ¼ã€‚ | +| `disabled` | `false` | Disables the `directory` module. | +| `read_only_symbol` | `"🔒"` | The symbol indicating current directory is read only. | +| `read_only_symbol_style` | `"red"` | The style for the read only symbol. | <details> -<summary>這個模組有些進階è¨å®šé¸é …å¯ä»¥æŽ§åˆ¶é¡¯ç¤ºè³‡æ–™å¤¾ã€‚</summary> +<summary>This module has a few advanced configuration options that control how the directory is displayed.</summary> -| Advanced Option | é è¨ | 說明 | -| --------------------------- | ------ | ------------------------------------------------ | -| `substitutions` | | A table of substitutions to be made to the path. | -| `fish_style_pwd_dir_length` | `0` | 當使用 fish shell çš„ pwd 路徑é‚輯時使用的å—元數é‡ã€‚ | -| `use_logical_path` | `true` | 顯示 shell (`PWD`) æ供的é‚輯路徑,而ä¸æ˜¯ OS 的路徑。 | +| Advanced Option | é è¨ | 說明 | +| --------------------------- | ------ | ---------------------------------------------------------------------------------------- | +| `substitutions` | | A table of substitutions to be made to the path. | +| `fish_style_pwd_dir_length` | `0` | The number of characters to use when applying fish shell pwd path logic. | +| `use_logical_path` | `true` | Displays the logical path provided by the shell (`PWD`) instead of the path from the OS. | `substitutions` allows you to define arbitrary replacements for literal strings that occur in the path, for example long network prefixes or development directories (i.e. Java). Note that this will disable the fish style PWD. @@ -644,7 +695,7 @@ format = "via [🋠$context](blue bold)" ## Dotnet -`dotnet` 模組顯示ç¾åœ¨è³‡æ–™å¤¾ä½¿ç”¨çš„ .NET Core SDK 的版本。 如果這個資料夾已經é¸å®šä¸€å€‹ SDK,則顯示這個 SDK 的版本。 如果沒有的話,則顯示最新安è£çš„ SDK 版本。 +The `dotnet` module shows the relevant version of the .NET Core SDK for the current directory. If the SDK has been pinned in the current directory, the pinned version is shown. Otherwise the module shows the latest installed version of the SDK. This module will only be shown in your prompt when one or more of the following files are present in the current directory: @@ -660,19 +711,19 @@ This module will only be shown in your prompt when one or more of the following You'll also need the .NET Core SDK installed in order to use it correctly. -這個模組內部是使用它自己的機制來åµæ¸¬ç‰ˆæœ¬ã€‚ 一般來說這個模組有 `dotnet --version` çš„å…©å€å¿«ï¼Œä½†æ˜¯å®ƒå¯èƒ½æœƒåœ¨ä½ çš„ .NET 專案有ä¸å°‹å¸¸çš„資料夾çµæ§‹æ™‚顯示ä¸æ£ç¢ºçš„版本。 如果精確度比速度更é‡è¦çš„è©±ï¼Œä½ å¯ä»¥è—‰ç”±è¨å®šæ¨¡çµ„ä¸çš„ `heuristic = false` é¸é …來åœç”¨é€™å€‹åŠŸèƒ½ã€‚ +Internally, this module uses its own mechanism for version detection. Typically it is twice as fast as running `dotnet --version`, but it may show an incorrect version if your .NET project has an unusual directory layout. If accuracy is more important than speed, you can disable the mechanism by setting `heuristic = false` in the module options. The module will also show the Target Framework Moniker (<https://docs.microsoft.com/en-us/dotnet/standard/frameworks#supported-target-framework-versions>) when there is a csproj file in the current directory. ### é¸é … -| Option | é è¨ | 說明 | -| ----------- | ---------------------------------------- | ---------------------------- | -| `format` | `"v[$symbol$version( 🎯 $tfm)]($style) "` | The format for the module. | -| `symbol` | `"•NET "` | 在顯示 dotnet 版本之å‰ç”¨çš„符號。 | -| `heuristic` | `true` | 使用更快速的版本åµæ¸¬æ³•ä¾†ä¿æŒ starship 的速度。 | -| `style` | `"bold blue"` | é€™å€‹æ¨¡çµ„çš„é¢¨æ ¼ã€‚ | -| `disabled` | `false` | åœç”¨ `dotnet` 模組。 | +| Option | é è¨ | 說明 | +| ----------- | ---------------------------------------- | -------------------------------------------------------- | +| `format` | `"v[$symbol$version( 🎯 $tfm)]($style) "` | The format for the module. | +| `symbol` | `"•NET "` | The symbol used before displaying the version of dotnet. | +| `heuristic` | `true` | Use faster version detection to keep starship snappy. | +| `style` | `"bold blue"` | é€™å€‹æ¨¡çµ„çš„é¢¨æ ¼ã€‚ | +| `disabled` | `false` | Disables the `dotnet` module. | ### Variables @@ -700,7 +751,7 @@ heuristic = false The `elixir` module shows the currently installed version of Elixir and Erlang/OTP. 這個模組在下列其ä¸ä¸€å€‹æ¢ä»¶é”æˆæ™‚顯示: -- ç¾åœ¨è³‡æ–™å¤¾ä¸åŒ…å«ä¸€å€‹ `mix.exs` 檔案. +- The current directory contains a `mix.exs` file. ### é¸é … @@ -735,8 +786,8 @@ symbol = "🔮 " The `elm` module shows the currently installed version of Elm. 這個模組在下列其ä¸ä¸€å€‹æ¢ä»¶é”æˆæ™‚顯示: -- ç¾åœ¨è³‡æ–™å¤¾ä¸åŒ…å«ä¸€å€‹ `elm.json` 檔案 -- ç¾åœ¨è³‡æ–™å¤¾ä¸åŒ…å«ä¸€å€‹ `elm-package.json` 檔案 +- The current directory contains a `elm.json` file +- The current directory contains a `elm-package.json` file - The current directory contains a `.elm-version` file - The current directory contains a `elm-stuff` folder - The current directory contains a `*.elm` files @@ -769,28 +820,28 @@ The `elm` module shows the currently installed version of Elm. é€™å€‹æ¨¡çµ„åœ¨ä¸ format = "via [ $version](cyan bold) " ``` -## 環境變數 +## Environment Variable -`env_var`模組顯示一個é¸æ“‡çš„環境變數的ç¾åœ¨æ•¸å€¼ã€‚ 這個模組åªåœ¨ä¸‹åˆ—æ¢ä»¶å…¶ä¸ä¹‹ä¸€é”到時顯示: +The `env_var` module displays the current value of a selected environment variable. The module will be shown only if any of the following conditions are met: -- `variable` è¨å®šé¸é …符åˆä¸€å€‹å˜åœ¨çš„環境變數。 -- 沒有è¨å®š `variable` é¸é …,但是有è¨å®š `default` é¸é …。 +- The `variable` configuration option matches an existing environment variable +- The `variable` configuration option is not defined, but the `default` configuration option is ### é¸é … -| Option | é è¨ | 說明 | -| ---------- | ------------------------------ | -------------------------- | -| `symbol` | | 顯示在變數數值之å‰çš„符號。 | -| `variable` | | è¦é¡¯ç¤ºçš„環境變數。 | -| `default` | | 在é¸æ“‡çš„變數值沒有定義時,顯示的é è¨å€¼ã€‚ | -| `format` | `"with [$env_value]($style) "` | The format for the module. | -| `disabled` | `false` | åœç”¨ `env_var` 模組。 | +| Option | é è¨ | 說明 | +| ---------- | ------------------------------ | ---------------------------------------------------------------------------- | +| `symbol` | | The symbol used before displaying the variable value. | +| `variable` | | The environment variable to be displayed. | +| `default` | | The default value to be displayed when the selected variable is not defined. | +| `format` | `"with [$env_value]($style) "` | The format for the module. | +| `disabled` | `false` | Disables the `env_var` module. | ### Variables | 變數 | 範例 | 說明 | | --------- | ------------------------------------------- | ------------------------------------------ | -| env_value | `Windows NT` (if *variable* would be `$OS`) | The environment value of option `variable` | +| env_value | `Windows NT` (if _variable_ would be `$OS`) | The environment value of option `variable` | | symbol | | Mirrors the value of option `symbol` | | style\* | `black bold dimmed` | Mirrors the value of option `style` | @@ -810,8 +861,8 @@ default = "unknown shell" The `erlang` module shows the currently installed version of Erlang/OTP. 這個模組在下列其ä¸ä¸€å€‹æ¢ä»¶é”æˆæ™‚顯示: -- ç¾åœ¨è³‡æ–™å¤¾ä¸åŒ…å«ä¸€å€‹ `rebar.config` 檔案. -- ç¾åœ¨è³‡æ–™å¤¾ä¸åŒ…å«ä¸€å€‹ `erlang.mk` 檔案. +- The current directory contains a `rebar.config` file. +- The current directory contains a `erlang.mk` file. ### é¸é … @@ -841,20 +892,80 @@ The `erlang` module shows the currently installed version of Erlang/OTP. 這個æ format = "via [e $version](bold red) " ``` -## Git 分支 +## Gcloud + +The `gcloud` module shows the current configuration for [`gcloud`](https://cloud.google.com/sdk/gcloud) CLI. This is based on the `~/.config/gcloud/active_config` file and the `~/.config/gcloud/configurations/config_{CONFIG NAME}` file and the `CLOUDSDK_CONFIG` env var. + +### é¸é … + +| 變數 | é è¨ | 說明 | +| ---------------- | ---------------------------------------------------- | --------------------------------------------------------------- | +| `format` | `"on [$symbol$account(\\($region\\))]($style) "` | The format for the module. | +| `symbol` | `"â˜ï¸ "` | The symbol used before displaying the current GCP profile. | +| `region_aliases` | | Table of region aliases to display in addition to the GCP name. | +| `style` | `"bold blue"` | é€™å€‹æ¨¡çµ„çš„é¢¨æ ¼ã€‚ | +| `disabled` | `false` | Disables the `gcloud` module. | + +### Variables + +| 變數 | 範例 | 說明 | +| --------- | ----------------- | ------------------------------------------------------------------ | +| region | `us-central1` | The current GCP region | +| account | `foo@example.com` | The current GCP profile | +| project | | The current GCP project | +| active | `default` | The active config name written in `~/.config/gcloud/active_config` | +| 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 + +### Examples + +#### Display account and project + +```toml +# ~/.config/starship.toml + +[gcloud] +format = "on [$symbol$account(\\($project\\))]($style) " +``` + +#### Display active config name only + +```toml +# ~/.config/starship.toml + +[gcloud] +format = "[$symbol$active]($style) " +style = "bold yellow" +``` + +#### Display account and aliased region -`git_branch` 模組顯示ç¾åœ¨çš„資料夾ä¸ä½¿ç”¨ä¸çš„儲å˜åº«çš„分支。 +```toml +# ~/.config/starship.toml + +[gcloud] +symbol = "ï¸ðŸ‡¬ï¸ " +[gcloud.region_aliases] +us-central1 = "uc1" +asia-northeast1 = "an1" +``` + +## Git Branch + +The `git_branch` module shows the active branch of the repo in your current directory. ### é¸é … -| Option | é è¨ | 說明 | -| ------------------- | -------------------------------- | -------------------------------------------------------------------------------- | -| `format` | `"on [$symbol$branch]($style) "` | The format for the module. Use `"$branch"` to refer to the current branch name. | -| `symbol` | `"î‚ "` | A format string representing the symbol of git branch. | -| `style` | `"bold purple"` | é€™å€‹æ¨¡çµ„çš„é¢¨æ ¼ã€‚ | -| `truncation_length` | `2^63 - 1` | Truncates a git branch to X graphemes. | -| `truncation_symbol` | `"…"` | 用來指示分支å稱被縮減的符號。 You can use `""` for no symbol. | -| `disabled` | `false` | åœç”¨ `git_branch` 模組。 | +| Option | é è¨ | 說明 | +| ------------------- | -------------------------------- | ---------------------------------------------------------------------------------------- | +| `format` | `"on [$symbol$branch]($style) "` | The format for the module. Use `"$branch"` to refer to the current branch name. | +| `symbol` | `"î‚ "` | A format string representing the symbol of git branch. | +| `style` | `"bold purple"` | é€™å€‹æ¨¡çµ„çš„é¢¨æ ¼ã€‚ | +| `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. | +| `disabled` | `false` | Disables the `git_branch` module. | ### Variables @@ -911,7 +1022,7 @@ commit_hash_length = 4 ## Git State -`git_state` 模組會顯示在 git 儲å˜åº«ä¸çš„資料夾內,以åŠæœƒåœ¨æœ‰ä½œæ¥æ£åœ¨é€²è¡Œæ™‚顯示,åƒæ˜¯ï¼š_REBASING_ã€_BISECTING_ ç‰ç‰ã€‚ 如果有進展的資訊 (åƒæ˜¯ REBASING 3/10),也會一併顯示出來。 +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. ### é¸é … @@ -925,8 +1036,8 @@ commit_hash_length = 4 | `am` | `"AM"` | A format string displayed when an `apply-mailbox` (`git am`) is in progress. | | `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) "` | The format for the module. | -| `disabled` | `false` | åœç”¨ `git_state` 模組。 | +| `format` | `"\\([$state( $progress_current/$progress_total)]($style)\\) "` | The format for the module. | +| `disabled` | `false` | Disables the `git_state` module. | ### Variables @@ -951,26 +1062,25 @@ cherry_pick = "[💠PICKING](bold red)" ## Git Status -`git_status` 模組顯示用來表示ç¾åœ¨è³‡æ–™å¤¾ä¹‹ä¸å„²å˜åº«ç‹€æ…‹çš„符號。 +The `git_status` module shows symbols representing the state of the repo in your current directory. ### é¸é … -| Option | é è¨ | 說明 | -| ----------------- | ----------------------------------------------- | ----------------------------------- | -| `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` | -| `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` | -| `show_sync_count` | `false` | 顯示超å‰/è½å¾Œè¿½è¹¤çš„分支的數é‡ã€‚ | -| `style` | `"bold red"` | é€™å€‹æ¨¡çµ„çš„é¢¨æ ¼ã€‚ | -| `disabled` | `false` | åœç”¨ `git_status` 模組。 | +| Option | é è¨ | 說明 | +| ------------ | --------------------------------------------- | ----------------------------------- | +| `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` | +| `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` | +| `style` | `"bold red"` | é€™å€‹æ¨¡çµ„çš„é¢¨æ ¼ã€‚ | +| `disabled` | `false` | Disables the `git_status` module. | ### Variables @@ -981,12 +1091,12 @@ The following variables can be used in `format`: | `all_status` | Shortcut for`$conflicted$stashed$deleted$renamed$modified$staged$untracked` | | `ahead_behind` | Displays `diverged` `ahead` or `behind` format string based on the current status of the repo | | `conflicted` | Displays `conflicted` when this branch has merge conflicts. | -| `untracked` | Displays `untracked` when there are untracked files in the working directory. | -| `stashed` | Displays `stashed` when a stash exists for the local repository. | -| `modified` | Displays `modified` when there are file modifications in the working directory. | -| `staged` | Displays `staged` when a new file has been added to the staging area. | -| `renamed` | Displays `renamed` when a renamed file has been added to the staging area. | -| `deleted` | Displays `deleted` when a file's deletion has been added to the staging area. | +| `untracked` | Displays `untracked` when there are untracked files in the working directory. | +| `stashed` | Displays `stashed` when a stash exists for the local repository. | +| `modified` | Displays `modified` when there are file modifications in the working directory. | +| `stag |