1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-06-01 16:10:51 +00:00

docs(i18n): new Crowdin updates (#3344)

* New translations README.md (Portuguese)

* New translations README.md (Spanish)

* New translations README.md (Polish)

* New translations README.md (Dutch)

* New translations README.md (Korean)

* New translations README.md (Japanese)

* New translations README.md (Italian)

* New translations README.md (German)

* New translations README.md (Arabic)

* New translations README.md (Sorani (Kurdish))

* New translations README.md (French)

* New translations README.md (Russian)

* New translations README.md (Indonesian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Vietnamese)

* New translations README.md (Chinese Traditional)

* New translations README.md (Chinese Simplified)

* New translations README.md (Turkish)

* New translations README.md (Portuguese)

* New translations README.md (Spanish)

* New translations README.md (Polish)

* New translations README.md (Dutch)

* New translations README.md (Korean)

* New translations README.md (Japanese)

* New translations README.md (Italian)

* New translations README.md (German)

* New translations README.md (Arabic)

* New translations README.md (Sorani (Kurdish))

* New translations README.md (French)

* New translations README.md (French)

* New translations README.md (French)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (French)

* New translations README.md (Russian)

* New translations README.md (Indonesian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Vietnamese)

* New translations README.md (Chinese Traditional)

* New translations README.md (Chinese Simplified)

* New translations README.md (Turkish)

* New translations README.md (Portuguese)

* New translations README.md (Spanish)

* New translations README.md (Polish)

* New translations README.md (Dutch)

* New translations README.md (Korean)

* New translations README.md (Japanese)

* New translations README.md (Italian)

* New translations README.md (German)

* New translations README.md (Arabic)

* New translations README.md (Sorani (Kurdish))

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (French)

* New translations README.md (French)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (French)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (French)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (French)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (French)

* New translations README.md (Russian)

* New translations README.md (Indonesian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Vietnamese)

* New translations README.md (Chinese Traditional)

* New translations README.md (Chinese Simplified)

* New translations README.md (Turkish)

* New translations README.md (Portuguese)

* New translations README.md (Spanish)

* New translations README.md (Polish)

* New translations README.md (Dutch)

* New translations README.md (Korean)

* New translations README.md (Japanese)

* New translations README.md (Italian)

* New translations README.md (German)

* New translations README.md (Arabic)

* New translations README.md (Sorani (Kurdish))

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (French)

* New translations README.md (Russian)

* New translations README.md (Indonesian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Vietnamese)

* New translations README.md (Chinese Traditional)

* New translations README.md (Chinese Simplified)

* New translations README.md (Turkish)

* New translations README.md (Portuguese)

* New translations README.md (Spanish)

* New translations README.md (Polish)

* New translations README.md (Dutch)

* New translations README.md (Korean)

* New translations README.md (Japanese)

* New translations README.md (Italian)

* New translations README.md (German)

* New translations README.md (Arabic)

* New translations README.md (Sorani (Kurdish))

* New translations README.md (French)

* New translations README.md (Korean)

* New translations README.md (German)

* New translations README.md (Italian)

* New translations README.md (Italian)

* New translations README.md (Japanese)

* New translations README.md (Japanese)

* New translations README.md (Korean)

* New translations README.md (Dutch)

* New translations README.md (Dutch)

* New translations README.md (Polish)

* New translations README.md (Polish)

* New translations README.md (Portuguese)

* New translations README.md (Portuguese)

* New translations README.md (Russian)

* New translations README.md (German)

* New translations README.md (Arabic)

* New translations README.md (Spanish)

* New translations README.md (Chinese Simplified)

* New translations README.md (Arabic)

* New translations README.md (German)

* New translations README.md (Italian)

* New translations README.md (Japanese)

* New translations README.md (Korean)

* New translations README.md (Dutch)

* New translations README.md (Polish)

* New translations README.md (Portuguese)

* New translations README.md (Russian)

* New translations README.md (Turkish)

* New translations README.md (Chinese Traditional)

* New translations README.md (Arabic)

* New translations README.md (Vietnamese)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Indonesian)

* New translations README.md (Sorani (Kurdish))

* New translations README.md (French)

* New translations README.md (French)

* New translations README.md (Spanish)

* New translations README.md (Spanish)

* New translations README.md (Russian)

* New translations README.md (French)

* New translations README.md (Dutch)

* New translations README.md (Spanish)

* New translations README.md (Arabic)

* New translations README.md (German)

* New translations README.md (Italian)

* New translations README.md (Japanese)

* New translations README.md (Korean)

* New translations README.md (Polish)

* New translations README.md (Portuguese)

* New translations README.md (Russian)

* New translations README.md (Turkish)

* New translations README.md (Chinese Traditional)

* New translations README.md (Vietnamese)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Indonesian)

* New translations README.md (Chinese Simplified)

* New translations README.md (Sorani (Kurdish))

* New translations README.md (Turkish)

* New translations README.md (Turkish)

* New translations README.md (Chinese Simplified)

* New translations README.md (Chinese Simplified)

* New translations README.md (Chinese Traditional)

* New translations README.md (Chinese Traditional)

* New translations README.md (Vietnamese)

* New translations README.md (Sorani (Kurdish))

* New translations README.md (Vietnamese)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Indonesian)

* New translations README.md (Indonesian)

* New translations README.md (Sorani (Kurdish))

* New translations README.md (Spanish)

* New translations README.md (Spanish)

* New translations README.md (Spanish)

* New translations README.md (Russian)

* New translations README.md (Russian)

* New translations README.md (French)

* New translations README.md (Russian)

* New translations README.md (Indonesian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Vietnamese)

* New translations README.md (Chinese Traditional)

* New translations README.md (Chinese Simplified)

* New translations README.md (Turkish)

* New translations README.md (Portuguese)

* New translations README.md (Spanish)

* New translations README.md (Polish)

* New translations README.md (Dutch)

* New translations README.md (Korean)

* New translations README.md (Japanese)

* New translations README.md (Italian)

* New translations README.md (German)

* New translations README.md (Arabic)

* New translations README.md (Sorani (Kurdish))

* New translations README.md (Chinese Simplified)

* New translations README.md (Chinese Simplified)

* New translations README.md (Chinese Simplified)

* New translations README.md (Chinese Simplified)

* New translations README.md (Chinese Simplified)

* New translations README.md (Chinese Simplified)

* New translations README.md (Chinese Simplified)

* New translations README.md (Chinese Simplified)

* New translations README.md (Chinese Simplified)

* New translations README.md (French)

* New translations README.md (Russian)

* New translations README.md (Indonesian)

* New translations README.md (Portuguese, Brazilian)

* New translations README.md (Vietnamese)

* New translations README.md (Chinese Traditional)

* New translations README.md (Chinese Simplified)

* New translations README.md (Turkish)

* New translations README.md (Portuguese)

* New translations README.md (Spanish)

* New translations README.md (Polish)

* New translations README.md (Dutch)

* New translations README.md (Korean)

* New translations README.md (Japanese)

* New translations README.md (Italian)

* New translations README.md (German)

* New translations README.md (Arabic)

* New translations README.md (Sorani (Kurdish))
This commit is contained in:
Matan Kushner 2022-01-15 17:08:31 -05:00 committed by GitHub
parent 682f49abdb
commit 6aa2bab97e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
112 changed files with 4793 additions and 2765 deletions

View File

@ -18,7 +18,7 @@ features:
footer: ISC Licensed | Copyright © 2019-present Starship Contributors
#Used for the description meta tag, for SEO
metaTitle: "Starship: Cross-Shell Prompt"
description: Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the information you need, while staying sleek and minimal. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, and PowerShell.
description: Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the information you need, while staying sleek and minimal. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and PowerShell.
---
<div class="center">
@ -119,7 +119,7 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
#### Elvish
::: تحذير يدعم فقط elvish v0.15 أو أعلى. :::
::: warning Only elvish v0.17 or higher is supported. :::
أضف ما يلي إلى نهاية `~/.elvish/rc.elv`:
@ -164,3 +164,14 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
execx($(starship init xonsh))
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```

View File

@ -8,6 +8,30 @@ The configurations in this section are subject to change in future releases of S
:::
## Custom pre-prompt and pre-execution Commands in Cmd
Clink provides extremely flexible APIs to run pre-prompt and pre-exec commands in Cmd shell. It is fairly simple to use with Starship. Make the following changes to your `starship.lua` file as per your requirements:
- To run a custom function right before the prompt is drawn, define a new function called `starship_preprompt_user_func`. This function receives the current prompt as a string that you can utilize. For example, to draw a rocket before the prompt, you would do
```lua
function starship_preprompt_user_func(prompt)
print("🚀")
end
load(io.popen('starship init cmd'):read("*a"))()
```
- To run a custom function right before a command is executed, define a new function called `starship_precmd_user_func`. This function receives the current commandline as a string that you can utilize. For example, to print the command that's about to be executed, you would do
```lua
function starship_precmd_user_func(line)
print("Executing: "..line)
end
load(io.popen('starship init cmd'):read("*a"))()
```
## Custom pre-prompt and pre-execution Commands in Bash
Bash does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `bash`. However, Starship does give you limited ability to insert your own functions into the prompt-rendering procedure:
@ -45,7 +69,7 @@ function Invoke-Starship-PreCommand {
## Change Window Title
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash` or `zsh`.
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash`, `zsh`, `cmd` or `powershell`.
First, define a window title change function (identical in bash and zsh):
@ -80,6 +104,16 @@ function set_win_title(){
starship_precmd_user_func="set_win_title"
```
For Cmd, you can change the window title using the `starship_preprompt_user_func` function.
```lua
function starship_preprompt_user_func(prompt)
console.settitle(os.getenv('USERNAME').."@"..os.getenv('COMPUTERNAME')..": "..os.getcwd())
end
load(io.popen('starship init cmd'):read("*a"))()
```
You can also set a similar output with PowerShell by creating a function named `Invoke-Starship-PreCommand`.
```powershell
@ -97,7 +131,7 @@ Some shells support a right prompt which renders on the same line as the input.
Note: The right prompt is a single line following the input location. To right align modules above the input line in a multi-line prompt, see the [fill module](/config/#fill).
`right_format` is currently supported for the following shells: elvish, fish, zsh.
`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd.
### مثال
@ -117,6 +151,28 @@ Produces a prompt like the following:
▶ starship on  rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s
```
## Continuation Prompt
Some shells support a continuation prompt along with the normal prompt. This prompt is rendered instead of the normal prompt when the user has entered an incomplete statement (such as a single left parenthesis or quote).
Starship can set the continuation prompt using the `continuation_prompt` option. The default prompt is `"[∙](bright-black) "`.
Note: `continuation_prompt` should be set to a literal string without any variables.
Note: Continuation prompts are only available in the following shells:
- `bash`
- `zsh`
- `PowerShell`
### مثال
```toml
# ~/.config/starship.toml
# A continuation prompt that displays two filled in arrows
continuation_prompt = "▶▶"
```
## Style Strings

View File

@ -24,13 +24,19 @@ disabled = true
You can change default configuration file location with `STARSHIP_CONFIG` environment variable:
```sh
export STARSHIP_CONFIG=~/.starship/config.toml
export STARSHIP_CONFIG=~/example/non/default/path/starship.toml
```
Equivalently in PowerShell (Windows) would be adding this line to your `$PROFILE`:
```powershell
$ENV:STARSHIP_CONFIG = "$HOME\.starship\config.toml"
$ENV:STARSHIP_CONFIG = "$HOME\example\non\default\path\starship.toml"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CONFIG', 'C:\\Users\\user\\example\\non\\default\\path\\starship.toml')
```
### Logging
@ -47,6 +53,12 @@ Equivalently in PowerShell (Windows) would be adding this line to your `$PROFILE
$ENV:STARSHIP_CACHE = "$HOME\AppData\Local\Temp"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CACHE', 'C:\\Users\\user\\AppData\\Local\\Temp')
```
### Terminology
**Module**: A component in the prompt giving information based on contextual information from your OS. For example, the "nodejs" module shows the version of Node.js that is currently installed on your computer, if your current directory is a Node.js project.
@ -63,7 +75,7 @@ Format strings are the format that a module prints all its variables with. Most
A variable contains a `$` symbol followed by the name of the variable. The name of a variable can only contain letters, numbers and `_`.
على سبيل المثال:
For example:
- `$version` is a format string with a variable named `version`.
- `$git_branch$git_commit` is a format string with two variables named `git_branch` and `git_commit`.
@ -77,7 +89,7 @@ The first part, which is enclosed in a `[]`, is a [format string](#format-string
In the second part, which is enclosed in a `()`, is a [style string](#style-strings). This can be used to style the first part.
على سبيل المثال:
For example:
- `[on](red bold)` will print a string `on` with bold text colored red.
- `[⌘ $version](bold green)` will print a symbol `⌘` followed by the content of variable `version`, with bold text colored green.
@ -100,7 +112,7 @@ Note that what styling looks like will be controlled by your terminal emulator.
A conditional format string wrapped in `(` and `)` will not render if all variables inside are empty.
على سبيل المثال:
For example:
- `(@$region)` will show nothing if the variable `region` is `None` or empty string, otherwise `@` followed by the value of region.
- `(some text)` will always show nothing since there are no variables wrapped in the braces.
@ -425,13 +437,13 @@ By default it only changes color. If you also want to change its shape take a lo
::: تحذير
`error_symbol` is not supported on elvish and nu shell.
`error_symbol` is not supported on nu shell.
:::
::: تحذير
`vicmd_symbol` is only supported in fish and zsh.
`vicmd_symbol` is only supported in cmd, fish and zsh.
:::
@ -568,7 +580,7 @@ Bash users who need preexec-like functionality can use [rcaloras's bash_preexec
::: tip
Showing desktop notifications requires starship to be built with `rust-notify` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
Showing desktop notifications requires starship to be built with `notify-rust` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
:::
@ -713,20 +725,20 @@ format = "via [🔰 $version](bold red) "
## Deno
The `deno` module shows you your currently installed version of [Deno](https://deno.land/). By default the module will be shown if any of the following conditions are met:
- The current directory contains a `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
- The current directory contains a `deno.json`, `deno.jsonc`, `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
### Options
| Option | الافتراضي | الوصف |
| ------------------- | -------------------------------------------- | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
| `detect_files` | `["mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `"green bold"` | The style for the module. |
| `disabled` | `false` | Disables the `deno` module. |
| Option | الافتراضي | الوصف |
| ------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
| `detect_files` | `["deno.json", "deno.jsonc", "mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `"green bold"` | The style for the module. |
| `disabled` | `false` | Disables the `deno` module. |
### Variables
@ -755,18 +767,19 @@ For example, given `~/Dev/Nix/nixpkgs/pkgs` where `nixpkgs` is the repo root, an
### Options
| Option | الافتراضي | الوصف |
| ------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `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)[$read_only]($read_only_style) "` | The format for the module. |
| `style` | `"bold cyan"` | The style for the module. |
| `disabled` | `false` | Disables the `directory` module. |
| `read_only` | `"🔒"` | The symbol indicating current directory is read only. |
| `read_only_style` | `"red"` | The style for the read only symbol. |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | The symbol indicating home directory. |
| Option | الافتراضي | الوصف |
| ------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `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)[$read_only]($read_only_style) "` | The format for the module. |
| `style` | `"bold cyan"` | The style for the module. |
| `disabled` | `false` | Disables the `directory` module. |
| `read_only` | `"🔒"` | The symbol indicating current directory is read only. |
| `read_only_style` | `"red"` | The style for the read only symbol. |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | The symbol indicating home directory. |
| `use_os_path_sep` | `true` | Use the OS specific path seperator instead of always using `/` (e.g. `\` on Windows) |
<details>
<summary>This module has a few advanced configuration options that control how the directory is displayed.</summary>
@ -1334,22 +1347,23 @@ The `git_status` module shows symbols representing the state of the repo in your
### Options
| 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` |
| `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` |
| `style` | `"bold red"` | The style for the module. |
| `disabled` | `false` | Disables the `git_status` module. |
| 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` |
| `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` |
| `style` | `"bold red"` | The style for the module. |
| `ignore_submodules` | `false` | Ignore changes to submodules. |
| `disabled` | `false` | Disables the `git_status` module. |
### Variables
@ -1513,10 +1527,10 @@ The `hostname` module shows the system hostname.
### Variables
| Variable | مثال | الوصف |
| --------- | ---- | ------------------------------------ |
| symbol | | Mirrors the value of option `symbol` |
| style\* | | Mirrors the value of option `style` |
| Variable | مثال | الوصف |
| --------- | ---------- | ----------------------------------- |
| hostname | `computer` | The hostname of the computer |
| style\* | | Mirrors the value of option `style` |
\*: This variable can only be used as a part of a style string
@ -2133,7 +2147,7 @@ symbol = "☁️ "
## 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`, `composer`, `gradle`, `julia`, `mix`, `helm` and `shards` packages.
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`, `composer`, `gradle`, `julia`, `mix`, `helm`, `shards` 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
@ -2150,6 +2164,7 @@ The `package` module is shown when the current directory is the repository for a
- [**Shards**](https://crystal-lang.org/reference/the_shards_command/index.html) - The `shards` package version is extracted from the `shard.yml` present
- [**V**](https://vlang.io) - The `vlang` package version is extracted from the `v.mod` present
- [**SBT**](https://scala-sbt.org) - The `sbt` package version is extracted from the `build.sbt` present in the current directory
- [**Dart**](https://pub.dev/) - The `dart` package version is extracted from the `pubspec.yaml` present in the current directory
> ⚠️ The version being shown is that of the package whose source code is in your current directory, not your package manager.
@ -2673,6 +2688,8 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
| `elvish_indicator` | `esh` | A format string used to represent elvish. |
| `tcsh_indicator` | `tsh` | A format string used to represent tcsh. |
| `xonsh_indicator` | `xsh` | A format string used to represent xonsh. |
| `cmd_indicator` | `cmd` | A format string used to represent cmd. |
| `nu_indicator` | `nu` | A format string used to represent nu. |
| `unknown_indicator` | | The default value to be displayed when the shell is unknown. |
| `format` | `"[$indicator]($style) "` | The format for the module. |
| `style` | `"white bold"` | The style for the module. |
@ -2778,7 +2795,7 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
:::
::: warning This module is not supported on elvish and nu shell. :::
::: warning This module is not supported on nu shell. :::
### Options
@ -2804,6 +2821,7 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
| Variable | مثال | الوصف |
| -------------- | ------- | ------------------------------------------------------------------------------------------- |
| status | `127` | The exit code of the last command |
| hex_status | `0x7F` | The exit code of the last command in hex |
| int | `127` | The exit code of the last command |
| common_meaning | `ERROR` | Meaning of the code if not a signal |
| signal_number | `9` | Signal number corresponding to the exit code, only if signalled |

View File

@ -69,13 +69,13 @@ If you see symbols that you don't recognise you can use `starship explain` to ex
You can enable the debug logs by using the `STARSHIP_LOG` env var. These logs can be very verbose so it is often useful to use the `module` command if you are trying to debug a particular module, for example, if you are trying to debug the `rust` module you could run the following command to get the trace logs and output from the module.
```sh
env STARHIP_LOG=trace starship module rust
env STARSHIP_LOG=trace starship module rust
```
If starship is being slow you can try using the `timings` command to see if there is a particular module or command that to blame.
```sh
env STARHIP_LOG=trace starship timings
env STARSHIP_LOG=trace starship timings
```
This will output the trace log and a breakdown of all modules that either took more than 1ms to execute or produced some output.
@ -118,5 +118,5 @@ If Starship was installed using the install script, the following command will d
```sh
# Locate and delete the starship binary
sh -c 'rm "$(which starship)"'
sh -c 'rm "$(command -v 'starship')"'
```

View File

@ -72,6 +72,22 @@
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-fr.png"
alt="Français"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/id-ID/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-id.png"
alt="Bahasa Indonesia"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/it-IT/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-it.png"
alt="Italiano"
/></a>
&nbsp;
<a
@ -252,7 +268,7 @@
#### Elvish
**تحذير** يدعم فقط v0.15 أو أعلى. أضف ما يلي إلى نهاية `~/.elvish/rc.elv`:
**Warning** Only elvish v0.17 or higher is supported. أضف ما يلي إلى نهاية `~/.elvish/rc.elv`:
```sh
# ~/.elvish/rc.elv
@ -283,9 +299,20 @@
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```
#### Nushell
**تحذير** هذا سوف يتغير في المستقبل. فقط إصدار nu v0.33 أو أعلى مدعوم. أضف ما يلي إلى ملف تكوين nu الخاص بك. يمكنك التحقق من موقع هذا الملف عن طريق تشغيل `config path` في nu.
**Warning** This will change in the future. فقط إصدار nu v0.33 أو أعلى مدعوم. Add the following to your nu config file. يمكنك التحقق من موقع هذا الملف عن طريق تشغيل `config path` في nu.
```toml
startup = [

View File

@ -224,7 +224,7 @@ format = '\[[$symbol($version)]($style)\]'
format = '\[[$symbol($version)]($style)\]'
[sudo]
format = '\[[as $symbol]\]
format = '\[[as $symbol]\]'
[swift]
format = '\[[$symbol($version)]($style)\]'

View File

@ -18,7 +18,7 @@ features:
footer: لەژێر مۆڵەتی ISCـە | مافی پارێزراوە © 2019-ئێستا بەژداریکەرانی Starship
#Used for the description meta tag, for SEO
metaTitle: "Starship: یەکێ لە Promptـە شێڵ نەناسەکان"
description: 'Starship: یەکێ لە promptـە سوکەڵە، خێرا، و بێسنور دڵخوازکراوەکان بۆ هەر شێڵێک! ئەو زانیارییانە پشان دەدات کە پێویستە، لەوکاتەیا بە ئارامی و سوکەڵەیی ئەمێنێتەوە. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, and PowerShell.'
description: 'Starship: یەکێ لە promptـە سوکەڵە، خێرا، و بێسنور دڵخوازکراوەکان بۆ هەر شێڵێک! ئەو زانیارییانە پشان دەدات کە پێویستە، لەوکاتەیا بە ئارامی و سوکەڵەیی ئەمێنێتەوە. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and PowerShell.'
---
<div class="center">
@ -119,7 +119,7 @@ description: 'Starship: یەکێ لە promptـە سوکەڵە، خێرا، و ب
#### Elvish
::: ئاگادارکردنەوە تەنها elvish v0.15 یان بەرزتر پشتگیری کراوە. :::
::: warning Only elvish v0.17 or higher is supported. :::
ئەمەی خوارەوە زیادبکە لە کۆتایی `~/.elvish/rc.elv`:
@ -164,3 +164,14 @@ description: 'Starship: یەکێ لە promptـە سوکەڵە، خێرا، و ب
execx($(starship init xonsh))
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```

View File

@ -8,9 +8,33 @@
:::
## فرمانە کڕیاڕخوازەکانی pre-prompt و pre-execution لە Bashـدا
## Custom pre-prompt and pre-execution Commands in Cmd
بەپێچەوانەی شێلەکانی دیکە Bash هیچ چوارچێوەیەکی فەرمی preexec/precmdـی نییە. لەبەر ئەوە، دابین کردنی قولابە تەواو کڕیارخوازکراوەکان ئاسان نییە لە `Bash`. However, Starship does give you limited ability to insert your own functions into the prompt-rendering procedure:
Clink provides extremely flexible APIs to run pre-prompt and pre-exec commands in Cmd shell. It is fairly simple to use with Starship. Make the following changes to your `starship.lua` file as per your requirements:
- To run a custom function right before the prompt is drawn, define a new function called `starship_preprompt_user_func`. This function receives the current prompt as a string that you can utilize. For example, to draw a rocket before the prompt, you would do
```lua
function starship_preprompt_user_func(prompt)
print("🚀")
end
load(io.popen('starship init cmd'):read("*a"))()
```
- To run a custom function right before a command is executed, define a new function called `starship_precmd_user_func`. This function receives the current commandline as a string that you can utilize. For example, to print the command that's about to be executed, you would do
```lua
function starship_precmd_user_func(line)
print("Executing: "..line)
end
load(io.popen('starship init cmd'):read("*a"))()
```
## Custom pre-prompt and pre-execution Commands in Bash
Bash does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `bash`. However, Starship does give you limited ability to insert your own functions into the prompt-rendering procedure:
- To run a custom function right before the prompt is drawn, define a new function and then assign its name to `starship_precmd_user_func`. For example, to draw a rocket before the prompt, you would do
@ -45,7 +69,7 @@ function Invoke-Starship-PreCommand {
## Change Window Title
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash` or `zsh`.
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash`, `zsh`, `cmd` or `powershell`.
First, define a window title change function (identical in bash and zsh):
@ -80,6 +104,16 @@ function set_win_title(){
starship_precmd_user_func="set_win_title"
```
For Cmd, you can change the window title using the `starship_preprompt_user_func` function.
```lua
function starship_preprompt_user_func(prompt)
console.settitle(os.getenv('USERNAME').."@"..os.getenv('COMPUTERNAME')..": "..os.getcwd())
end
load(io.popen('starship init cmd'):read("*a"))()
```
You can also set a similar output with PowerShell by creating a function named `Invoke-Starship-PreCommand`.
```powershell
@ -97,7 +131,7 @@ Some shells support a right prompt which renders on the same line as the input.
Note: The right prompt is a single line following the input location. To right align modules above the input line in a multi-line prompt, see the [fill module](/config/#fill).
`right_format` is currently supported for the following shells: elvish, fish, zsh.
`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd.
### نموونە
@ -117,22 +151,44 @@ Produces a prompt like the following:
▶ starship on  rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s
```
## Continuation Prompt
Some shells support a continuation prompt along with the normal prompt. This prompt is rendered instead of the normal prompt when the user has entered an incomplete statement (such as a single left parenthesis or quote).
Starship can set the continuation prompt using the `continuation_prompt` option. The default prompt is `"[∙](bright-black) "`.
Note: `continuation_prompt` should be set to a literal string without any variables.
Note: Continuation prompts are only available in the following shells:
- `bash`
- `zsh`
- `PowerShell`
### نموونە
```toml
# ~/.config/starship.toml
# A continuation prompt that displays two filled in arrows
continuation_prompt = "▶▶"
```
## Style Strings
Style strings are a list of words, separated by whitespace. The words are not case sensitive (i.e. `bold` and `BoLd` are considered the same string). Each word can be one of the following:
- `تۆخ`
- `لار`
- `بنهێڵ`
- `کاڵ کراو`
- `پێچەوانە کراو`
- `bold`
- `italic`
- `underline`
- `dimmed`
- `inverted`
- `bg:<color>`
- `fg:<color>`
- `<color>`
- `هیچ`
- `none`
کە `<color>` دیاریکەری ڕەنگێکە (لە ژێرەوە باسکراوە). `fg:<color>` و `<color>` لە ئێستادا هەمان شت ئەکەن، بەڵام ئەمە ڕەنگە لە داهاتووا بگۆڕێت. `inverted` ڕەنگی پاشبنەما و پێشبنەما ئەگۆڕێتەوە. ڕیزبەندی ووشەکان لە زنجیرەکەدا گرنگ نییە.
where `<color>` is a color specifier (discussed below). `fg:<color>` and `<color>` currently do the same thing, though this may change in the future. `inverted` swaps the background and foreground colors. The order of words in the string does not matter.
The `none` token overrides all other tokens in a string if it is not part of a `bg:` specifier, so that e.g. `fg:red none fg:blue` will still create a string with no styling. `bg:none` sets the background to the default color so `fg:red bg:none` is equivalent to `red` or `fg:red` and `bg:green fg:red bg:none` is also equivalent to `fg:red` or `red`. It may become an error to use `none` in conjunction with other tokens in the future.

View File

@ -24,13 +24,19 @@ disabled = true
You can change default configuration file location with `STARSHIP_CONFIG` environment variable:
```sh
export STARSHIP_CONFIG=~/.starship/config.toml
export STARSHIP_CONFIG=~/example/non/default/path/starship.toml
```
Equivalently in PowerShell (Windows) would be adding this line to your `$PROFILE`:
```powershell
$ENV:STARSHIP_CONFIG = "$HOME\.starship\config.toml"
$ENV:STARSHIP_CONFIG = "$HOME\example\non\default\path\starship.toml"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CONFIG', 'C:\\Users\\user\\example\\non\\default\\path\\starship.toml')
```
### Logging
@ -47,6 +53,12 @@ Equivalently in PowerShell (Windows) would be adding this line to your `$PROFILE
$ENV:STARSHIP_CACHE = "$HOME\AppData\Local\Temp"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CACHE', 'C:\\Users\\user\\AppData\\Local\\Temp')
```
### Terminology
**Module**: A component in the prompt giving information based on contextual information from your OS. For example, the "nodejs" module shows the version of Node.js that is currently installed on your computer, if your current directory is a Node.js project.
@ -63,7 +75,7 @@ Format strings are the format that a module prints all its variables with. Most
A variable contains a `$` symbol followed by the name of the variable. The name of a variable can only contain letters, numbers and `_`.
بۆ نموونە:
For example:
- `$version` is a format string with a variable named `version`.
- `$git_branch$git_commit` is a format string with two variables named `git_branch` and `git_commit`.
@ -77,7 +89,7 @@ The first part, which is enclosed in a `[]`, is a [format string](#format-string
In the second part, which is enclosed in a `()`, is a [style string](#style-strings). This can be used to style the first part.
بۆ نموونە:
For example:
- `[on](red bold)` will print a string `on` with bold text colored red.
- `[⌘ $version](bold green)` will print a symbol `⌘` followed by the content of variable `version`, with bold text colored green.
@ -100,7 +112,7 @@ Note that what styling looks like will be controlled by your terminal emulator.
A conditional format string wrapped in `(` and `)` will not render if all variables inside are empty.
بۆ نموونە:
For example:
- `(@$region)` will show nothing if the variable `region` is `None` or empty string, otherwise `@` followed by the value of region.
- `(some text)` will always show nothing since there are no variables wrapped in the braces.
@ -425,13 +437,13 @@ By default it only changes color. If you also want to change its shape take a lo
::: ئاگادارکردنەوە
`error_symbol` is not supported on elvish and nu shell.
`error_symbol` is not supported on nu shell.
:::
::: ئاگادارکردنەوە
`vicmd_symbol` is only supported in fish and zsh.
`vicmd_symbol` is only supported in cmd, fish and zsh.
:::
@ -568,7 +580,7 @@ Bash users who need preexec-like functionality can use [rcaloras's bash_preexec
::: tip
Showing desktop notifications requires starship to be built with `rust-notify` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
Showing desktop notifications requires starship to be built with `notify-rust` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
:::
@ -713,20 +725,20 @@ format = "via [🔰 $version](bold red) "
## Deno
The `deno` module shows you your currently installed version of [Deno](https://deno.land/). By default the module will be shown if any of the following conditions are met:
- The current directory contains a `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
- The current directory contains a `deno.json`, `deno.jsonc`, `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
### Options
| Option | Default | Description |
| ------------------- | -------------------------------------------- | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
| `detect_files` | `["mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `"green bold"` | The style for the module. |
| `disabled` | `false` | Disables the `deno` module. |
| Option | Default | Description |
| ------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
| `detect_files` | `["deno.json", "deno.jsonc", "mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `"green bold"` | The style for the module. |
| `disabled` | `false` | Disables the `deno` module. |
### Variables
@ -755,18 +767,19 @@ For example, given `~/Dev/Nix/nixpkgs/pkgs` where `nixpkgs` is the repo root, an
### Options
| Option | Default | Description |
| ------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `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)[$read_only]($read_only_style) "` | The format for the module. |
| `style` | `"bold cyan"` | The style for the module. |
| `disabled` | `false` | Disables the `directory` module. |
| `read_only` | `"🔒"` | The symbol indicating current directory is read only. |
| `read_only_style` | `"red"` | The style for the read only symbol. |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | The symbol indicating home directory. |
| Option | Default | Description |
| ------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `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)[$read_only]($read_only_style) "` | The format for the module. |
| `style` | `"bold cyan"` | The style for the module. |
| `disabled` | `false` | Disables the `directory` module. |
| `read_only` | `"🔒"` | The symbol indicating current directory is read only. |
| `read_only_style` | `"red"` | The style for the read only symbol. |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | The symbol indicating home directory. |
| `use_os_path_sep` | `true` | Use the OS specific path seperator instead of always using `/` (e.g. `\` on Windows) |
<details>
<summary>This module has a few advanced configuration options that control how the directory is displayed.</summary>
@ -1334,22 +1347,23 @@ The `git_status` module shows symbols representing the state of the repo in your
### Options
| Option | Default | Description |
| ------------ | ----------------------------------------------- | ----------------------------------- |
| `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` |
| `style` | `"bold red"` | The style for the module. |
| `disabled` | `false` | Disables the `git_status` module. |
| Option | Default | Description |
| ------------------- | ----------------------------------------------- | ----------------------------------- |
| `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` |
| `style` | `"bold red"` | The style for the module. |
| `ignore_submodules` | `false` | Ignore changes to submodules. |
| `disabled` | `false` | Disables the `git_status` module. |
### Variables
@ -1513,10 +1527,10 @@ The `hostname` module shows the system hostname.
### Variables
| گۆڕاو | نموونە | Description |
| --------- | ------ | ------------------------------------ |
| symbol | | Mirrors the value of option `symbol` |
| style\* | | Mirrors the value of option `style` |
| گۆڕاو | نموونە | Description |
| --------- | ---------- | ----------------------------------- |
| hostname | `computer` | The hostname of the computer |
| style\* | | Mirrors the value of option `style` |
\*: This variable can only be used as a part of a style string
@ -2133,7 +2147,7 @@ symbol = "☁️ "
## 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`, `composer`, `gradle`, `julia`, `mix`, `helm` and `shards` packages.
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`, `composer`, `gradle`, `julia`, `mix`, `helm`, `shards` 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
@ -2150,6 +2164,7 @@ The `package` module is shown when the current directory is the repository for a
- [**Shards**](https://crystal-lang.org/reference/the_shards_command/index.html) - The `shards` package version is extracted from the `shard.yml` present
- [**V**](https://vlang.io) - The `vlang` package version is extracted from the `v.mod` present
- [**SBT**](https://scala-sbt.org) - The `sbt` package version is extracted from the `build.sbt` present in the current directory
- [**Dart**](https://pub.dev/) - The `dart` package version is extracted from the `pubspec.yaml` present in the current directory
> ⚠️ The version being shown is that of the package whose source code is in your current directory, not your package manager.
@ -2673,6 +2688,8 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
| `elvish_indicator` | `esh` | A format string used to represent elvish. |
| `tcsh_indicator` | `tsh` | A format string used to represent tcsh. |
| `xonsh_indicator` | `xsh` | A format string used to represent xonsh. |
| `cmd_indicator` | `cmd` | A format string used to represent cmd. |
| `nu_indicator` | `nu` | A format string used to represent nu. |
| `unknown_indicator` | | The default value to be displayed when the shell is unknown. |
| `format` | `"[$indicator]($style) "` | The format for the module. |
| `style` | `"white bold"` | The style for the module. |
@ -2778,7 +2795,7 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
:::
::: warning This module is not supported on elvish and nu shell. :::
::: warning This module is not supported on nu shell. :::
### Options
@ -2804,6 +2821,7 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
| گۆڕاو | نموونە | Description |
| -------------- | ------- | ------------------------------------------------------------------------------------------- |
| status | `127` | The exit code of the last command |
| hex_status | `0x7F` | The exit code of the last command in hex |
| int | `127` | The exit code of the last command |
| common_meaning | `ERROR` | Meaning of the code if not a signal |
| signal_number | `9` | Signal number corresponding to the exit code, only if signalled |

View File

@ -69,13 +69,13 @@ If you see symbols that you don't recognise you can use `starship explain` to ex
You can enable the debug logs by using the `STARSHIP_LOG` env var. These logs can be very verbose so it is often useful to use the `module` command if you are trying to debug a particular module, for example, if you are trying to debug the `rust` module you could run the following command to get the trace logs and output from the module.
```sh
env STARHIP_LOG=trace starship module rust
env STARSHIP_LOG=trace starship module rust
```
If starship is being slow you can try using the `timings` command to see if there is a particular module or command that to blame.
```sh
env STARHIP_LOG=trace starship timings
env STARSHIP_LOG=trace starship timings
```
This will output the trace log and a breakdown of all modules that either took more than 1ms to execute or produced some output.
@ -118,5 +118,5 @@ If Starship was installed using the install script, the following command will d
```sh
# Locate and delete the starship binary
sh -c 'rm "$(which starship)"'
sh -c 'rm "$(command -v 'starship')"'
```

View File

@ -68,6 +68,22 @@
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-fr.png"
alt="Français"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/id-ID/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-id.png"
alt="Bahasa Indonesia"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/it-IT/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-it.png"
alt="Italiano"
/></a>
&nbsp;
<a
@ -83,7 +99,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-br.png"
alt="پورتوگالیی بەڕازیل"
alt="Português do Brasil"
/></a>
&nbsp;
<a
@ -248,7 +264,7 @@
#### Elvish
**ئاگادارکردنەوە** تەنها elvish v0.15 یان بەرزتر پشتگیری کراوە. ئەمەی خوارەوە زیادبکە لە کۆتایی `~/.elvish/rc.elv`:
**Warning** Only elvish v0.17 or higher is supported. ئەمەی خوارەوە زیادبکە لە کۆتایی `~/.elvish/rc.elv`:
```sh
# ~/.elvish/rc.elv
@ -279,9 +295,20 @@
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```
#### Nushell
**ئاگادارکردنەوە** ئەمە لە داهاتوودا دەگۆڕێت. تەنها وەشانی v0.33 یان بەرزتری nu پشتگیریکراوە. ئەمەی خوارەوە زیادبکە بۆ پەڕگەی ڕێکخستنی nuـەکەت. ئەتوانی شوێنی ئەم پەڕگەیە بپشکنی بە جێبەجێکردنی `config path` لە nu دا.
**Warning** This will change in the future. تەنها وەشانی v0.33 یان بەرزتری nu پشتگیریکراوە. Add the following to your nu config file. ئەتوانی شوێنی ئەم پەڕگەیە بپشکنی بە جێبەجێکردنی `config path` لە nu دا.
```toml
startup = [

View File

@ -224,7 +224,7 @@ format = '\[[$symbol($version)]($style)\]'
format = '\[[$symbol($version)]($style)\]'
[sudo]
format = '\[[as $symbol]\]
format = '\[[as $symbol]\]'
[swift]
format = '\[[$symbol($version)]($style)\]'

View File

@ -18,7 +18,7 @@ features:
footer: ICS lizenziert | Copyright © 2019-heute Starship-Mitwirkende
#Used for the description meta tag, for SEO
metaTitle: "Starship: Cross-Shell Prompt"
description: Starship ist eine minimale, super schnelle, und extrem anpassbare Prompt für jede Shell! Sie zeigt die Information, die man benötigt an, während sie schnell und minimal bleibt. Schnell-Installation verfügbar für Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, und PowerShell.
description: Starship ist eine minimale, super schnelle, und extrem anpassbare Prompt für jede Shell! Sie zeigt die Information, die man benötigt an, während sie schnell und minimal bleibt. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and PowerShell.
---
<div class="center">
@ -119,7 +119,7 @@ description: Starship ist eine minimale, super schnelle, und extrem anpassbare P
#### Elvish
::: warning Nur elvish v0.15 oder höher ist unterstützt. :::
::: warning Only elvish v0.17 or higher is supported. :::
Trage folgendes am Ende von `~/.config/fish/rc.elv` ein:
@ -164,3 +164,14 @@ description: Starship ist eine minimale, super schnelle, und extrem anpassbare P
execx($(starship init xonsh))
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```

View File

@ -8,11 +8,35 @@ Die hier beschriebenen Konfigurationen werden sich mit kommenden Updates von Sta
:::
## Benutzerdefinierte Pre-Prompt- und Pre-Execution-Befehle in der Bash
## Custom pre-prompt and pre-execution Commands in Cmd
Die Bash Shell hat, im Gegensatz zu vielen anderen Shells, kein konventionelles preexec/precmd Framework. Daher gestaltet es sich schwierig, vollständig anpassbare Hooks für `bash` anzubieten. Starship bietet daher die begrenzte Möglichkeit, eigene Funktionen in das prompt rendering Verfahren einzufügen:
Clink provides extremely flexible APIs to run pre-prompt and pre-exec commands in Cmd shell. It is fairly simple to use with Starship. Make the following changes to your `starship.lua` file as per your requirements:
- Um eine benutzerdefinierte Funktion kurz vor Anzeige der Eingabeaufforderung auszuführen, definiere eine neue Funktion und weise den Namen `starship_precmd_user_func` zu. Um beispielsweise eine Rakete anzuzeigen, bevor die Eingabeaufforderung erscheint, würde man folgendes tun
- To run a custom function right before the prompt is drawn, define a new function called `starship_preprompt_user_func`. This function receives the current prompt as a string that you can utilize. For example, to draw a rocket before the prompt, you would do
```lua
function starship_preprompt_user_func(prompt)
print("🚀")
end
load(io.popen('starship init cmd'):read("*a"))()
```
- To run a custom function right before a command is executed, define a new function called `starship_precmd_user_func`. This function receives the current commandline as a string that you can utilize. For example, to print the command that's about to be executed, you would do
```lua
function starship_precmd_user_func(line)
print("Executing: "..line)
end
load(io.popen('starship init cmd'):read("*a"))()
```
## Custom pre-prompt and pre-execution Commands in Bash
Bash does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `bash`. Starship bietet daher die begrenzte Möglichkeit, eigene Funktionen in das prompt rendering Verfahren einzufügen:
- To run a custom function right before the prompt is drawn, define a new function and then assign its name to `starship_precmd_user_func`. For example, to draw a rocket before the prompt, you would do
```bash
function blastoff(){
@ -21,13 +45,13 @@ function blastoff(){
starship_precmd_user_func="blastoff"
```
- Um eine benutzerdefinierte Funktion direkt vor der Ausführung eines Befehls auszulösen, kann man den [`DEBUG` trap](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/) Mechanismus verwenden. Allerdings **muss** das DEBUG Signal *vor* der Initialisierung von Starship getrapped werden! Starship kann den Wert der DEBUG-trap speichern. Wenn der Wert der DEBUG-trap überschrieben wird nachdem Starship gestartet ist kann es zu Fehlern im Bezug auf die verwendete DEBUG-trap kommen.
- To run a custom function right before a command runs, you can use the [`DEBUG` trap mechanism](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). However, you **must** trap the DEBUG signal *before* initializing Starship! Starship can preserve the value of the DEBUG trap, but if the trap is overwritten after starship starts up, some functionality will break.
```bash
function blastoff(){
echo "🚀"
}
trap blastoff DEBUG # DEBUG-Trap *bevor* Starship läuft
trap blastoff DEBUG # Trap DEBUG *before* running starship
eval $(starship init bash)
```
@ -43,27 +67,27 @@ function Invoke-Starship-PreCommand {
}
```
## Fenstertitel anpassen
## Change Window Title
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish ist standardmäßig so konfiguriert. Starship ändert standardmäßig den Fenstertitel nicht, aber es ist sehr einfach die Funktion zu `bash` oder `zsh` hinzuzufügen.
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash`, `zsh`, `cmd` or `powershell`.
Zuerst wird eine Funktion definiert um den Fenstertitel zu ändern ( für bash und zsh ist die Funktion identisch):
First, define a window title change function (identical in bash and zsh):
```bash
function set_win_title(){
echo -ne "\033]0; DEIN_FENSTERTITEL_HIER \007"
echo -ne "\033]0; YOUR_WINDOW_TITLE_HERE \007"
}
```
Sie können Variablen verwenden, um diesen Titel anzupassen (`$USER`, `$HOSTNAME`, `$PWD`).
You can use variables to customize this title (`$USER`, `$HOSTNAME`, and `$PWD` are popular choices).
Für `bash` muss die Funktion als "precmd starship"-Funktion gesetzt werden:
In `bash`, set this function to be the precmd starship function:
```bash
starship_precmd_user_func="set_win_title"
```
Füge dies in `Zsh` zum `precmd_functions`-Array hinzu:
In `zsh`, add this to the `precmd_functions` array:
```bash
precmd_functions+=(set_win_title)
@ -71,7 +95,7 @@ precmd_functions+=(set_win_title)
If you like the result, add these lines to your shell configuration file (`~/.bashrc` or `~/.zshrc`) to make it permanent.
Zum Beispiel, wenn sie ihr aktuelles Verzeichnis als Terminal Title anzeigen wollen, fügen Sie folgenden Code-Schnipsel zu ihrer `~/.bashrc` oder `~/.zshrc` hinzu:
For example, if you want to display your current directory in your terminal tab title, add the following snippet to your `~/.bashrc` or `~/.zshrc`:
```bash
function set_win_title(){
@ -80,6 +104,16 @@ function set_win_title(){
starship_precmd_user_func="set_win_title"
```
For Cmd, you can change the window title using the `starship_preprompt_user_func` function.
```lua
function starship_preprompt_user_func(prompt)
console.settitle(os.getenv('USERNAME').."@"..os.getenv('COMPUTERNAME')..": "..os.getcwd())
end
load(io.popen('starship init cmd'):read("*a"))()
```
You can also set a similar output with PowerShell by creating a function named `Invoke-Starship-PreCommand`.
```powershell
@ -97,7 +131,7 @@ Some shells support a right prompt which renders on the same line as the input.
Note: The right prompt is a single line following the input location. To right align modules above the input line in a multi-line prompt, see the [fill module](/config/#fill).
`right_format` is currently supported for the following shells: elvish, fish, zsh.
`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd.
### Beispiel
@ -117,10 +151,32 @@ Produces a prompt like the following:
▶ starship on  rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s
```
## Continuation Prompt
Some shells support a continuation prompt along with the normal prompt. This prompt is rendered instead of the normal prompt when the user has entered an incomplete statement (such as a single left parenthesis or quote).
Starship can set the continuation prompt using the `continuation_prompt` option. The default prompt is `"[∙](bright-black) "`.
Note: `continuation_prompt` should be set to a literal string without any variables.
Note: Continuation prompts are only available in the following shells:
- `bash`
- `zsh`
- `PowerShell`
### Beispiel
```toml
# ~/.config/starship.toml
# A continuation prompt that displays two filled in arrows
continuation_prompt = "▶▶"
```
## Style-Strings
Style-String sind Wortlisten, getrennt durch Leerzeichen. Die Wörter haben keine Groß- und Kleinschreibung (z.B. `bold` und `BoLd` werden als dieselbe Zeichenkette betrachtet). Jedes Wort kann eines der folgenden sein:
Style strings are a list of words, separated by whitespace. The words are not case sensitive (i.e. `bold` and `BoLd` are considered the same string). Each word can be one of the following:
- `bold`
- `italic`
@ -132,14 +188,14 @@ Style-String sind Wortlisten, getrennt durch Leerzeichen. Die Wörter haben kein
- `<color>`
- `none`
wobei `<color>` eine Farbspezifikation ist (siehe unten). `fg:<color>` and `<color>` currently do the same thing, though this may change in the future. `inverted` swaps the background and foreground colors. Die Reihenfolge der Wörter in der Liste spielt keine Rolle.
where `<color>` is a color specifier (discussed below). `fg:<color>` and `<color>` currently do the same thing, though this may change in the future. `inverted` swaps the background and foreground colors. The order of words in the string does not matter.
The `none` token overrides all other tokens in a string if it is not part of a `bg:` specifier, so that e.g. `fg:red none fg:blue` will still create a string with no styling. `bg:none` sets the background to the default color so `fg:red bg:none` is equivalent to `red` or `fg:red` and `bg:green fg:red bg:none` is also equivalent to `fg:red` or `red`. In der Zukunft könnte die Unterstützung von `none` in Verbindung mit anderen Tokens fallen gelassen werden.
The `none` token overrides all other tokens in a string if it is not part of a `bg:` specifier, so that e.g. `fg:red none fg:blue` will still create a string with no styling. `bg:none` sets the background to the default color so `fg:red bg:none` is equivalent to `red` or `fg:red` and `bg:green fg:red bg:none` is also equivalent to `fg:red` or `red`. It may become an error to use `none` in conjunction with other tokens in the future.
Eine Farbspezifikation kann wie folgt aussehen:
A color specifier can be one of the following:
- Einer der Standardfarben der Konsole: `black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`. Optional kann ein `bright-` vorangestellt werden um die helle Version zu erhalten (z.B. `bright-white`).
- Eine `#` gefolgt von einer sechsstelligen Hexadezimalnummer. Dies ergibt einen [RGB hex Farbcode](https://www.w3schools.com/colors/colors_hexadecimal.asp).
- Eine Zahl zwischen 0-255. Dies ergibt einen [8-bit ANSI-Farbcode](https://i.stack.imgur.com/KTSQa.png).
- One of the standard terminal colors: `black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`. You can optionally prefix these with `bright-` to get the bright version (e.g. `bright-white`).
- A `#` followed by a six-digit hexadecimal number. This specifies an [RGB color hex code](https://www.w3schools.com/colors/colors_hexadecimal.asp).
- A number between 0-255. This specifies an [8-bit ANSI Color Code](https://i.stack.imgur.com/KTSQa.png).
Wenn mehrere Farben für Vordergrund oder Hintergrund angegeben werden, hat die letzte Farbe der Zeichenkette Priorität.
If multiple colors are specified for foreground/background, the last one in the string will take priority.

View File

@ -1,6 +1,6 @@
# Konfiguration
Um mit der Konfiguration von Starship zu beginnen, musst du die folgende Datei erstellen: `~/.config/starship.toml`.
Um mit der Konfiguration von Starship zu beginnen, muss eine leere Datei in diesem Pfad erstellt werden: `~/.config/starship.toml`.
```sh
mkdir -p ~/.config && touch ~/.config/starship.toml
@ -21,49 +21,61 @@ success_symbol = "[➜](bold green)" # Das "succes_symbol" Segment wird zu "
disabled = true
```
Du kannst die voreingestellte Konfigurations-Datei mit der `STARSHIP_CONFIG` Umgebungsvariable verändern:
Die voreingestellte Konfigurations-Datei kann mit der `STARSHIP_CONFIG` Umgebungsvariable verändert werden. Hier z. Bsp. für die BASH shell, hinzuzufügen zur ~/. bashrc:
```sh
export STARSHIP_CONFIG=~/.starship/config.toml
export STARSHIP_CONFIG=~/example/non/default/path/starship.toml
```
Äquivalent zur PowerShell (Windows) würdest du diese Zeile zu `$PROFILE` hinzufügen:
Für die Windows PowerShell diese Zeile zum `$PROFILE` hinzufügen:
```powershell
$ENV:STARSHIP_CONFIG = "$HOME\.starship\config.toml"
$ENV:STARSHIP_CONFIG = "$HOME\example\non\default\path\starship.toml"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CONFIG', 'C:\\Users\\user\\example\\non\\default\\path\\starship.toml')
```
### Protokollierung
Standardmäßig protokolliert Starship Warnungen und Fehler in einer Datei names `~/.cache/starship/session_${STARSHIP_SESSION_KEY}.log`, wobei der session key zu der Instanz deines Terminals korrespondiert. Das kann jedoch durch die Nutzung der `STARSHIP_CACHE` Umgebungsvariable verändert werden:
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
```
Äquivalent zur PowerShell (Windows) würdest du diese Zeile zu `$PROFILE` hinzufügen:
Für die Windows PowerShell diese Zeile zum `$PROFILE` hinzufügen:
```powershell
$ENV:STARSHIP_CACHE = "$HOME\AppData\Local\Temp"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CACHE', 'C:\\Users\\user\\AppData\\Local\\Temp')
```
### Terminologie
**Modul**: Eine Komponente in der Eingabeaufforderung, welche Informationen basierend auf Kontextinformationen deines Betriebssystems angibt. Beispielsweise zeigt das "nodejs" Module die Version von Node.js, welches derzeitig auf deinem Computer installiert ist, an, falls dein derzeitiger Ordner ein Node.js Projekt ist.
**Module**: A component in the prompt giving information based on contextual information from your OS. For example, the "nodejs" module shows the version of Node.js that is currently installed on your computer, if your current directory is a Node.js project.
**Variable**: Eine kleinere Unterkomponente, welche Information des Moduls enthält. Zum Beispiel enthält die Variable "version" im Modul "nodejs" die aktuelle Version von Node.js.
**Variable**: Smaller sub-components that contain information provided by the module. For example, the "version" variable in the "nodejs" module contains the current version of Node.js.
Die meisten Module haben einen Präfix der standardmäßigen terminal-Farbe (z.B. `via` in "nodejs") und ein Leerzeichen als Suffix.
By convention, most modules have a prefix of default terminal color (e.g. `via` in "nodejs") and an empty space as a suffix.
### Formatierte Strings
Formatierte Strings sind das Format, mit dem ein Modul all seine Variablen ausgibt. Die meisten Module haben den Eintrag `format`, welcher das anzeige-Format des Moduls konfiguriert. Du kannst Texte, Variablen und Textgruppen in einem formatierten string benutzen.
Format strings are the format that a module prints all its variables with. Most modules have an entry called `format` that configures the display format of the module. You can use texts, variables and text groups in a format string.
#### Variable
Eine Variable besteht aus dem `$` Symbol und dem Namen der Variable. The name of a variable can only contain letters, numbers and `_`.
A variable contains a `$` symbol followed by the name of the variable. The name of a variable can only contain letters, numbers and `_`.
Hier sind ein paar Beispiele:
For example:
- `$version` ist ein formatierter string mit dem Namen `version`.
- `$git_branch$git_commit` ist ein formatierter string mit zwei Variablen, nämlich `git_branch` und `git_commit`.
@ -71,13 +83,13 @@ Hier sind ein paar Beispiele:
#### Textgruppe
Eine Textgruppe besteht aus zwei verschiedenen Teilen.
A text group is made up of two different parts.
Der erste Teil, welcher innerhalb eckiger Klammern `[]` ist, ist ein [formatierter string](#format-strings). Du kannst ihm Texte, Variablen oder sogar verschachtelte Textgruppen hinzufügen.
The first part, which is enclosed in a `[]`, is a [format string](#format-strings). You can add texts, variables, or even nested text groups in it.
Der zweite Teil ist innerhalb normaler Klammern `()` und ist ein[style string](#style-strings). Dies kann verwendet werden, um den ersten Teil zu gestalten.
In the second part, which is enclosed in a `()`, is a [style string](#style-strings). This can be used to style the first part.
Hier sind ein paar Beispiele:
For example:
- `[on](red bold)` wird einen string `on` mit fettgedrucktem roten Text ausgeben.
- `[⌘ $version](bold green)` wird ein Symbol `⌘` gefolgt von dem Inhalt der Variable `version` mit fettgedrucktem grünen Text ausgeben.
@ -85,7 +97,7 @@ Hier sind ein paar Beispiele:
#### Style-Strings
Die meisten Module in Starship lassen dich den Darstellungsstil verändern. Dies passiert meistens an einem bestimmten Eintrag (gewöhnlich `style` genannt), der einen String mit den Einstellungen darstellt. Es folgen ein paar Beispiele für solche Strings zusammen der mit Beschreibungen, was sie bewirken. Details zur vollen Syntax findest du im [Erweiterten Konfigurationshandbuch](/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"` setzt grünen Text auf einem blauen Hintergrund
- `"bg:blue fg:bright-green"` setzt hell-grünen Text auf einen blauen Hintergrund
@ -94,19 +106,19 @@ Die meisten Module in Starship lassen dich den Darstellungsstil verändern. Dies
- `"bold italic fg:purple"` setzt lilane fett-kursive Schrift
- `""` deaktiviert explizit jeden Stil
Wie genau sich diese Konfiguration auswirkt liegt an deinem Terminal-Emulator. Einige Emulatoren zum Beispiel werden die Farben erhellen statt Text dick zu machen, und ein paar Farbthemen benutzen dieselben Werte für normale und helle Farben. Für kursiven Text muss dein Terminal Kursivschrift unterstützen.
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
#### Bedingte Formatierung
A conditional format string wrapped in `(` and `)` will not render if all variables inside are empty.
Hier sind ein paar Beispiele:
For example:
- `(@$region)` will show nothing if the variable `region` is `None` or empty string, otherwise `@` followed by the value of region.
- `(some text)` will always show nothing since there are no variables wrapped in the braces.
- When `$all` is a shortcut for `\[$a$b\]`, `($all)` will show nothing only if `$a` and `$b` are both `None`. This works the same as `(\[$a$b\] )`.
- `(@$region)` ist die Variable `region` undefiniert (`None`) oder eine leere Zeichenkette (`""`) dann wird nichts angezeigt, ansonsten <0>@</0> gefolgt von dem Inhalt der Variablen.
- `(some text)` zeigt nichts an, weil der Text in Klammern keine Variablen enthält.
- Wenn `$all` eine Abkürzung für `\[$a$b\]` ist, dann zeigt `($all)` nur nichts an wenn `$a` and `$b` beide undefiniert (`None`) sind. Dasselbe passiert mit `(\[$a$b\] )`.
#### Special characters
#### Spezielle Zeichen
The following symbols have special usage in a format string and must be escaped: `$ \ [ ] ( )`.
@ -131,17 +143,17 @@ format = '''
## Prompt
Dies ist eine Liste mit Prompt-weiten Konfigurationsoptionen.
This is the list of prompt-wide configuration options.
### Optionen
| Option | Standardwert | Beschreibung |
| ----------------- | ------------------------------ | ---------------------------------------------------------------- |
| `format` | [link](#default-prompt-format) | Configure the format of the prompt. |
| `right_format` | `""` | See [Enable Right Prompt](/advanced-config/#enable-right-prompt) |
| `scan_timeout` | `30` | Timeout für das Scannen von Dateien (in Millisekunden). |
| `command_timeout` | `500` | Timeout for commands executed by starship (in milliseconds). |
| `add_newline` | `true` | Inserts blank line between shell prompts. |
| Option | Standardwert | Beschreibung |
| ----------------- | ------------------------------ | ----------------------------------------------------------------- |
| `format` | [link](#default-prompt-format) | Das Aussehen des Prompts festlegen. |
| `right_format` | `""` | Sieh [Enable Right Prompt](/advanced-config/#enable-right-prompt) |
| `scan_timeout` | `30` | Timeout für das Scannen von Dateien (in Millisekunden). |
| `command_timeout` | `500` | Maximale Zeit für von Starship ausgeführte Kommandos. |
| `add_newline` | `true` | Fügt leere Zeilen zwischen Shell Prompts ein. |
### Beispiel
@ -149,22 +161,22 @@ Dies ist eine Liste mit Prompt-weiten Konfigurationsoptionen.
```toml
# ~/.config/starship.toml
# Verwende benutzerdefiniertes Format
# Use custom format
format = """
[┌───────────────────>](bold green)
[](bold green)$directory$rust$package
[└─>](bold green) """
# Warte 10 Millisekunden damit Starship die Dateien im aktuellen Ordner überprüfen kann.
# Wait 10 milliseconds for starship to check files under the current directory.
scan_timeout = 10
# Deaktiviere die Leerzeile am Anfang der Eingabeaufforderung
# Disable the blank line at the start of the prompt
add_newline = false
```
### Default Prompt Format
### Vordefiniertes Aussehen des Prompts
The default `format` is used to define the format of the prompt, if empty or no `format` is provided. Die Standardwerte sind folgende:
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 = "$all"
@ -248,7 +260,7 @@ format="$all$directory$character"
## AWS
Das `aws`-Modul zeigt das aktuelle AWS-Profil an. Dies basiert auf den Umgebungsvariablen: `AWS_REGION`, `AWS_DEFAULT_REGION`, `AWS_PROFILE` und der `~/.aws/config` Datei. This module also shows an expiration timer when using temporary credentials.
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. This module also shows an expiration timer when using temporary credentials.
When using [aws-vault](https://github.com/99designs/aws-vault) the profile is read from the `AWS_VAULT` env var and the credentials expiration date is read from the `AWS_SESSION_EXPIRATION` env var.
@ -347,7 +359,7 @@ style = "blue bold"
## Akkustand
Das `battery` Modul zeigt, wie hoch der Akku des Geräts geladen ist und den aktuellen Ladestatus. Das Modul ist nur sichtbar, wenn der Akku des Geräts unter 10% geladen ist.
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%.
### Optionen
@ -375,7 +387,7 @@ discharging_symbol = "💀 "
### Anzeige des Akkustandes
The `display` configuration option is used to define when the battery indicator should be shown (threshold), which symbol would be used (symbol), and what it would like (style). Wenn `display` nicht angegeben ist. Die Standardwerte sind folgende:
The `display` configuration option is used to define when the battery indicator should be shown (threshold), which symbol would be used (symbol), and what it would like (style). If no `display` is provided. The default is as shown:
```toml
[[battery.display]]
@ -387,7 +399,7 @@ The default value for the `charging_symbol` and `discharging_symbol` option is r
#### Optionen
Die `display`-Option beinhaltet ein Array mit den folgenden Werten.
The `display` option is an array of the following table.
| Option | Standardwert | Beschreibung |
| -------------------- | ------------ | --------------------------------------------------------------------------------------------------------- |
@ -414,9 +426,9 @@ discharging_symbol = "💦"
## Zeichen
Das `character` Modul zeigt ein Zeichen ( meistens einen Pfeil "") vor der Texteingabe an.
The `character` module shows a character (usually an arrow) beside where the text is entered in your terminal.
Das Zeichen zeigt an ob der letzte Befehl erfolgreich war, oder einen Fehler erzeugt hat. 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 (``/`✖`)
@ -425,13 +437,13 @@ By default it only changes color. If you also want to change its shape take a lo
::: Warnung
`error_symbol` is not supported on elvish and nu shell.
`error_symbol` is not supported on nu shell.
:::
::: Warnung
`vicmd_symbol` is only supported in fish and zsh.
`vicmd_symbol` is only supported in cmd, fish and zsh.
:::
@ -544,15 +556,15 @@ The `cobol` module shows the currently installed version of COBOL. By default, t
## Befehlsdauer
Das `cmd_duration` Modul zeigt an wie lange der letzte Befehl ausgeführt wurde. Das Modul wird nur angezeigt wenn der letzte Befehl länger als zwei Sekunden ausgeführt wurde. Mit der `min_time` Option kann die Zeit eingestellt werden ab der <0>cmd_duration</0> angezeigt wird.
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 Nicht die DEBUG-trap in der Bash hooken
::: warning Do not hook the DEBUG trap in Bash
Ist `bash` die Konsole der Wahl, dann nicht die `DEBUG`-trap nach der Ausführung von `eval $(starship init $0)` hooken, andernfalls **wird** dieses Modul unweigerlich untergehen.
If you are running Starship in `bash`, do not hook the `DEBUG` trap after running `eval $(starship init $0)`, or this module **will** break.
:::
Bash Nutzer, die eine "preexec" ähnliche Funktion benötigen, können [rcaloras bash_preexec Framework](https://github.com/rcaloras/bash-preexec) verwenden. Definieren Sie einfach die Arrays `preexec_functions` und `precmd_functions` bevor sie `eval $(starship init $0)` ausführen, und fahren Sie dann wie gewohnt fort.
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.
### Optionen
@ -568,7 +580,7 @@ Bash Nutzer, die eine "preexec" ähnliche Funktion benötigen, können [rcaloras
::: tip
Showing desktop notifications requires starship to be built with `rust-notify` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
Showing desktop notifications requires starship to be built with `notify-rust` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
:::
@ -597,7 +609,7 @@ The `conda` module shows the current [Conda](https://docs.conda.io/en/latest/) e
::: tip
Hinweis: Dies unterdrückt nicht conda's eigenen Prompt-Modifikator, sie können jedoch conda mit `conda config --set changeps1 False` konfigurieren, um die Ausgabe von conda selbst auszuschalten.
This does not suppress conda's own prompt modifier, you may want to run `conda config --set changeps1 False`.
:::
@ -713,20 +725,20 @@ format = "via [🔰 $version](bold red) "
## Deno
The `deno` module shows you your currently installed version of [Deno](https://deno.land/). By default the module will be shown if any of the following conditions are met:
- The current directory contains a `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
- The current directory contains a `deno.json`, `deno.jsonc`, `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
### Optionen
| Option | Standardwert | Beschreibung |
| ------------------- | -------------------------------------------- | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | Das Format für das Modul. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
| `detect_files` | `["mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `"green bold"` | Stil für dieses Modul. |
| `disabled` | `false` | Disables the `deno` module. |
| Option | Standardwert | Beschreibung |
| ------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | Das Format für das Modul. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
| `detect_files` | `["deno.json", "deno.jsonc", "mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `"green bold"` | Stil für dieses Modul. |
| `disabled` | `false` | Disables the `deno` module. |
### Variables
@ -747,7 +759,7 @@ format = "via [🦕 $version](green bold) "
## Verzeichnis
Das `directory` -Modul zeigt den Pfad zu Ihrem aktuellen Verzeichnis an, abgeschnitten auf drei übergeordnete Ordner. Your directory will also be truncated to the root of the git repo that you're currently in.
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.
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.
@ -755,21 +767,22 @@ For example, given `~/Dev/Nix/nixpkgs/pkgs` where `nixpkgs` is the repo root, an
### Optionen
| Option | Standardwert | Beschreibung |
| ------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `truncation_length` | `3` | Die Anzahl der übergeordneten Ordner, die angezeigt werden. |
| `truncate_to_repo` | `true` | Whether or not to truncate to the root of the git repo that you're currently in. |
| `format` | `"[$path]($style)[$read_only]($read_only_style) "` | Das Format für das Modul. |
| `style` | `"bold cyan"` | Stil für dieses Modul. |
| `disabled` | `false` | Deaktiviert das `directory`-Modul. |
| `read_only` | `"🔒"` | The symbol indicating current directory is read only. |
| `read_only_style` | `"red"` | The style for the read only symbol. |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | The symbol indicating home directory. |
| Option | Standardwert | Beschreibung |
| ------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `truncation_length` | `3` | Die Anzahl der übergeordneten Ordner, die angezeigt werden. |
| `truncate_to_repo` | `true` | Whether or not to truncate to the root of the git repo that you're currently in. |
| `format` | `"[$path]($style)[$read_only]($read_only_style) "` | Das Format für das Modul. |
| `style` | `"bold cyan"` | Stil für dieses Modul. |
| `disabled` | `false` | Deaktiviert das `directory`-Modul. |
| `read_only` | `"🔒"` | The symbol indicating current directory is read only. |
| `read_only_style` | `"red"` | The style for the read only symbol. |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | The symbol indicating home directory. |
| `use_os_path_sep` | `true` | Use the OS specific path seperator instead of always using `/` (e.g. `\` on Windows) |
<details>
<summary>Dieses Modul hat einige erweiterte Konfigurationsoptionen, welche die Darstellung von Verzeichnissen steuern.</summary>
<summary>This module has a few advanced configuration options that control how the directory is displayed.</summary>
| Advanced Option | Standardwert | Beschreibung |
| --------------------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@ -1174,7 +1187,7 @@ asia-northeast1 = "an1"
## Git-Branch
Das `git_branch`-Modul zeigt den aktiven Git-Branch des Repositories im aktuellen Verzeichnis an.
The `git_branch` module shows the active branch of the repo in your current directory.
### Optionen
@ -1293,7 +1306,7 @@ The `git_metrics` module will show the number of added and deleted lines in the
::: tip
Dieses Modul ist standardmäßig deaktiviert. Setze in deiner Konfiguration `disabled` auf `false` um es zu aktivieren.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -1334,22 +1347,23 @@ The `git_status` module shows symbols representing the state of the repo in your
### Optionen
| Option | Standardwert | Beschreibung |
| ------------ | ----------------------------------------------- | ----------------------------------- |
| `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` |
| `style` | `"bold red"` | Stil für dieses Modul. |
| `disabled` | `false` | Deaktiviert das `git_status`-Modul. |
| Option | Standardwert | Beschreibung |
| ------------------- | ----------------------------------------------- | ----------------------------------- |
| `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` |
| `style` | `"bold red"` | Stil für dieses Modul. |
| `ignore_submodules` | `false` | Ignore changes to submodules. |
| `disabled` | `false` | Disables the `git_status` module. |
### Variables
@ -1499,7 +1513,7 @@ format = "via [⎈ $version](bold white) "
## Hostname
Das `hostname`-Modul zeigt den Hostnamen des Systems an.
The `hostname` module shows the system hostname.
### Optionen
@ -1513,10 +1527,10 @@ Das `hostname`-Modul zeigt den Hostnamen des Systems an.
### Variables
| Variable | Beispiel | Beschreibung |
| --------- | -------- | ------------------------------------- |
| symbol | | Spiegelt den Wert der Option `symbol` |
| style\* | | Spiegelt den Wert der Option `style` |
| Variable | Beispiel | Beschreibung |
| --------- | ---------- | ------------------------------------ |
| hostname | `computer` | The hostname of the computer |
| style\* | | Spiegelt den Wert der Option `style` |
\*: This variable can only be used as a part of a style string
@ -1722,7 +1736,7 @@ Displays the current [Kubernetes context](https://kubernetes.io/docs/concepts/co
::: tip
Dieses Modul ist standardmäßig deaktiviert. Setze in deiner Konfiguration `disabled` auf `false` um es zu aktivieren.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -1784,7 +1798,7 @@ Long and automatically generated cluster names can be identified and shortened u
## Zeilenumbruch
Das `line_break`-Modul unterteilt den Prompt in zwei Zeilen.
The `line_break` module separates the prompt into two lines.
### Optionen
@ -1844,13 +1858,13 @@ format = "via [🌕 $version](bold blue) "
## Speicherauslastung
Das `memory_usage` Modul zeigt den aktuellen Systemspeicher und die swap-Nutzung an.
The `memory_usage` module shows current system memory and swap usage.
Standardmäßig wird die swap-Nutzung angezeigt, wenn der gesamte System-swap nicht Null ist.
By default the swap usage is displayed if the total system swap is non-zero.
::: tip
Dieses Modul ist standardmäßig deaktiviert. Setze in deiner Konfiguration `disabled` auf `false` um es zu aktivieren.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -1969,7 +1983,7 @@ symbol = "🎣 "
## Nix-Shell
The `nix_shell` module shows the [nix-shell](https://nixos.org/guides/nix-pills/developing-with-nix-shell.html) environment. Das Modul wird angezeigt, wenn es sich in einer nix-Shell-Umgebung befindet.
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.
### Optionen
@ -2133,7 +2147,7 @@ symbol = "☁️ "
## Paketversion
Das `Package` Modul wird angezeigt, wenn das aktuelle Verzeichnis das Repository für ein Paket ist, und zeigt dessen aktuelle Version an. The module currently supports `npm`, `nimble`, `cargo`, `poetry`, `composer`, `gradle`, `julia`, `mix`, `helm` and `shards` packages.
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`, `composer`, `gradle`, `julia`, `mix`, `helm`, `shards` 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
@ -2150,6 +2164,7 @@ Das `Package` Modul wird angezeigt, wenn das aktuelle Verzeichnis das Repository
- [**Shards**](https://crystal-lang.org/reference/the_shards_command/index.html) - The `shards` package version is extracted from the `shard.yml` present
- [**V**](https://vlang.io) - The `vlang` package version is extracted from the `v.mod` present
- [**SBT**](https://scala-sbt.org) - The `sbt` package version is extracted from the `build.sbt` present in the current directory
- [**Dart**](https://pub.dev/) - The `dart` package version is extracted from the `pubspec.yaml` present in the current directory
> ⚠️ Die angezeigte Version ist die des Pakets, dessen Quellcode im Verzeichnis liegt, nicht die des Paketmanagers.
@ -2657,7 +2672,7 @@ The `shell` module shows an indicator for currently used shell.
::: tip
Dieses Modul ist standardmäßig deaktiviert. Setze in deiner Konfiguration `disabled` auf `false` um es zu aktivieren.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -2673,6 +2688,8 @@ Dieses Modul ist standardmäßig deaktiviert. Setze in deiner Konfiguration `dis
| `elvish_indicator` | `esh` | A format string used to represent elvish. |
| `tcsh_indicator` | `tsh` | A format string used to represent tcsh. |
| `xonsh_indicator` | `xsh` | A format string used to represent xonsh. |
| `cmd_indicator` | `cmd` | A format string used to represent cmd. |
| `nu_indicator` | `nu` | A format string used to represent nu. |
| `unknown_indicator` | | The default value to be displayed when the shell is unknown. |
| `format` | `"[$indicator]($style) "` | Das Format für das Modul. |
| `style` | `"white bold"` | Stil für dieses Modul. |
@ -2774,11 +2791,11 @@ The `status` module displays the exit code of the previous command. The module w
::: tip
Dieses Modul ist standardmäßig deaktiviert. Setze in deiner Konfiguration `disabled` auf `false` um es zu aktivieren.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
::: warning This module is not supported on elvish and nu shell. :::
::: warning This module is not supported on nu shell. :::
### Optionen
@ -2804,6 +2821,7 @@ Dieses Modul ist standardmäßig deaktiviert. Setze in deiner Konfiguration `dis
| Variable | Beispiel | Beschreibung |
| -------------- | -------- | ------------------------------------------------------------------------------------------- |
| status | `127` | The exit code of the last command |
| hex_status | `0x7F` | The exit code of the last command in hex |
| int | `127` | The exit code of the last command |
| common_meaning | `ERROR` | Meaning of the code if not a signal |
| signal_number | `9` | Signal number corresponding to the exit code, only if signalled |
@ -2836,7 +2854,7 @@ The `sudo` module displays if sudo credentials are currently cached. The module
::: tip
Dieses Modul ist standardmäßig deaktiviert. Setze in deiner Konfiguration `disabled` auf `false` um es zu aktivieren.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -2980,11 +2998,11 @@ format = "[🏎💨 $workspace]($style) "
## Zeit
Das `time` Modul zeigt die aktuelle **lokale** Zeit an. Der `format` Wert wird von der crate [`chrono`](https://crates.io/crates/chrono) benutzt um die Zeit zu formatieren. Schau dir [die chrono strftime Dokumentation](https://docs.rs/chrono/0.4.7/chrono/format/strftime/index.html) an, um die möglichen Optionen zu sehen.
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.
::: tip
Dieses Modul ist standardmäßig deaktiviert. Setze in deiner Konfiguration `disabled` auf `false` um es zu aktivieren.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -3000,7 +3018,7 @@ Dieses Modul ist standardmäßig deaktiviert. Setze in deiner Konfiguration `dis
| `disabled` | `true` | Deaktiviert das `time`-Modul. |
| `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"`. Ansonsten ist der Standardwert hierfür `"%T"`. Manually setting `time_format` will override the `use_12hr` setting.
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.
### Variables
@ -3026,7 +3044,7 @@ time_range = "10:00:00-14:00:00"
## Benutzername
Das Modul `username` zeigt den Benutzernamen des aktiven Benutzers. Das Modul wird nur dann angezeigt, wenn eine der folgenden Bedingungen zutrifft:
The `username` module shows active user's username. Das Modul wird nur dann angezeigt, wenn eine der folgenden Bedingungen zutrifft:
- Der aktuelle Benutzer ist root
- Der aktuelle Benutzer ist nicht derjenige, der derzeit angemeldet ist

View File

@ -69,13 +69,13 @@ If you see symbols that you don't recognise you can use `starship explain` to ex
You can enable the debug logs by using the `STARSHIP_LOG` env var. These logs can be very verbose so it is often useful to use the `module` command if you are trying to debug a particular module, for example, if you are trying to debug the `rust` module you could run the following command to get the trace logs and output from the module.
```sh
env STARHIP_LOG=trace starship module rust
env STARSHIP_LOG=trace starship module rust
```
If starship is being slow you can try using the `timings` command to see if there is a particular module or command that to blame.
```sh
env STARHIP_LOG=trace starship timings
env STARSHIP_LOG=trace starship timings
```
This will output the trace log and a breakdown of all modules that either took more than 1ms to execute or produced some output.
@ -117,6 +117,6 @@ If Starship was installed using a package manager, please refer to their docs fo
Wenn Starship mit Hilfe des Installationsscripts installiert wurde, entfernt der folgende Befehl Starship:
```sh
# Starship binary suchen und löschen
sh -c 'rm "$(which starship)"'
# Locate and delete the starship binary
sh -c 'rm "$(command -v 'starship')"'
```

View File

@ -72,6 +72,22 @@
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-fr.png"
alt="Français"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/id-ID/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-id.png"
alt="Bahasa Indonesia"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/it-IT/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-it.png"
alt="Italiano"
/></a>
&nbsp;
<a
@ -87,7 +103,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-br.png"
alt="Portugiesisch (Brasilien)"
alt="Português do Brasil"
/></a>
&nbsp;
<a
@ -95,7 +111,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-ru.png"
alt="Russisch"
alt="Русский"
/></a>
&nbsp;
<a
@ -103,7 +119,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-vn.png"
alt="Vietnamesisch"
alt="Tiếng Việt"
/></a>
&nbsp;
<a
@ -252,7 +268,7 @@
#### Elvish
**Warnung** Nur elvish v0.15 oder höher wird unterstützt. Trage folgendes am Ende von `~/.config/fish/rc.elv` ein:
**Warning** Only elvish v0.17 or higher is supported. Trage folgendes am Ende von `~/.config/fish/rc.elv` ein:
```sh
# ~/.elvish/rc.elv
@ -283,9 +299,20 @@
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```
#### Nushell
**Warnung** Dies wird sich in Zukunft ändern. Es wird nur nu Version v0.33 oder höher unterstützt. Füge folgendes zu deiner nu Konfigurationsdatei hinzu. Du kannst den Speicherort dieser Datei überprüfen, indem du `config path` in nu ausführst.
**Warning** This will change in the future. Es wird nur nu Version v0.33 oder höher unterstützt. Add the following to your nu config file. Du kannst den Speicherort dieser Datei überprüfen, indem du `config path` in nu ausführst.
```toml
startup = [

View File

@ -224,7 +224,7 @@ format = '\[[$symbol($version)]($style)\]'
format = '\[[$symbol($version)]($style)\]'
[sudo]
format = '\[[as $symbol]\]
format = '\[[as $symbol]\]'
[swift]
format = '\[[$symbol($version)]($style)\]'

View File

@ -18,7 +18,7 @@ features:
footer: Bajo una licencia ISC | Derechos de autor © 2019-presente Colaboradores de Starship
#Used for the description meta tag, for SEO
metaTitle: "Starship: el prompt multi-intérprete"
description: '¡Starship es el prompt minimalista, ultrarápido e infinitamente personalizable para cualquier intérprete de comandos! Muestra la información que necesitas, a la par que es elegante y minimalista. Instalación rápida disponible para Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, y PowerShell.'
description: '¡Starship es el prompt minimalista, ultrarápido e infinitamente personalizable para cualquier intérprete de comandos! Muestra la información que necesitas, a la par que es elegante y minimalista. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and PowerShell.'
---
<div class="center">
@ -119,7 +119,7 @@ description: '¡Starship es el prompt minimalista, ultrarápido e infinitamente
#### Elvish
::: advertencia Solo se admite Elvish v0.15 o superior. :::
::: warning Only elvish v0.17 or higher is supported. :::
Añade el siguiente código al final de `~/.elvish/rc.elv`:
@ -164,3 +164,14 @@ description: '¡Starship es el prompt minimalista, ultrarápido e infinitamente
execx($(starship init xonsh))
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```

View File

@ -8,11 +8,35 @@ Las configuraciones de esta sección están sujetos a cambios en futuras version
:::
## Comandos pre-prompt y pre-ejecucución personalizados en Bash
## Custom pre-prompt and pre-execution Commands in Cmd
Bash no posee un framework oficial de preexec/precmd como la mayoría de los demás intérpretes de comandos. Debido a esto, es difícil proporcionar "hooks" totalmente personalizables en `Bash`. Sin embargo, Starship te da la posibilidad de insertar de forma limitada tus propias funciones en el proceso de renderizado del prompt:
Clink provides extremely flexible APIs to run pre-prompt and pre-exec commands in Cmd shell. It is fairly simple to use with Starship. Make the following changes to your `starship.lua` file as per your requirements:
- Para ejecutar una función personalizada previa al renderizado del prompt, define una nueva función y asigna su nombre a `starship_precmd_user_func`. Por ejemplo, para dibujar un cohete antes del prompt, se puede realizar así:
- To run a custom function right before the prompt is drawn, define a new function called `starship_preprompt_user_func`. This function receives the current prompt as a string that you can utilize. For example, to draw a rocket before the prompt, you would do
```lua
function starship_preprompt_user_func(prompt)
print("🚀")
end
load(io.popen('starship init cmd'):read("*a"))()
```
- To run a custom function right before a command is executed, define a new function called `starship_precmd_user_func`. This function receives the current commandline as a string that you can utilize. For example, to print the command that's about to be executed, you would do
```lua
function starship_precmd_user_func(line)
print("Executing: "..line)
end
load(io.popen('starship init cmd'):read("*a"))()
```
## Custom pre-prompt and pre-execution Commands in Bash
Bash does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `bash`. Sin embargo, Starship te da la posibilidad de insertar de forma limitada tus propias funciones en el proceso de renderizado del prompt:
- To run a custom function right before the prompt is drawn, define a new function and then assign its name to `starship_precmd_user_func`. For example, to draw a rocket before the prompt, you would do
```bash
function blastoff(){
@ -21,21 +45,21 @@ function blastoff(){
starship_precmd_user_func="blastoff"
```
- Para ejecutar una función personalizada antes de que un comando sea ejecutado, es posible usar el [mecanismo de trampa `DEBUG`](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). No obstante, ¡**debes** atrapar la señal DEBUG *antes* de inicializar Starship! Starship puede preservar el valor de la trampa DEBUG, pero si la trampa es reemplazada después de que Starship inicie, alguna funcionalidad fallará.
- To run a custom function right before a command runs, you can use the [`DEBUG` trap mechanism](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). However, you **must** trap the DEBUG signal *before* initializing Starship! Starship can preserve the value of the DEBUG trap, but if the trap is overwritten after starship starts up, some functionality will break.
```bash
function blastoff(){
echo "🚀"
}
trap blastoff DEBUG # Trampa DEBUG *antes* de la ejecución de Starship
trap blastoff DEBUG # Trap DEBUG *before* running starship
eval $(starship init bash)
```
## Comandos pre-prompt y pre-ejecución personalizados en PowerShell
## Custom pre-prompt and pre-execution Commands in PowerShell
Powershell no posee un framework oficial de preexec/precmd como la mayoría de los demás intérpretes de comandos. Debido a esto, es difícil proporcionar "hooks" totalmente personalizables en `Powershell`. Sin embargo, Starship te da la posibilidad de insertar de forma limitada tus propias funciones en el proceso de renderizado del prompt:
PowerShell does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `powershell`. Sin embargo, Starship te da la posibilidad de insertar de forma limitada tus propias funciones en el proceso de renderizado del prompt:
Crea una función llamada `Invoke-Starship-PreCommand`
Create a function named `Invoke-Starship-PreCommand`
```powershell
function Invoke-Starship-PreCommand {
@ -43,35 +67,35 @@ function Invoke-Starship-PreCommand {
}
```
## Cambiar el Título de la Ventana
## Cambiar título de la ventana
Algunos intérpretes de comandos van a cambiar automáticamente el título de la ventana por ti (p. ej., para mostrar tu directorio actual). Fish incluso lo hace por defecto. Starship no hace esto, pero es bastante sencillo añadir esta funcionalidad a `Bash` o `zsh`.
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash`, `zsh`, `cmd` or `powershell`.
Primero, define una función para el cambio de título de la ventana (idéntico en Bash y zsh):
First, define a window title change function (identical in bash and zsh):
```bash
function set_win_title(){
echo -ne "\033]0; TU_TITULO_DE_VENTANA_AQUI \007"
echo -ne "\033]0; YOUR_WINDOW_TITLE_HERE \007"
}
```
Puedes usar variables para personalizar este título (`$USER`, `$HOSTNAME` y `$PWD` son opciones populares).
You can use variables to customize this title (`$USER`, `$HOSTNAME`, and `$PWD` are popular choices).
En `Bash`, establece que esta función sea la función precmd de Starship:
In `bash`, set this function to be the precmd starship function:
```bash
starship_precmd_user_func="set_win_title"
```
En `zsh`, añade esto al array `precmd_functions`:
In `zsh`, add this to the `precmd_functions` array:
```bash
precmd_functions+=(set_win_title)
```
Si te gusta el resultado, añade estas líneas a tu archivo de configuración del intérprete de comandos (`~/.bashrc` o `~/.zsrhc`) para hacerlo permanente.
If you like the result, add these lines to your shell configuration file (`~/.bashrc` or `~/.zshrc`) to make it permanent.
Por ejemplo, si quieres mostrar tu directorio actual en el título de la pestaña de la terminal, añade el siguiente fragmento a tu `~/.bashrc` o `~/.zshrc`:
For example, if you want to display your current directory in your terminal tab title, add the following snippet to your `~/.bashrc` or `~/.zshrc`:
```bash
function set_win_title(){
@ -80,7 +104,17 @@ function set_win_title(){
starship_precmd_user_func="set_win_title"
```
También puede establecer una salida similar con PowerShell creando una función llamada `Invoke-Starship-PreCommand`.
For Cmd, you can change the window title using the `starship_preprompt_user_func` function.
```lua
function starship_preprompt_user_func(prompt)
console.settitle(os.getenv('USERNAME').."@"..os.getenv('COMPUTERNAME')..": "..os.getcwd())
end
load(io.popen('starship init cmd'):read("*a"))()
```
You can also set a similar output with PowerShell by creating a function named `Invoke-Starship-PreCommand`.
```powershell
# edit $PROFILE
@ -91,55 +125,77 @@ function Invoke-Starship-PreCommand {
Invoke-Expression (&starship init powershell)
```
## Habilitar Prompt a la Derecha
## Enable Right Prompt
Algunos intérpretes de comandos soportan un prompt derecho que se renderiza en la misma línea que la entrada. Starship puede establecer el contenido del prompt derecho usando la opción `right_format`. Cualquier módulo que pueda ser usado en `format` también es soportado en `right_format`. La variable `$all` solo contendrá módulos no utilizados explícitamente en `format` o `right_format`.
Some shells support a right prompt which renders on the same line as the input. Starship can set the content of the right prompt using the `right_format` option. Any module that can be used in `format` is also supported in `right_format`. The `$all` variable will only contain modules not explicitly used in either `format` or `right_format`.
Nota: El prompt derecho es una sola línea siguiendo la ubicación de entrada. Para alinear módulos arriba de la línea de entrada en un prompt multi-línea, vea el [módulo fill](/config/#fill).
Note: The right prompt is a single line following the input location. To right align modules above the input line in a multi-line prompt, see the [fill module](/config/#fill).
`right_format` está actualmente soportado para los siguientes intérpretes de comandos: elvish, fish, zsh.
`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd.
### Ejemplo
```toml
# ~/.config/starship. oml
# ~/.config/starship.toml
# Un prompt izquierdo mínimo
# A minimal left prompt
format = """$character"""
# mueve el resto del mensaje a la derecha
# move the rest of the prompt to the right
right_format = """$all"""
```
Produce un prompt como el siguiente:
Produces a prompt like the following:
```
▶ starship on  rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s
```
## Continuation Prompt
Some shells support a continuation prompt along with the normal prompt. This prompt is rendered instead of the normal prompt when the user has entered an incomplete statement (such as a single left parenthesis or quote).
Starship can set the continuation prompt using the `continuation_prompt` option. The default prompt is `"[∙](bright-black) "`.
Note: `continuation_prompt` should be set to a literal string without any variables.
Note: Continuation prompts are only available in the following shells:
- `bash`
- `zsh`
- `PowerShell`
### Ejemplo
```toml
# ~/.config/starship.toml
# A continuation prompt that displays two filled in arrows
continuation_prompt = "▶▶"
```
## Cadenas de estilo
Las cadenas de estilo son una lista de palabras, separadas por espacios en blanco. Las palabras no son sensibles a mayúsculas (es decir, `bold` y `BoLd` se consideran la misma cadena). Cada palabra puede ser una de las siguientes:
Style strings are a list of words, separated by whitespace. The words are not case sensitive (i.e. `bold` and `BoLd` are considered the same string). Each word can be one of the following:
- `bold`
- `italic`
- `underline`
- `dimmed`
- `inverted`
- `negrita`
- `cursiva`
- `subrayado`
- `atenuado`
- `invertido`
- `bg:<color>`
- `fg:<color>`
- `<color>`
- `none`
- `ninguno`
donde `<color>` es un especificador de color (discutido a continuación). `fg:<color>` y `<color>` hacen actualmente lo mismo, aunque esto puede cambiar en el futuro. `inverted` cambia el fondo y los colores de primer plano. El orden de las palabras en la cadena no importa.
where `<color>` is a color specifier (discussed below). `fg:<color>` and `<color>` currently do the same thing, though this may change in the future. `inverted` swaps the background and foreground colors. The order of words in the string does not matter.
El token `none` anula todos los demás tokens en una cadena si no es parte de un especificador `bg:`, de modo que por ejemplo `fg:red none fg:blue` creará una cadena sin ningún estilo. `bg:none` establece el fondo al color por defecto, así que `fg:red bg:none` es equivalente a `red` o `fg:red` y `bg:green fg:red bg:none` también es equivalente a `fg:red` o `red`. Puede convertirse en un error usar `none` junto con otros tokens en el futuro.
The `none` token overrides all other tokens in a string if it is not part of a `bg:` specifier, so that e.g. `fg:red none fg:blue` will still create a string with no styling. `bg:none` sets the background to the default color so `fg:red bg:none` is equivalent to `red` or `fg:red` and `bg:green fg:red bg:none` is also equivalent to `fg:red` or `red`. It may become an error to use `none` in conjunction with other tokens in the future.
Un especificador de color puede ser uno de los siguientes:
A color specifier can be one of the following:
- Uno de los colores estándar del terminal: `black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`. Opcionalmente puedes agregar el prefijo `bright-` para obtener la versión brillante (por ejemplo, `bright-white`).
- Un `#` seguido de un número hexadecimal de seis dígitos. Esto especifica un [código hexadecimal de color RGB](https://www.w3schools.com/colors/colors_hexadecimal.asp).
- Un número entre 0-255. Esto especifica un [Código de color ANSI de 8-bits](https://i.stack.imgur.com/KTSQa.png).
- One of the standard terminal colors: `black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`. You can optionally prefix these with `bright-` to get the bright version (e.g. `bright-white`).
- A `#` followed by a six-digit hexadecimal number. This specifies an [RGB color hex code](https://www.w3schools.com/colors/colors_hexadecimal.asp).
- A number between 0-255. This specifies an [8-bit ANSI Color Code](https://i.stack.imgur.com/KTSQa.png).
Si se especifican varios colores para el primer plano/fondo, el último en la cadena tendrá prioridad.
If multiple colors are specified for foreground/background, the last one in the string will take priority.

File diff suppressed because it is too large Load Diff

View File

@ -69,13 +69,13 @@ Si ves símbolos que no reconoces, puedes usar `starship explain` para explicar
You can enable the debug logs by using the `STARSHIP_LOG` env var. These logs can be very verbose so it is often useful to use the `module` command if you are trying to debug a particular module, for example, if you are trying to debug the `rust` module you could run the following command to get the trace logs and output from the module.
```sh
env STARHIP_LOG=trace starship module rust
env STARSHIP_LOG=trace starship module rust
```
If starship is being slow you can try using the `timings` command to see if there is a particular module or command that to blame.
```sh
env STARHIP_LOG=trace starship timings
env STARSHIP_LOG=trace starship timings
```
This will output the trace log and a breakdown of all modules that either took more than 1ms to execute or produced some output.
@ -117,6 +117,6 @@ Si Starship fue instalado usando un gestor de paquetes, por favor refiérete a s
Si Starship fue instalado usando el guión de instalación, el siguiente comando eliminará el binario:
```sh
# Localiza y elimina el binario de starship
sh -c 'rm "$(which starship)"'
# Locate and delete the starship binary
sh -c 'rm "$(command -v 'starship')"'
```

View File

@ -72,6 +72,22 @@
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-fr.png"
alt="Français"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/id-ID/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-id.png"
alt="Bahasa indonesio"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/it-IT/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-it.png"
alt="Italiano"
/></a>
&nbsp;
<a
@ -79,7 +95,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-jp.png"
alt="日本語"
alt="Japonés"
/></a>
&nbsp;
<a
@ -87,7 +103,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-br.png"
alt="Português do Brasil"
alt="Português (Brasil)"
/></a>
&nbsp;
<a
@ -95,7 +111,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-ru.png"
alt="Русский"
alt="Ruso"
/></a>
&nbsp;
<a
@ -103,7 +119,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-vn.png"
alt="Tiếng Việt"
alt="Vietnamita"
/></a>
&nbsp;
<a
@ -111,7 +127,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-cn.png"
alt="简体中文"
alt="Chino Mandarín"
/></a>
&nbsp;
<a
@ -119,7 +135,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-tw.png"
alt="繁體中文"
alt="Chino Tradicional"
/></a>
</p>
@ -252,7 +268,7 @@
#### Elvish
**Advertencia** Sólo se admite Elvish v0.15 o superior. Añade el siguiente código al final de `~/.elvish/rc.elv`:
**Warning** Only elvish v0.17 or higher is supported. Añade el siguiente código al final de `~/.elvish/rc.elv`:
```sh
# ~/.elvish/rc.elv
@ -283,9 +299,20 @@
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```
#### Nushell
**Advertencia** Esto cambiará en el futuro. Sólo se admite la versión nu v0.33 o superior. Añade lo siguiente a tu archivo de configuración nu. Puedes comprobar la ubicación de este archivo ejecutando `ruta de configuración` en nu.
**Warning** This will change in the future. Sólo se admite la versión nu v0.33 o superior. Add the following to your nu config file. Puedes comprobar la ubicación de este archivo ejecutando `ruta de configuración` en nu.
```toml
startup = [

View File

@ -224,7 +224,7 @@ format = '\[[$symbol($version)]($style)\]'
format = '\[[$symbol($version)]($style)\]'
[sudo]
format = '\[[as $symbol]\]
format = '\[[as $symbol]\]'
[swift]
format = '\[[$symbol($version)]($style)\]'

View File

@ -18,7 +18,7 @@ features:
footer: Licence ISC | Copyright © 2019-présent Contributeurs Starship
#Used for the description meta tag, for SEO
metaTitle: "Starship : Invite Multi-Shell"
description: Starship est une invite minimaliste, ultra-rapide et hautement personnalisable pour n'importe quel shell ! Montre les informations dont vous avez besoin tout en restant élégante et minimaliste. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, and PowerShell.
description: Starship est une invite minimaliste, ultra-rapide et hautement personnalisable pour n'importe quel shell ! Montre les informations dont vous avez besoin tout en restant élégante et minimaliste. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and PowerShell.
---
<div class="center">
@ -119,7 +119,7 @@ description: Starship est une invite minimaliste, ultra-rapide et hautement pers
#### Elvish
::: warning Seul elvish v0.15 ou supérieur est pris en charge. :::
::: warning Seul elvish v0.17 ou supérieur est pris en charge. :::
Ajoutez ce qui suit à la fin de `~/.elvish/rc.elv`:
@ -143,7 +143,7 @@ description: Starship est une invite minimaliste, ultra-rapide et hautement pers
#### Nushell
::: warning This will change in the future. Seule la version nu v0.33 ou supérieure est prise en charge. ::: Add the following to your nu config file. Vous pouvez vérifier l'emplacement de ce fichier en exécutant `config path` dans 'nu'.
::: warning Cela va changer dans le futur. Seule la version nu v0.33 ou supérieure est prise en charge. Ajoutez ce qui suit à votre fichier de configuration nu. Vous pouvez vérifier l'emplacement de ce fichier en exécutant `config path` dans 'nu'.
```toml
startup = [
@ -164,3 +164,14 @@ description: Starship est une invite minimaliste, ultra-rapide et hautement pers
execx($(starship init xonsh))
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```

View File

@ -8,11 +8,35 @@ Les configurations dans cette section sont sujettes à modification dans les fut
:::
## Commandes pré-commande et pré-exécution personnalisées en Bash
## Custom pre-prompt and pre-execution Commands in Cmd
Bash n'a pas de structure officielle préexec/précmd comme la plupart des autres shells. C'est pourquoi il est difficile de fournir des hooks entièrement personnalisables dans `bash`. Cependant, Starship vous permet dans une certaine mesure d'insérer vos propres fonctions dans la procédure de rendu du prompt :
Clink provides extremely flexible APIs to run pre-prompt and pre-exec commands in Cmd shell. It is fairly simple to use with Starship. Make the following changes to your `starship.lua` file as per your requirements:
- Pour exécuter une fonction personnalisée juste avant que le prompt ne soit dessiné, définissez une nouvelle fonction et assignez son nom à `starship_precmd_user_func`. Par exemple, pour dessiner une fusée avant la commande, vous feriez
- To run a custom function right before the prompt is drawn, define a new function called `starship_preprompt_user_func`. This function receives the current prompt as a string that you can utilize. For example, to draw a rocket before the prompt, you would do
```lua
function starship_preprompt_user_func(prompt)
print("🚀")
end
load(io.popen('starship init cmd'):read("*a"))()
```
- To run a custom function right before a command is executed, define a new function called `starship_precmd_user_func`. This function receives the current commandline as a string that you can utilize. For example, to print the command that's about to be executed, you would do
```lua
function starship_precmd_user_func(line)
print("Executing: "..line)
end
load(io.popen('starship init cmd'):read("*a"))()
```
## Custom pre-prompt and pre-execution Commands in Bash
Bash does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `bash`. Cependant, Starship vous permet dans une certaine mesure d'insérer vos propres fonctions dans la procédure de rendu du prompt :
- To run a custom function right before the prompt is drawn, define a new function and then assign its name to `starship_precmd_user_func`. For example, to draw a rocket before the prompt, you would do
```bash
function blastoff(){
@ -21,13 +45,13 @@ function blastoff(){
starship_precmd_user_func="blastoff"
```
- Pour exécuter une fonction personnalisée juste avant l'exécution d'une commande, vous pouvez utiliser le [ mécanisme d'interruption du signal ` DEBUG`](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). Cependant, vous **devez** piéger le signal DEBUG *avant* l'initialisation de Starship ! Starship peut préserver la valeur du piège DEBUG, mais si le piège est écrasé après le démarrage de Starship, certaines fonctionnalités vont casser.
- To run a custom function right before a command runs, you can use the [`DEBUG` trap mechanism](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). However, you **must** trap the DEBUG signal *before* initializing Starship! Starship can preserve the value of the DEBUG trap, but if the trap is overwritten after starship starts up, some functionality will break.
```bash
function blastoff(){
echo "🚀"
}
trap blastoff DEBUG # Pièger DEBUG *avant* l'initialisation de starship
trap blastoff DEBUG # Trap DEBUG *before* running starship
eval $(starship init bash)
```
@ -43,35 +67,35 @@ function Invoke-Starship-PreCommand {
}
```
## Modifier le titre des fenêtres
## Change Window Title
Certaines commandes du shell changeront automatiquement le titre de la fenêtre (par exemple, pour refléter votre répertoire de travail). Fish le fait même par défaut. Starship ne le fait pas, mais il est assez simple d'ajouter cette fonctionnalité à `bash` ou `zsh`.
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash`, `zsh`, `cmd` or `powershell`.
Tout d'abord, définissez une fonction de changement de titre de fenêtre (identique en bash et zsh) :
First, define a window title change function (identical in bash and zsh):
```bash
function set_titre_fenetre(){
echo -ne "\033]0; VOTRE_TITRE_ICI\007"
function set_win_title(){
echo -ne "\033]0; YOUR_WINDOW_TITLE_HERE \007"
}
```
Vous pouvez utiliser des variables pour personnaliser ce titre (`$USER`, `$HOSTNAME`, et `$PWD` sont des choix populaires).
You can use variables to customize this title (`$USER`, `$HOSTNAME`, and `$PWD` are popular choices).
Dans `bash`, définissez cette fonction comme la fonction précommande Starship :
In `bash`, set this function to be the precmd starship function:
```bash
starship_precmd_user_func="set_titre_fenetre"
starship_precmd_user_func="set_win_title"
```
Dans `zsh`, ajoutez ceci au tableau `precmd_functions` :
In `zsh`, add this to the `precmd_functions` array:
```bash
precmd_functions+=(set_titre_fenetre)
precmd_functions+=(set_win_title)
```
Si vous aimez le résultat, ajoutez ces lignes à votre fichier de configuration shell (`~/.bashrc` ou `~/.zshrc`) pour le rendre permanent.
If you like the result, add these lines to your shell configuration file (`~/.bashrc` or `~/.zshrc`) to make it permanent.
Par exemple, si vous voulez afficher votre répertoire actuel dans le titre de l'onglet de votre terminal, ajoutez le code suivant à votre `~/.bashrc` ou `~/.zshrc`:
For example, if you want to display your current directory in your terminal tab title, add the following snippet to your `~/.bashrc` or `~/.zshrc`:
```bash
function set_win_title(){
@ -80,6 +104,16 @@ function set_win_title(){
starship_precmd_user_func="set_win_title"
```
For Cmd, you can change the window title using the `starship_preprompt_user_func` function.
```lua
function starship_preprompt_user_func(prompt)
console.settitle(os.getenv('USERNAME').."@"..os.getenv('COMPUTERNAME')..": "..os.getcwd())
end
load(io.popen('starship init cmd'):read("*a"))()
```
You can also set a similar output with PowerShell by creating a function named `Invoke-Starship-PreCommand`.
```powershell
@ -97,7 +131,7 @@ Some shells support a right prompt which renders on the same line as the input.
Note: The right prompt is a single line following the input location. To right align modules above the input line in a multi-line prompt, see the [fill module](/config/#fill).
`right_format` is currently supported for the following shells: elvish, fish, zsh.
`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd.
### Exemple
@ -117,29 +151,51 @@ Produces a prompt like the following:
▶ starship on  rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s
```
## Continuation Prompt
Some shells support a continuation prompt along with the normal prompt. This prompt is rendered instead of the normal prompt when the user has entered an incomplete statement (such as a single left parenthesis or quote).
Starship can set the continuation prompt using the `continuation_prompt` option. The default prompt is `"[∙](bright-black) "`.
Note: `continuation_prompt` should be set to a literal string without any variables.
Note: Continuation prompts are only available in the following shells:
- `bash`
- `zsh`
- `PowerShell`
### Exemple
```toml
# ~/.config/starship.toml
# A continuation prompt that displays two filled in arrows
continuation_prompt = "▶▶"
```
## Chaînes de style
Les chaînes de style sont une liste de mots, séparés par des espaces blancs. Les mots ne sont pas sensibles à la casse (` bold ` et ` boLd ` sont considérés comme la même string). Chaque mot peut être l'un des suivants :
Style strings are a list of words, separated by whitespace. The words are not case sensitive (i.e. `bold` and `BoLd` are considered the same string). Each word can be one of the following:
- `bold`
- `italic`
- `underline`
- `dimmed`
- `inverted`
- `bg:<couleur>`
- `fg:<couleur>`
- `<couleur>`
- `bg:<color>`
- `fg:<color>`
- `<color>`
- `none`
`<color>` est un spécificateur de couleur (discuté ci-dessous). `fg:<color>` et `<color>` font actuellement la même chose, bien que cela puisse changer dans le futur. `inverted` permute les couleurs de fond et de premier plan. L'ordre des mots dans le string n'a pas d'importance.
where `<color>` is a color specifier (discussed below). `fg:<color>` and `<color>` currently do the same thing, though this may change in the future. `inverted` swaps the background and foreground colors. The order of words in the string does not matter.
La valeur `none` remplace toutes les autres valeurs si elle n'est pas incluse dans un spécificateur `bg:`, de sorte que par exemple `fg: red none fg:blue` créera une chaîne sans style. `bg:none` définit l'arrière plan sur la couleur par défaut, donc `fg:red bg:none` est équivalent à `red` ou `fg:red` et `bg:green fg:red bg:none` est aussi équivalent à `fg:red` ou `red`. Il peut devenir une erreur d'utiliser `none` en conjonction avec d'autres jetons dans le futur.
The `none` token overrides all other tokens in a string if it is not part of a `bg:` specifier, so that e.g. `fg:red none fg:blue` will still create a string with no styling. `bg:none` sets the background to the default color so `fg:red bg:none` is equivalent to `red` or `fg:red` and `bg:green fg:red bg:none` is also equivalent to `fg:red` or `red`. It may become an error to use `none` in conjunction with other tokens in the future.
Un spécificateur de couleur peut être l'un des éléments suivants :
A color specifier can be one of the following:
- Une des couleurs standard du terminal : `black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`. Vous pouvez éventuellement les préfixer avec `bright-` pour obtenir la version lumineuse (par exemple `bright-white`).
- Un `#` suivi d'un nombre hexadécimal de six chiffres. Ceci spécifie un [ Code hexadécimal de couleur RVB ](https://www.w3schools.com/colors/colors_hexadecimal.asp).
- Un nombre entre 0 et 255. Ceci spécifie un [code de couleur ANSI 8 bits](https://i.stack.imgur.com/KTSQa.png).
- One of the standard terminal colors: `black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`. You can optionally prefix these with `bright-` to get the bright version (e.g. `bright-white`).
- A `#` followed by a six-digit hexadecimal number. This specifies an [RGB color hex code](https://www.w3schools.com/colors/colors_hexadecimal.asp).
- A number between 0-255. This specifies an [8-bit ANSI Color Code](https://i.stack.imgur.com/KTSQa.png).
Si plusieurs couleurs sont spécifiées pour le premier plan/arrière-plan, la dernière dans le string prendra la priorité.
If multiple colors are specified for foreground/background, the last one in the string will take priority.

File diff suppressed because it is too large Load Diff

View File

@ -56,31 +56,31 @@ Si vous obtenez une erreur du type "_version 'GLIBC_2.18' not found (required by
sh -c "$(curl -fsSL https://starship.rs/install.sh)" -- --platform unknown-linux-musl
```
## Why do I see `Executing command "..." timed out.` warnings?
## Pourquoi je vois des avertissements `Executing command "..." timed out.`?
Starship executes different commands to get information to display in the prompt, for example the version of a program or the current git status. To make sure starship doesn't hang while trying to execute these commands we set a time limit, if a command takes longer than this limit starship will stop the execution of the command and output the above warning, this is expected behaviour. This time limit is configurable using the [`command_timeout` key](/config/#prompt) so if you want you can increase the time limit. You can also follow the debugging steps below to see which command is being slow and see if you can optimise it. Finally you can set the `STARSHIP_LOG` env var to `error` to hide these warnings.
Starship exécute différentes commandes pour obtenir les informations à afficher dans l'invite, par exemple la version d'un programme ou l'état actuel de git. Pour sassurer que starship ne soit pas bloqué par lexécution de ces commandes, nous mettons une limite de temps. Si une commande dépasse cette limite, starship va arrêter lexécution de la commande et afficher lavertissement ci-dessus, cest un comportement attendu. Cette limite de temps est configurable en utilisant la [clé `command_timeout`](/config/#prompt) si vous souhaitez laugmenter. Vous pouvez également suivre les étapes de débogage ci-dessous pour voir quelle commande est lente et voir si vous pouvez loptimiser. Enfin, vous pouvez définir la variable `STARSHIP_LOG` à `error` pour masquer ces avertissements.
## Je vois des symboles que je ne comprends pas et auxquels je ne m'attendais pas, que signifient-t-ils ?
Si vous voyez des symboles que vous ne reconnaissez pas, vous pouvez utiliser `starship explain` pour obtenir des explications concernant les modules actuellement affichés.
## Starship is doing something unexpected, how can I debug it?
## Starship fait quelque chose dinattendu, comment puis-je le déboguer ?
You can enable the debug logs by using the `STARSHIP_LOG` env var. These logs can be very verbose so it is often useful to use the `module` command if you are trying to debug a particular module, for example, if you are trying to debug the `rust` module you could run the following command to get the trace logs and output from the module.
Vous pouvez activer les journaux de débogage en utilisant la variable denvironnement `STARSHIP_LOG`. Ces journaux peuvent être très verbeux, donc il est souvent utile d'utiliser la commande `module` si vous essayez de déboguer un module particulier; par exemple, si vous essayez de déboguer le module `rust`, vous pouvez exécuter la commande suivante pour récupérer les journaux de suivi et les sorties du module.
```sh
env STARHIP_LOG=trace starship module rust
env STARSHIP_LOG=trace starship module rust
```
If starship is being slow you can try using the `timings` command to see if there is a particular module or command that to blame.
Si starship est lent, vous pouvez essayer dutiliser la commande `timings` pour voir si un module ou une commande particulière est à blâmer.
```sh
env STARHIP_LOG=trace starship timings
env STARSHIP_LOG=trace starship timings
```
This will output the trace log and a breakdown of all modules that either took more than 1ms to execute or produced some output.
Cela affichera le journal de suivi et un détail de tous les modules qui ont soit pris plus d1ms pour sexécuter, soit affiché quelque chose.
Finally if you find a bug you can use the `bug-report` command to create a Github issue.
Finalement, si vous trouvez un bug, vous pouvez utiliser la commande `bug-report` pour créer un ticket GitHub.
```sh
starship bug-report
@ -117,6 +117,6 @@ Si Starship a été installé à l'aide d'un gestionnaire de paquets, veuillez v
Si Starship a été installé en utilisant le script d'installation, la commande suivante supprimera l'exécutable :
```sh
# Trouver et supprimer l'exécutable starship
sh -c 'rm "$(which starship)"'
# Locate and delete the starship binary
sh -c 'rm "$(command -v 'starship')"'
```

View File

@ -63,7 +63,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-es.png"
alt="Espagnol"
alt="Español"
/></a>
&nbsp;
<a
@ -72,6 +72,22 @@
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-fr.png"
alt="Français"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/id-ID/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-id.png"
alt="Bahasa Indonesia"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/it-IT/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-it.png"
alt="Italiano"
/></a>
&nbsp;
<a
@ -252,7 +268,7 @@
#### Elvish
**Avertissement** Seul elvish v0.15 ou supérieur est pris en charge. Ajoutez ce qui suit à la fin de `~/.elvish/rc.elv`:
**Attention** Seul elvish v0.17 et supérieur est pris en charge. Ajoutez ce qui suit à la fin de `~/.elvish/rc.elv`:
```sh
# ~/.elvish/rc.elv
@ -283,9 +299,20 @@
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```
#### Nushell
**Avertissement** Cela changera dans le futur. Seule la version nu v0.33 ou supérieure est prise en charge. Ajoutez ce qui suit à votre fichier de configuration 'nu'. Vous pouvez vérifier l'emplacement de ce fichier en exécutant `config path` dans 'nu'.
**Warning** This will change in the future. Seule la version nu v0.33 ou supérieure est prise en charge. Add the following to your nu config file. Vous pouvez vérifier l'emplacement de ce fichier en exécutant `config path` dans 'nu'.
```toml
startup = [

View File

@ -39,7 +39,7 @@ sh -c "$(curl -fsSL https://starship.rs/install.sh)" -- --bin-dir /data/data/com
### Installation
On Funtoo Linux, starship can be installed from [core-kit](https://github.com/funtoo/core-kit/tree/1.4-release/app-shells/starship) via Portage:
Sur Funtoo Linux, starship peut être installé à partir de [core-kit](https://github.com/funtoo/core-kit/tree/1.4-release/app-shells/starship) via Portage:
```sh
emerge app-shells/starship

View File

@ -224,7 +224,7 @@ format = '\[[$symbol($version)]($style)\]'
format = '\[[$symbol($version)]($style)\]'
[sudo]
format = '\[[as $symbol]\]
format = '\[[as $symbol]\]'
[swift]
format = '\[[$symbol($version)]($style)\]'

View File

@ -18,7 +18,7 @@ features:
footer: Berlisensi ISC | Hak Cipta © 2019-sekarang Kontributor Starship
#Used for the description meta tag, for SEO
metaTitle: "Starship: Prompt Lintas Shell"
description: Starship merupakan sebuah prompt yang minimal, super cepat, dan sangat bisa untuk dikustomisasi untuk shell apapun! Bisa menampilkan informasi yang kamu butuhkan, namun tetap bisa tampil dengan ramping dan minimal. Instalasi sederhana tersedia untuk Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, dan PowerShell.
description: Starship merupakan sebuah prompt yang minimal, super cepat, dan sangat bisa untuk dikustomisasi untuk shell apapun! Bisa menampilkan informasi yang kamu butuhkan, namun tetap bisa tampil dengan ramping dan minimal. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and PowerShell.
---
<div class="center">
@ -119,7 +119,7 @@ description: Starship merupakan sebuah prompt yang minimal, super cepat, dan san
#### Elvish
::: warning Hanya elvish v0.15 atau versi yang lebih baru yang mendapat dukungan pengembangan. :::
::: warning Only elvish v0.17 or higher is supported. :::
Tambahkan skrip berikut pada baris akhir `~/.elvish/rc.elv`:
@ -164,3 +164,14 @@ description: Starship merupakan sebuah prompt yang minimal, super cepat, dan san
execx($(starship init xonsh))
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```

View File

@ -8,11 +8,35 @@ Konfigurasi pada bagian ini dapat berubah saat pembaruan Starship rilis di kemud
:::
## Kustomisasi Perintah pre-prompt dan pre-execution Pada Bash
## Custom pre-prompt and pre-execution Commands in Cmd
Bash tidak memiliki framework preexec/precmd yang tetap seperti kebanyakan shell pada umumnya. Oleh karena itu, sulit halnya untuk membuat hook yang dapat dikustomisasi sepenuhnya di dalam `bash`. Namun, Starship memberikan beberapa cara supaya kamu bisa memasukkan fungsimu sendiri ke dalam prosedur prompt-rendering:
Clink provides extremely flexible APIs to run pre-prompt and pre-exec commands in Cmd shell. It is fairly simple to use with Starship. Make the following changes to your `starship.lua` file as per your requirements:
- Untuk menjalankan fungsi yang dikustomisasi tepat sebelum prompt, buatlah sebuah fungsi baru lalu berikan nama `starship_precmd_user_func` ke fungsi tersebut. Sebagai contoh, untuk menampilkan gambar roket sebelum prompt, kamu bisa melakukannya dengan cara
- To run a custom function right before the prompt is drawn, define a new function called `starship_preprompt_user_func`. This function receives the current prompt as a string that you can utilize. For example, to draw a rocket before the prompt, you would do
```lua
function starship_preprompt_user_func(prompt)
print("🚀")
end
load(io.popen('starship init cmd'):read("*a"))()
```
- To run a custom function right before a command is executed, define a new function called `starship_precmd_user_func`. This function receives the current commandline as a string that you can utilize. For example, to print the command that's about to be executed, you would do
```lua
function starship_precmd_user_func(line)
print("Executing: "..line)
end
load(io.popen('starship init cmd'):read("*a"))()
```
## Custom pre-prompt and pre-execution Commands in Bash
Bash does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `bash`. Namun, Starship memberikan beberapa cara supaya kamu bisa memasukkan fungsimu sendiri ke dalam prosedur prompt-rendering:
- To run a custom function right before the prompt is drawn, define a new function and then assign its name to `starship_precmd_user_func`. For example, to draw a rocket before the prompt, you would do
```bash
function blastoff(){
@ -21,13 +45,13 @@ function blastoff(){
starship_precmd_user_func="blastoff"
```
- Untuk menjalankan fungsi yang dikustomisasi tepat sebelum commands berjalan, kamu bisa menggunakan [`DEBUG` trap mechanism](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). Akan tetapi, kamu **harus** melakukan proses trap pada DEBUG signal *sebelum* menjalankan Starship! Starship bisa menyimpan nilai dari DEBUG trap, tapi jika trap diganti setelah starship berjalan, beberapa fungsi akan rusak.
- To run a custom function right before a command runs, you can use the [`DEBUG` trap mechanism](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). However, you **must** trap the DEBUG signal *before* initializing Starship! Starship can preserve the value of the DEBUG trap, but if the trap is overwritten after starship starts up, some functionality will break.
```bash
function blastoff(){
echo "🚀"
}
trap blastoff DEBUG # Trap DEBUG *sebelum* menjalankan starship
trap blastoff DEBUG # Trap DEBUG *before* running starship
eval $(starship init bash)
```
@ -43,35 +67,35 @@ function Invoke-Starship-PreCommand {
}
```
## Mengubah Judul Window
## Change Window Title
Beberapa prompt shell dengan otomatis akan mengubah judul window-nya untukmu (mis. untuk merefleksikan direktori kerjamu). Fish bahkan mengaturnya sebagai bawaan. Starship tidak, tapi mudah saja untuk menambahkan fungsi tersebut ke dalam `bash` ataupun `zsh`.
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash`, `zsh`, `cmd` or `powershell`.
Pertama, buatlah fungsi untuk mengubah judul window (bekerja pada bash dan zsh):
First, define a window title change function (identical in bash and zsh):
```bash
function set_win_title(){
echo -ne "\033]0; JUDUL_WINDOW_MU \007"
echo -ne "\033]0; YOUR_WINDOW_TITLE_HERE \007"
}
```
Kamu bisa menggunakan variabel untuk mengkustomisasi judulnya (`$USER`, `$HOSTNAME`, dan `$PWD` adalah opsi yang populer).
You can use variables to customize this title (`$USER`, `$HOSTNAME`, and `$PWD` are popular choices).
Di dalam `bash`, atur fungsi berikut menjadi fungsi precmd untuk starship:
In `bash`, set this function to be the precmd starship function:
```bash
starship_precmd_user_func="set_win_title"
```
Dalam `zsh`, pada array `precmd_functions`, tambahkan:
In `zsh`, add this to the `precmd_functions` array:
```bash
precmd_functions+=(set_win_title)
```
Kalau kamu suka hasilnya, tambahkan baris (`~/.bashrc` or `~/.zshrc`) ke dalam file konfigurasi shell milikmu untuk membuatnya permanen.
If you like the result, add these lines to your shell configuration file (`~/.bashrc` or `~/.zshrc`) to make it permanent.
Sebagai contoh, kalau kamu mau menampilkan lokasi direktori pada judul label terminalmu, tambahkan bagian berikut ke dalam `~/.bashrc` atau `~/.zshrc`:
For example, if you want to display your current directory in your terminal tab title, add the following snippet to your `~/.bashrc` or `~/.zshrc`:
```bash
function set_win_title(){
@ -80,6 +104,16 @@ function set_win_title(){
starship_precmd_user_func="set_win_title"
```
For Cmd, you can change the window title using the `starship_preprompt_user_func` function.
```lua
function starship_preprompt_user_func(prompt)
console.settitle(os.getenv('USERNAME').."@"..os.getenv('COMPUTERNAME')..": "..os.getcwd())
end
load(io.popen('starship init cmd'):read("*a"))()
```
You can also set a similar output with PowerShell by creating a function named `Invoke-Starship-PreCommand`.
```powershell
@ -97,7 +131,7 @@ Some shells support a right prompt which renders on the same line as the input.
Note: The right prompt is a single line following the input location. To right align modules above the input line in a multi-line prompt, see the [fill module](/config/#fill).
`right_format` saat ini hanya tersedia pada shell: elvish, fish, zsh.
`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd.
### Contoh
@ -111,16 +145,38 @@ format = """$character"""
right_format = """$all"""
```
Menghasilkan prompt seperti berikut:
Produces a prompt like the following:
```
▶ starship on  rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s
```
## Continuation Prompt
Some shells support a continuation prompt along with the normal prompt. This prompt is rendered instead of the normal prompt when the user has entered an incomplete statement (such as a single left parenthesis or quote).
Starship can set the continuation prompt using the `continuation_prompt` option. The default prompt is `"[∙](bright-black) "`.
Note: `continuation_prompt` should be set to a literal string without any variables.
Note: Continuation prompts are only available in the following shells:
- `bash`
- `zsh`
- `PowerShell`
### Contoh
```toml
# ~/.config/starship.toml
# A continuation prompt that displays two filled in arrows
continuation_prompt = "▶▶"
```
## Menata String
Style strings are a list of words, separated by whitespace. Kumpulan katanya tidak bersifat case sensitive (mis. `tebal` dan `TeBaL` dianggap sebagai string yang sama). Tiap-tiap kata berikut adalah opsinya:
Style strings are a list of words, separated by whitespace. The words are not case sensitive (i.e. `bold` and `BoLd` are considered the same string). Each word can be one of the following:
- `bold`
- `italic`
@ -132,14 +188,14 @@ Style strings are a list of words, separated by whitespace. Kumpulan katanya tid
- `<color>`
- `none`
yang mana `<color>` merupakan sebuah penentu warna (dibahas di bawah). `fg:<color>` dan `<color>` untuk saat ini memiliki fungsi yang sama, meskipun bisa berubah di kemudian hari. `inverted` menggantikan warna pada latar depan dan belakang. Urutan kata pada string tidak jadi masalah.
where `<color>` is a color specifier (discussed below). `fg:<color>` and `<color>` currently do the same thing, though this may change in the future. `inverted` swaps the background and foreground colors. The order of words in the string does not matter.
`none` bisa menimpa nilai token lainnya di dalam string jika Ia tidak termaksud dalam penentu warna pada `bg:` sebagai contoh, `fg:red none fg:blue` akan tetap menjadi string yang tidak memiliki penataan. `bg:none` menjadikan warna pada latar belakang sebagai warna bawaan. Jadi, nilai `fg:red bg:none` sama dengan `red` atau `fg:red` dan nilai `bg:green fg:red bg:none` juga sama dengan `fg:red` ataupun `red`. Mungkin akan jadi masalah untuk menggunakan `none` dengan token lainnya di kemudian hari.
The `none` token overrides all other tokens in a string if it is not part of a `bg:` specifier, so that e.g. `fg:red none fg:blue` will still create a string with no styling. `bg:none` sets the background to the default color so `fg:red bg:none` is equivalent to `red` or `fg:red` and `bg:green fg:red bg:none` is also equivalent to `fg:red` or `red`. It may become an error to use `none` in conjunction with other tokens in the future.
Penentuan warna bisa dilakukan dengan salah satu cara berikut:
A color specifier can be one of the following:
- Warna terminal pada umumnya terdiri dari: `black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`. Untuk memperoleh varian warna yang lebih cerah, kamu dapat menggunakan token `bright-` (mis. `bright-white`).
- Menuliskannya dengan menggunakan `#` dan diikuti oleh enam digit angka hexadesimal. Spesifikasi [kode heksadesimal pada warna RGB](https://www.w3schools.com/colors/colors_hexadecimal.asp).
- Menggunakan bilangan antara 0-255. Spesifikasi [8-bit Kode Warna ANSI](https://i.stack.imgur.com/KTSQa.png).
- One of the standard terminal colors: `black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`. You can optionally prefix these with `bright-` to get the bright version (e.g. `bright-white`).
- A `#` followed by a six-digit hexadecimal number. This specifies an [RGB color hex code](https://www.w3schools.com/colors/colors_hexadecimal.asp).
- A number between 0-255. This specifies an [8-bit ANSI Color Code](https://i.stack.imgur.com/KTSQa.png).
Jika warna yang dipakai pada latar depan/latar belakang banyak, maka warna yang terbaru pada string yang akan diprioritaskan.
If multiple colors are specified for foreground/background, the last one in the string will take priority.

View File

@ -24,46 +24,58 @@ disabled = true
Kamu bisa mengganti lokasi file konfigurasi bawaan dengan menggunakan environment variable dari `STARSHIP_CONFIG`:
```sh
export STARSHIP_CONFIG=~/.starship/config.toml
export STARSHIP_CONFIG=~/example/non/default/path/starship.toml
```
Ekuivalen dalam PowerShell (Windows), tambahkan baris berikut pada `$PROFILE`:
```powershell
$ENV:STARSHIP_CONFIG = "$HOME\.starship\config.toml"
$ENV:STARSHIP_CONFIG = "$HOME\example\non\default\path\starship.toml"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CONFIG', 'C:\\Users\\user\\example\\non\\default\\path\\starship.toml')
```
### Logging
Secara bawaan, starship mencatat peringatan dan eror ke dalam sebuah file bernama `~/.cache/starship/session_${STARSHIP_SESSION_KEY}.log`, yang mana session key file tersebut sama dengan instance terminalmu. Namun, hal tersebut dapat diubah dengan menggunakan environment variable dari `STARSHIP_CACHE` berikut:
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_CONFIG=~/.starship/cache
export STARSHIP_CACHE=~/.starship/cache
```
Pada PowerShell (Windows), tambahkan baris berikut pada `$PROFILE`:
Ekuivalen dalam PowerShell (Windows), tambahkan baris berikut pada `$PROFILE`:
```powershell
$ENV:STARSHIP_CACHE = "$HOME\AppData\Local\Temp"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CACHE', 'C:\\Users\\user\\AppData\\Local\\Temp')
```
### Terminologi
**Modul**: Sebuah komponen pada prompt yang memberikan informasi berdasarkan info kontekstual sistem operasimu. Sebagai contoh, modul "nodejs" menampilkan versi Node.js yang tengah terpasang pada komputermu, jika direktorimu sedang berada pada proyek Node.js.
**Module**: A component in the prompt giving information based on contextual information from your OS. For example, the "nodejs" module shows the version of Node.js that is currently installed on your computer, if your current directory is a Node.js project.
**Variabel**: Sub-komponen yang terdiri dari informasi yang disediakan oleh modul. Sebagai contoh, variabel "version" dalam modul "nodejs" memuat versi terikini dari Node.js.
**Variable**: Smaller sub-components that contain information provided by the module. For example, the "version" variable in the "nodejs" module contains the current version of Node.js.
Secara konvensi, sebagian modul memiliki prefiks bawaan pada warna terminal (mis. `via` pada "nodejs") dan juga sebuah ruang kosong sebagai sufiks.
By convention, most modules have a prefix of default terminal color (e.g. `via` in "nodejs") and an empty space as a suffix.
### Format String
Format string merupakan format yang sebuah modul gunakan untuk menampilkan semua variabelnya. Sebagian besar modul memiliki sebuah entri yang disebut `format` yang mengkonfigurasi format tampilan pada modul. Kamu bisa menggunakan teks, variabel, dan grup teks di dalam sebuah format string.
Format strings are the format that a module prints all its variables with. Most modules have an entry called `format` that configures the display format of the module. You can use texts, variables and text groups in a format string.
#### Variabel
Variabel memilki simbol `$` yang diikuti dengan nama variabelnya. The name of a variable can only contain letters, numbers and `_`.
A variable contains a `$` symbol followed by the name of the variable. The name of a variable can only contain letters, numbers and `_`.
Sebagai contoh:
For example:
- `$version` adalah format string dengan sebuah nama variabel `version`.
- `$git_branch$git_commit` merupakan sebuah format string dengan dua variabel bernama `git_branch` dan `git_commit`.
@ -71,13 +83,13 @@ Sebagai contoh:
#### Grup Teks
Grup teks dibuat dengan dua bagian yang berbeda.
A text group is made up of two different parts.
Bagian pertama, yang mana diapit dalam sebuah `[]`, merupakan sebuah [format string](#format-strings). Kamu bisa menambahkan teks, variabel, atau bahkan grup teks bercabang di dalamnya.
The first part, which is enclosed in a `[]`, is a [format string](#format-strings). You can add texts, variables, or even nested text groups in it.
Pada bagian kedua, yang mana diapit dalam sebuah `()`, merupakan sebuah [penataan string](#style-strings). This can be used to style the first part.
In the second part, which is enclosed in a `()`, is a [style string](#style-strings). This can be used to style the first part.
Sebagai contoh:
For example:
- `[on](red bold)` akan menampilkan string `on` dengan teks merah tebal.
- `[⌘ $version](bold green)` akan menampilkan simbol `⌘` yang diikuti oleh variabel yang berisikan `version`, dengan teks tebal berwarna hijau.
@ -85,7 +97,7 @@ Sebagai contoh:
#### Menata String
Sebagian besar modul starship memungkinkan kamu untuk mengkonfigurasi gaya tampilannya. Hal ini dilakukan dengan sebuah entri (biasanya `style`) yang konfigurasinya ditentukan oleh string. Berikut adalah beberapa contoh penataan pada string dan kegunaannya. Untuk detail sintaksis yang lebih lengkap, lihat [panduan konfigurasi lanjutan](/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"` mengeset teks berwana hijau pada latar biru
- `"bg:blue fg:bright-green"` mengeset teks hijau terang pada latar biru
@ -94,13 +106,13 @@ Sebagian besar modul starship memungkinkan kamu untuk mengkonfigurasi gaya tampi
- `"bold italic fg:purple"` mengeset teks ungu miring tebal
- `""` secara eksplisit menonaktifkan semua penataan gaya
Perhatikan bagaimana nantinya penataanmu akan terlihat pada emulator terminalmu. Sebagai contoh, beberapa terminal emulator alih-alih membuat warnanya lebih terang, malah menebalkan teksnya, dan sebagian palet warna ada yang menggunakan nilai yang sama untuk warna normal dan terangnya. Dan juga, untuk memakai teks miring, terminalmu harus menunjang teks miring.
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.
#### Format String Bersyarat (Conditional)
Sebuah string dengan format bersyarat dibungkus dengan `(` dan `)` tidak akan dijalankan jika variabel di dalamnya kosong.
A conditional format string wrapped in `(` and `)` will not render if all variables inside are empty.
Sebagai contoh:
For example:
- `(@$region)` tidak akan menampilkan apapun jika nilai variabel `region` adalah `None` atau berupa string kosong, jika tidak, `@` diikuti dengan nilai dari region.
- `(sembarang)` akan selalu tidak menampilkan apapun karena tidak ada variabel yang dibungkus dalam kurung kurawal.
@ -112,18 +124,18 @@ The following symbols have special usage in a format string and must be escaped:
Note that TOML has [both basic strings and literal strings](https://toml.io/en/v1.0.0#string). It is recommended to use a literal string (surrounded by single quotes) in your config. If you want to use a basic string (surrounded by double quotes), you must escape the backslash itself (i.e. use `\\`).
Sebagai contoh, ketika kamu ingin menampilkan simbol `$` pada sebuah baris baru, konfigurasi berikut sama halnya pada `format`:
For example, when you want to print a `$` symbol on a new line, the following configs for `format` are equivalent:
```toml
# dengan string standar
# with basic string
format = "\n\\$"
# dengan string standar multibaris
# with multiline basic string
format = """
\\$"""
# dengan string literal
# with literal string
format = '''
\$'''
@ -131,7 +143,7 @@ format = '''
## Prompt
Berikut adalah opsi konfigurasi dari list yang bersifat prompt-wide.
This is the list of prompt-wide configuration options.
### Opsi
@ -149,22 +161,22 @@ Berikut adalah opsi konfigurasi dari list yang bersifat prompt-wide.
```toml
# ~/.config/starship.toml
# Menggunakan format yang dikustomisasi
# Use custom format
format = """
[┌───────────────────>](bold green)
[](bold green)$directory$rust$package
[└─>](bold green) """
# Menunggu 10 milidetik untuk starship mencek file pada direktori terkini.
# Wait 10 milliseconds for starship to check files under the current directory.
scan_timeout = 10
# Menonaktifkan baris kosong di awal prompt
# Disable the blank line at the start of the prompt
add_newline = false
```
### Format Prompt Bawaan
Aturan `format` bawaan digunakan untuk mendefinisikan format pada prompt, apabila kosong atau tidak ada `format` yang diberikan. Aturannya seperti yang ditunjukkan:
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 = "$all"
@ -248,13 +260,13 @@ format="$all$directory$character"
## AWS
Module `aws` menampilkan region dan profil AWS terkini. Diperoleh dari variabel environment `AWS_REGION`, `AWS_DEFAULT_REGION`, dan `AWS_PROFILE` pada file `~/.aws/config`. Modul ini juga menampilkan penghitung waktu mundur kedaluwarsa ketika menggunakan temporer kredensial.
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. This module also shows an expiration timer when using temporary credentials.
Ketika menggunakan [aws-vault](https://github.com/99designs/aws-vault), profil dibaca dari variabel environment `AWS_VAULT` dan tanggal kedaluwarsanya dibaca dari variabel environment `AWS_SESSION_EXPIRATION`.
When using [aws-vault](https://github.com/99designs/aws-vault) the profile is read from the `AWS_VAULT` env var and the credentials expiration date is read from the `AWS_SESSION_EXPIRATION` env var.
Ketika menggunakan [awsu](https://github.com/kreuzwerker/awsu) profil dibaca dari variabel environment `AWSU_PROFILE`.
When using [awsu](https://github.com/kreuzwerker/awsu) the profile is read from the `AWSU_PROFILE` env var.
Ketika menggunakan [AWSume](https://awsu.me) profil dibaca dari variabel environment `AWSUME_PROFILE` dan tanggal kedaluwarsanya dibaca dari variabel environment `AWSUME_EXPIRATION`.
When using [AWSume](https://awsu.me) the profile is read from the `AWSUME_PROFILE` env var and the credentials expiration date is read from the `AWSUME_EXPIRATION` env var.
### Opsi
@ -347,7 +359,7 @@ style = "blue bold"
## Baterai
Modul `battery` menampilkan seberapa penuh baterai perangkat terisi dan status pengisiannya. Modulnya hanya dapat terlihat ketika baterai perangkat di bawah 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%.
### Opsi
@ -375,7 +387,7 @@ discharging_symbol = "💀 "
### Tampilan Baterai
Opsi konfigurasi `display` digunakan untuk menentukan kapan indikator baterai harus ditampilkan (threshold), simbol mana yang akan digunakan (symbol), dan bagaimana seharusnya itu terlihat (style). Jika tidak ada `display` yang diberikan. Aturannya seperti yang ditunjukkan:
The `display` configuration option is used to define when the battery indicator should be shown (threshold), which symbol would be used (symbol), and what it would like (style). If no `display` is provided. The default is as shown:
```toml
[[battery.display]]
@ -383,11 +395,11 @@ threshold = 10
style = "bold red"
```
Nilai bawaan untuk opsi `charging_symbol` dan `discharging_symbol` adalah nilai dari masing-masing opsi `charging_symbol` dan `discharging_symbol` dari nilai `battery`.
The default value for the `charging_symbol` and `discharging_symbol` option is respectively the value of `battery`'s `charging_symbol` and `discharging_symbol` option.
#### Opsi
Opsi dari `display` merupakan sebuah array dari tabel berikut.
The `display` option is an array of the following table.
| Opsi | Bawaan | Deskripsi |
| -------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------- |
@ -414,24 +426,24 @@ discharging_symbol = "💦"
## Karakter
Modul `character` menampilkan sebuah karakter (biasanya anak panah) di samping teks pada terminalmu.
The `character` module shows a character (usually an arrow) beside where the text is entered in your terminal.
Karakter dapat memberitahu kamu apakah perintah terakhir berhasil atau tidak. Karakter dapat memberitahumu dengan dua cara ini:
The character will tell you whether the last command was successful or not. It can do this in two ways:
- mengganti warna (`red`/`green`)
- mengganti bentuk (``/`✖`)
Secara bawaan karakter hanya dapat mengganti warna. Jika kamu juga ingin mengganti bentuknya, perhatikan [contoh](#with-custom-error-shape) berikut.
By default it only changes color. If you also want to change its shape take a look at [this example](#with-custom-error-shape).
::: peringatan
`error_symbol` tidak didukung pada elvish dan nu shell.
`error_symbol` is not supported on nu shell.
:::
::: peringatan
`vicmd_symbol` hanya didukung pada fish dan zsh.
`vicmd_symbol` is only supported in cmd, fish and zsh.
:::
@ -484,7 +496,7 @@ vicmd_symbol = "[V](bold green) "
## CMake
Modul `cmake` menampilkan versi terkini dari [CMake](https://cmake.org/) yang terpasang. Secara bawaan, modul akan aktif jika beberapa syarat berikut telah terpenuhi:
The `cmake` module shows the currently installed version of [CMake](https://cmake.org/). By default the module will be activated if any of the following conditions are met:
- Direktori terkini yang berisikan sebuah file `CMakeLists.txt`
- Direktori terkini yang berisikan sebuah file `CMakeCache.txt`
@ -544,15 +556,15 @@ The `cobol` module shows the currently installed version of COBOL. By default, t
## Durasi Perintah
Modul `cmd_duration` menampilkan seberapa lama perintah sebelumnya membutuhkan waktu untuk dilaksanakan. Modulnya hanya akan ditampilkan jika perintahnya membutuhkan waktu lebih dari dua detik, atau ada nilai dari konfigurasi `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.
::: jangan lakukan hook DEBUG trap dalam Bash
::: warning Do not hook the DEBUG trap in Bash
Jia kamu menjalankan Starship di `bash`, jangan lakukan hook DEBUG trap setelah menjalankan `eval $(starship init $0)`, atau modulnya **akan** rusak.
If you are running Starship in `bash`, do not hook the `DEBUG` trap after running `eval $(starship init $0)`, or this module **will** break.
:::
Pengguna Bash yang membutuhkan fungsi seperti preexec dapat menggunakan [kerangka kerja bash_preexec dari rcaloras](https://github.com/rcaloras/bash-preexec). Cukup dengan membuat array `preexec_functions` dan `precmd_functions` sebelum menjalankan `eval $(starship init $0)`, lalu lanjutkan seperti biasa.
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.
### Opsi
@ -566,9 +578,9 @@ Pengguna Bash yang membutuhkan fungsi seperti preexec dapat menggunakan [kerangk
| `show_notifications` | `false` | Menampilkan notifikasi layar ketika perintah selesai. |
| `min_time_to_notify` | `45_000` | Durasi terpendek untuk menampilkan notifikasi (dalam milidetik). |
::: saran
::: tip
Menampilkan notifikasi layar memerlukan starship dikembangkan dengan dukungan dari `rust-notify`. Periksa apakah starship kamu mendukung notifikasi dengan menjalankan `STARSHIP_LOG=debug starship module cmd_duration -d 60000` ketika `show_notifications` diatur menjadi `true`.
Showing desktop notifications requires starship to be built with `notify-rust` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
:::
@ -595,9 +607,9 @@ format = "underwent [$duration](bold yellow)"
The `conda` module shows the current [Conda](https://docs.conda.io/en/latest/) environment, if `$CONDA_DEFAULT_ENV` is set.
::: saran
::: tip
Hal ini tidak menahan pengubah (modifier) prompt dari conda sendiri, kamu mungkin bisa menjalankan `conda config --set changeps1 False`.
This does not suppress conda's own prompt modifier, you may want to run `conda config --set changeps1 False`.
:::
@ -633,7 +645,7 @@ format = "[$symbol$environment](dimmed green) "
## Crystal
Modul `crystal` menampilkan versi terkini dari [Crystal](https://crystal-lang.org/) yang terpasang. Secara bawaan, modul akan aktif jika beberapa syarat berikut telah terpenuhi:
The `crystal` module shows the currently installed version of [Crystal](https://crystal-lang.org/). Secara bawaan, modul akan aktif jika beberapa syarat berikut telah terpenuhi:
- Direktori terkini yang berisikan sebuah file `shard.yml`
- Direktori terkini yang berisikan sebuah file `.cr`
@ -672,7 +684,7 @@ format = "via [✨ $version](bold blue) "
## Dart
Modul `dart` menampilkan versi terkini dari [Dart](https://dart.dev/) yang terpasang. Secara bawaan, modul akan aktif jika beberapa syarat berikut telah terpenuhi:
The `dart` module shows the currently installed version of [Dart](https://dart.dev/). Secara bawaan, modul akan aktif jika beberapa syarat berikut telah terpenuhi:
- Direktori terkini yang berisikan sebuah file berekstensi `.dart`
- Direktori terkini yang berisikan sebuah direktori `dart_tool`
@ -712,21 +724,21 @@ format = "via [🔰 $version](bold red) "
## Deno
Modul `deno` menampilkan versi terkini dari [Deno](https://deno.land/) yang terpasang. Secara bawaan, modul akan aktif jika beberapa syarat berikut telah terpenuhi:
- Direktori terkini yang berisikan sebuah file `mod.ts`, `mod.js`, `deps.ts` atau `deps.js`
The `deno` module shows you your currently installed version of [Deno](https://deno.land/). Secara bawaan, modul akan aktif jika beberapa syarat berikut telah terpenuhi:
- The current directory contains a `deno.json`, `deno.jsonc`, `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
### Opsi
| Opsi | Bawaan | Deskripsi |
| ------------------- | -------------------------------------------- | ----------------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | Format dari modul. |
| `version_format` | `"v${raw}"` | Format dari versi. Variabel yang tersedia adalah `raw`, `major`, `minor`, & `patch` |
| `symbol` | `🦕 "` | Sebuah format string yang melambangkan simbol Deno |
| `detect_extensions` | `[]` | Ekstensi mana yang sebaiknya memicu modul ini. |
| `detect_files` | `["mod.ts", "mod.js", "deps.ts", "deps.js"]` | filenames mana yang sebaiknya memicu modul ini. |
| `detect_folders` | `[]` | Folder mana yang sebaiknya memicul modul ini. |
| `style` | `"green bold"` | Gaya penataan untuk modul. |
| `disabled` | `false` | Menonaktifkan modul `deno`. |
| Opsi | Bawaan | Deskripsi |
| ------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | Format dari modul. |
| `version_format` | `"v${raw}"` | Format dari versi. Variabel yang tersedia adalah `raw`, `major`, `minor`, & `patch` |
| `symbol` | `🦕 "` | Sebuah format string yang melambangkan simbol Deno |
| `detect_extensions` | `[]` | Ekstensi mana yang sebaiknya memicu modul ini. |
| `detect_files` | `["deno.json", "deno.jsonc", "mod.ts", "mod.js", "deps.ts", "deps.js"]` | filenames mana yang sebaiknya memicu modul ini. |
| `detect_folders` | `[]` | Folder mana yang sebaiknya memicul modul ini. |
| `style` | `"green bold"` | Gaya penataan untuk modul. |
| `disabled` | `false` | Menonaktifkan modul `deno`. |
### Variabel
@ -747,29 +759,30 @@ format = "via [🦕 $version](green bold) "
## Direktori
Modul `directory` menampilkan arah ke direkori terkinimu, disingkat ke tiga folder induk. Direkrotimu juga akan disingkat ke root dari git repo di tempatmu berada saat ini.
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.
Ketika kamu menggunakan penataan pwd option fish, alih-alih menyembunyikan jalur yang disingkat, kamu akan melihat nama yang disingkat untuk tiap-tiap direktori berdasarkan dari jumlah nomor yang kamu aktifkan untuk opsi tersebut.
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.
Sebagai contoh, untuk `~/Dev/Nix/nixpkgs/pkgs` dimana `nixpkgs` merupakan root repo-nya, dan lalu opsinya diset menjadi `1`. Kamu akan melihat `~/D/N/nixpkgs/pkgs`, sedangkan sebelumnya direktori tersebut harusnya `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`.
### Opsi
| Opsi | Bawaan | Deskripsi |
| ------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `truncation_length` | `3` | Jumlah dari folder induk yang harusnya disingkat oleh direktori saat ini. |
| `truncate_to_repo` | `true` | Apakah harus menyingkat root dari git repo tempatmu berada saat ini. |
| `format` | `"[$path]($style)[$read_only]($read_only_style) "` | Format dari modul. |
| `style` | `"bold cyan"` | Gaya penataan untuk modul. |
| `disabled` | `false` | Menonaktifkan modul `directory`. |
| `read_only` | `"🔒"` | Simbol yang mengindikasikan direktori saat ini bersifat read only. |
| `read_only_style` | `"red"` | Corak gaya untuk simbol read only. |
| `truncation_symbol` | `""` | Simbol untuk awalan jalur yang disingkat. misalnya: ".../" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | Simbol yang mengindikasikan direktori home. |
| Opsi | Bawaan | Deskripsi |
| ------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `truncation_length` | `3` | Jumlah dari folder induk yang harusnya disingkat oleh direktori saat ini. |
| `truncate_to_repo` | `true` | Apakah harus menyingkat root dari git repo tempatmu berada saat ini. |
| `format` | `"[$path]($style)[$read_only]($read_only_style) "` | Format dari modul. |
| `style` | `"bold cyan"` | Gaya penataan untuk modul. |
| `disabled` | `false` | Menonaktifkan modul `directory`. |
| `read_only` | `"🔒"` | Simbol yang mengindikasikan direktori saat ini bersifat read only. |
| `read_only_style` | `"red"` | Corak gaya untuk simbol read only. |
| `truncation_symbol` | `""` | Simbol untuk awalan jalur yang disingkat. misalnya: ".../" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | Simbol yang mengindikasikan direktori home. |
| `use_os_path_sep` | `true` | Use the OS specific path seperator instead of always using `/` (e.g. `\` on Windows) |
<details>
<summary>Modul ini memilki beberapa opsi konfigurasi lanjutan yang mengontrol bagaimana direktori ditampilkan.</summary>
<summary>This module has a few advanced configuration options that control how the directory is displayed.</summary>
| Advanced Option | Bawaan | Deskripsi |
| --------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@ -846,9 +859,9 @@ format = "via [🐋 $context](blue bold)"
## Dotnet
Modul `dotnet` menampilkan informasi terkait versi dari [.NET Core SDK](https://dotnet.microsoft.com/) pada direktori terkini. Apabila SDK telah disematkan pada direktori terkni, maka veri yang telah disematkan tersebutlah yang ditampilkan. Jika tidak, maka modul akan menampilkan versi SDK terkini.
The `dotnet` module shows the relevant version of the [.NET Core SDK](https://dotnet.microsoft.com/) 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.
Secara bawaan, modul ini hanya akan ditampilkan ke prompt kamu ketika teradapat satu atau lebih file berikut di dalam direktorimu saat ini:
By default this module will only be shown in your prompt when one or more of the following files are present in the current directory:
- `global.json`
- `project.json`
@ -859,11 +872,11 @@ Secara bawaan, modul ini hanya akan ditampilkan ke prompt kamu ketika teradapat
- `*.fsproj`
- `*.xproj`
Kamu juga perlu memasang .NET Core SDK untuk menggunakannya dengan baik.
You'll also need the .NET Core SDK installed in order to use it correctly.
Secara internal, modul ini menggunakan mekenasimenya sendiri untuk melakukan pendeteksian versi. Biasanya, hal ini dua kali lebih cepat seperti untuk menjalankan `dotnet --version`, tetapi ada kemungkinan hal ini akan menampilkan versi yang salah jika proyek .NET milikmu memiliki tata letak direktori yang tidak biasa. Jika menurutmu akurasi lebih penting dari kecepatan, kamu dapat menonaktifkan mekanisme tersebut dengan mengatur `heuristic = false` di dalam opsi modul.
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.
Modul ini juga akan menampilkan Target Framework Moniker (<https://docs.microsoft.com/en-us/dotnet/standard/frameworks#supported-target-framework-versions>) ketika terdapat sebuah file csproj di dalam direktori terkini.
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.
### Opsi
@ -903,7 +916,7 @@ heuristic = false
## Elixir
Modul `elixir` menampilkan versi terkini dari [Elixir](https://elixir-lang.org/) dan [Erlang/OTP](https://erlang.org/doc/). Secara bawaan, modul akan aktif jika beberapa syarat berikut telah terpenuhi:
The `elixir` module shows the currently installed version of [Elixir](https://elixir-lang.org/) and [Erlang/OTP](https://erlang.org/doc/). Secara bawaan, modul akan aktif jika beberapa syarat berikut telah terpenuhi:
- Direktori terkini yang berisikan sebuah file `mix.exs`.
@ -942,7 +955,7 @@ symbol = "🔮 "
## Elm
Modul `elixir` menampilkan versi terkini dari [Elm](https://elm-lang.org/) yang terpasang. Secara bawaan, modul akan aktif jika beberapa syarat berikut telah terpenuhi:
The `elm` module shows the currently installed version of [Elm](https://elm-lang.org/). Secara bawaan, modul akan aktif jika beberapa syarat berikut telah terpenuhi:
- Direktori terkini yang berisikan sebuah file `elm.json`
- Direktori terkini yang berisikan sebuah file `elm-package.json`
@ -984,15 +997,15 @@ format = "via [ $version](cyan bold) "
## Variabel Environment
Modul `env_var` menampilkan nilai terkini dari variabel environment yang dipilih. Modul hanya akan aktif jika beberapa syarat berikut telah terpenuhi:
The `env_var` module displays the current value of a selected environment variables. The module will be shown only if any of the following conditions are met:
- Opsi konfigurasi `variable` cocok dengan variabel environment yang ada
- Opsi konfigurasi `variable` tidak didefinisikan, tapi opsi konfigurasi `default` yang didefinisikan
Multi-variabel environment dapat ditampilkan dengan menggunakan `.`. (lihat contoh) Jika opsi konfigurasi `variable` tidak diset, modul akan menampilkan nilai variabel di bawah teks nama setelah karakter `.`.
::: tip Multiple environmental variables can be displayed by using a `.`. (see example) If the `variable` configuration option is not set, the module will display value of variable under the name of text after the `.` character.
Contoh: konfigurasi berikut akan menampilkan nilai dari variabel USER environment
Example: following configuration will display value of USER environment variable
```toml
# ~/.config/starship.toml
@ -1031,7 +1044,7 @@ variable = "SHELL"
default = "unknown shell"
```
Menampilkan multi-variabel environment:
Displaying multiple environmental variables:
```toml
# ~/.config/starship.toml
@ -1291,7 +1304,7 @@ cherry_pick = "[🍒 PICKING](bold red)"
The `git_metrics` module will show the number of added and deleted lines in the current git repository.
::: saran
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
@ -1334,22 +1347,23 @@ The `git_status` module shows symbols representing the state of the repo in your
### Opsi
| Opsi | Bawaan | Deskripsi |
| ------------ | ----------------------------------------------- | ----------------------------------- |
| `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` |
| `style` | `"bold red"` | Gaya penataan untuk modul. |
| `disabled` | `false` | Disables the `git_status` module. |
| Opsi | Bawaan | Deskripsi |
| ------------------- | ----------------------------------------------- | ----------------------------------- |
| `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` |
| `style` | `"bold red"` | Gaya penataan untuk modul. |
| `ignore_submodules` | `false` | Ignore changes to submodules. |
| `disabled` | `false` | Disables the `git_status` module. |
### Variabel
@ -1513,10 +1527,10 @@ The `hostname` module shows the system hostname.
### Variabel
| Variabel | Contoh | Deskripsi |
| --------- | ------ | --------------------------------- |
| symbol | | Menyalin nilai dari opsi `symbol` |
| style\* | | Menyalin nilai dari opsi `style` |
| Variabel | Contoh | Deskripsi |
| --------- | ---------- | -------------------------------- |
| hostname | `computer` | The hostname of the computer |
| style\* | | Menyalin nilai dari opsi `style` |
\*: Variabel tersebut hanya dapat digunakan sebagai bagian dari penataan string
@ -1720,7 +1734,7 @@ kotlin_binary = "kotlinc"
Displays the current [Kubernetes context](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#context) name and, if set, the namespace from the kubeconfig file. The namespace needs to be set in the kubeconfig file, this can be done via `kubectl config set-context starship-cluster --namespace astronaut`. If the `$KUBECONFIG` env var is set the module will use that if not it will use the `~/.kube/config`.
::: saran
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
@ -1848,7 +1862,7 @@ The `memory_usage` module shows current system memory and swap usage.
By default the swap usage is displayed if the total system swap is non-zero.
::: saran
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
@ -2133,7 +2147,7 @@ symbol = "☁️ "
## 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`, `composer`, `gradle`, `julia`, `mix`, `helm` and `shards` packages.
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`, `composer`, `gradle`, `julia`, `mix`, `helm`, `shards` 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
@ -2150,6 +2164,7 @@ The `package` module is shown when the current directory is the repository for a
- [**Shards**](https://crystal-lang.org/reference/the_shards_command/index.html) - The `shards` package version is extracted from the `shard.yml` present
- [**V**](https://vlang.io) - The `vlang` package version is extracted from the `v.mod` present
- [**SBT**](https://scala-sbt.org) - The `sbt` package version is extracted from the `build.sbt` present in the current directory
- [**Dart**](https://pub.dev/) - The `dart` package version is extracted from the `pubspec.yaml` present in the current directory
> ⚠️ The version being shown is that of the package whose source code is in your current directory, not your package manager.
@ -2267,7 +2282,7 @@ format = "via [🔹 $version](147 bold) "
The `pulumi` module shows the currently selected [Pulumi Stack](https://www.pulumi.com/docs/intro/concepts/stack/) and version.
::: saran
::: tip
By default the Pulumi version is not shown, since it takes an order of magnitude longer to load then most plugins (~70ms). If you still want to enable it, [follow the example shown below](#with-pulumi-version).
@ -2393,7 +2408,7 @@ Secara bawaan, modul akan aktif jika beberapa syarat berikut telah terpenuhi:
| `detect_folders` | `[]` | Folder mana yang sebaiknya memicul modul ini |
| `disabled` | `false` | Disables the `python` module. |
::: saran
::: tip
The `python_binary` variable accepts either a string or a list of strings. Starship will try executing each binary until it gets a result. Note you can only change the binary that Starship executes to get the version of Python not the arguments that are used.
@ -2655,7 +2670,7 @@ symbol = "🌟 "
The `shell` module shows an indicator for currently used shell.
::: saran
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
@ -2673,6 +2688,8 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
| `elvish_indicator` | `esh` | A format string used to represent elvish. |
| `tcsh_indicator` | `tsh` | A format string used to represent tcsh. |
| `xonsh_indicator` | `xsh` | A format string used to represent xonsh. |
| `cmd_indicator` | `cmd` | A format string used to represent cmd. |
| `nu_indicator` | `nu` | A format string used to represent nu. |
| `unknown_indicator` | | The default value to be displayed when the shell is unknown. |
| `format` | `"[$indicator]($style) "` | Format dari modul. |
| `style` | `"white bold"` | Gaya penataan untuk modul. |
@ -2772,13 +2789,13 @@ format = '[📦 \[$env\]]($style) '
The `status` module displays the exit code of the previous command. The module will be shown only if the exit code is not `0`.
::: saran
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
::: warning This module is not supported on elvish and nu shell. :::
::: warning This module is not supported on nu shell. :::
### Opsi
@ -2804,6 +2821,7 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
| Variabel | Contoh | Deskripsi |
| -------------- | ------- | ------------------------------------------------------------------------------------------- |
| status | `127` | The exit code of the last command |
| hex_status | `0x7F` | The exit code of the last command in hex |
| int | `127` | The exit code of the last command |
| common_meaning | `ERROR` | Meaning of the code if not a signal |
| signal_number | `9` | Signal number corresponding to the exit code, only if signalled |
@ -2834,7 +2852,7 @@ disabled = false
The `sudo` module displays if sudo credentials are currently cached. The module will only be shown if credentials are cached.
::: saran
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
@ -2923,7 +2941,7 @@ format = "via [🏎 $version](red bold)"
The `terraform` module shows the currently selected [Terraform workspace](https://www.terraform.io/docs/language/state/workspaces.html) and version.
::: saran
::: tip
By default the Terraform version is not shown, since this is slow for current versions of Terraform when a lot of plugins are in use. If you still want to enable it, [follow the example shown below](#with-terraform-version).
@ -2982,7 +3000,7 @@ format = "[🏎💨 $workspace]($style) "
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.
::: saran
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
@ -3033,7 +3051,7 @@ The `username` module shows active user's username. The module will be shown if
- The user is currently connected as an SSH session
- The variable `show_always` is set to true
::: saran
::: tip
SSH connection is detected by checking environment variables `SSH_CONNECTION`, `SSH_CLIENT`, and `SSH_TTY`. If your SSH host does not set up these variables, one workaround is to set one of them with a dummy value.
@ -3171,7 +3189,7 @@ The `vcsh` module displays the current active [VCSH](https://github.com/RichiH/v
# ~/.config/starship.toml
[vcsh]
format = "via [✨ $repo](bold blue) "
format = "[🆅 $repo](bold blue) "
```
## Zig
@ -3224,19 +3242,19 @@ These modules will be shown if any of the following conditions are met:
- The `when` command returns 0
- The current Operating System (std::env::consts::OS) matchs with `os` field if defined.
::: saran
::: tip
Multiple custom modules can be defined by using a `.`.
:::
::: saran
::: tip
The order in which custom modules are shown can be individually set by including `${custom.foo}` in the top level `format` (as it includes a dot, you need to use `${...}`). By default, the `custom` module will simply show all custom modules in the order they were defined.
:::
::: saran
::: tip
[Issue #1252](https://github.com/starship/starship/discussions/1252) contains examples of custom modules. If you have an interesting example not covered there, feel free to share it there!

View File

@ -69,13 +69,13 @@ If you see symbols that you don't recognise you can use `starship explain` to ex
You can enable the debug logs by using the `STARSHIP_LOG` env var. These logs can be very verbose so it is often useful to use the `module` command if you are trying to debug a particular module, for example, if you are trying to debug the `rust` module you could run the following command to get the trace logs and output from the module.
```sh
env STARHIP_LOG=trace starship module rust
env STARSHIP_LOG=trace starship module rust
```
If starship is being slow you can try using the `timings` command to see if there is a particular module or command that to blame.
```sh
env STARHIP_LOG=trace starship timings
env STARSHIP_LOG=trace starship timings
```
This will output the trace log and a breakdown of all modules that either took more than 1ms to execute or produced some output.
@ -118,5 +118,5 @@ If Starship was installed using the install script, the following command will d
```sh
# Locate and delete the starship binary
sh -c 'rm "$(which starship)"'
sh -c 'rm "$(command -v 'starship')"'
```

View File

@ -72,6 +72,22 @@
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-fr.png"
alt="Français"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/id-ID/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-id.png"
alt="Bahasa Indonesia"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/it-IT/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-it.png"
alt="Italiano"
/></a>
&nbsp;
<a
@ -252,7 +268,7 @@
#### Elvish
**Warning** Only elvish v0.15 or higher is supported. Tambahkan skrip berikut pada baris akhir `~/.elvish/rc.elv`:
**Warning** Only elvish v0.17 or higher is supported. Tambahkan skrip berikut pada baris akhir `~/.elvish/rc.elv`:
```sh
# ~/.elvish/rc.elv
@ -283,6 +299,17 @@
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```
#### Nushell
**Warning** This will change in the future. Hanya nu versi v0.33 atau versi terbaru yang mendapat dukungan pengembangan. Add the following to your nu config file. Lokasi dari file ini dapat dicek dengan menjalankan `config path` pada nu.

View File

@ -224,7 +224,7 @@ format = '\[[$symbol($version)]($style)\]'
format = '\[[$symbol($version)]($style)\]'
[sudo]
format = '\[[as $symbol]\]
format = '\[[as $symbol]\]'
[swift]
format = '\[[$symbol($version)]($style)\]'

View File

@ -18,7 +18,7 @@ features:
footer: Licenza ISC | Copyright © 2019-present Starship Collaboratori
#Used for the description meta tag, for SEO
metaTitle: "Starship: Cross-Shell Prompt"
description: Starship è il prompt minimalista, super veloce ed estremamente personalizzabile per qualsiasi shell! Mostra le informazioni di cui hai bisogno, rimanendo elegante e minimale. Installazione rapida disponibile per Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh e PowerShell.
description: Starship è il prompt minimalista, super veloce ed estremamente personalizzabile per qualsiasi shell! Mostra le informazioni di cui hai bisogno, rimanendo elegante e minimale. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and PowerShell.
---
<div class="center">
@ -119,7 +119,7 @@ description: Starship è il prompt minimalista, super veloce ed estremamente per
#### Elvish
::: warning È supportato solo elvish v0.15 o superiore. :::
::: warning Only elvish v0.17 or higher is supported. :::
Aggiungi quanto segue alla fine di `~/.elvish/rc.elv`:
@ -164,3 +164,14 @@ description: Starship è il prompt minimalista, super veloce ed estremamente per
execx($(starship init xonsh))
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```

View File

@ -8,11 +8,35 @@ Le configurazioni in questa sezione sono soggette a modifiche nelle future versi
:::
## Comandi personalizzati di pre-prompt e pre-esecuzione per Bash
## Custom pre-prompt and pre-execution Commands in Cmd
Bash non ha un framework preexec/precmd formale come la maggior parte delle altre shell. Per questo motivo, è difficile fornire hook completamente personalizzabile in `bash`. Tuttavia, Starship dà la limitata possibilità di inserire le tue funzioni nella procedura prompt-rendering:
Clink provides extremely flexible APIs to run pre-prompt and pre-exec commands in Cmd shell. It is fairly simple to use with Starship. Make the following changes to your `starship.lua` file as per your requirements:
- Per eseguire una funzione personalizzata a destra del prompt prima che venga disegnato, definisci una nuova funzione e assegna il suo nome a `starship_precmd_user_func`. Per esempio, per visualizzare l'icona di un razzo prima del prompt, si può usare il codice seguente
- To run a custom function right before the prompt is drawn, define a new function called `starship_preprompt_user_func`. This function receives the current prompt as a string that you can utilize. For example, to draw a rocket before the prompt, you would do
```lua
function starship_preprompt_user_func(prompt)
print("🚀")
end
load(io.popen('starship init cmd'):read("*a"))()
```
- To run a custom function right before a command is executed, define a new function called `starship_precmd_user_func`. This function receives the current commandline as a string that you can utilize. For example, to print the command that's about to be executed, you would do
```lua
function starship_precmd_user_func(line)
print("Executing: "..line)
end
load(io.popen('starship init cmd'):read("*a"))()
```
## Custom pre-prompt and pre-execution Commands in Bash
Bash does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `bash`. Tuttavia, Starship dà la limitata possibilità di inserire le tue funzioni nella procedura prompt-rendering:
- To run a custom function right before the prompt is drawn, define a new function and then assign its name to `starship_precmd_user_func`. For example, to draw a rocket before the prompt, you would do
```bash
function blastoff(){
@ -21,14 +45,14 @@ function blastoff(){
starship_precmd_user_func="blastoff"
```
- Per eseguire una funzione personalizzata prima dell'esecuzione di un comando, è possibile utilizzare il meccanismo trappola [`DEBUG`](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). Tuttavia, **devi** intrappolare il segnale DEBUG *prima di* inizializzare Starship! Starship può preservare il valore trappola di DEBUG, ma se la trappola viene sovrascritta dopo l'avvio di Starship, alcune funzionalità non funzioneranno.
- To run a custom function right before a command runs, you can use the [`DEBUG` trap mechanism](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). However, you **must** trap the DEBUG signal *before* initializing Starship! Starship can preserve the value of the DEBUG trap, but if the trap is overwritten after starship starts up, some functionality will break.
```bash
function blastoff(){
echo "🚀"
}
trap blastoff DEBUG # Trap DEBUG *prima* di eseguire starship
eval $(starship bash)
trap blastoff DEBUG # Trap DEBUG *before* running starship
eval $(starship init bash)
```
## Custom pre-prompt and pre-execution Commands in PowerShell
@ -43,35 +67,35 @@ function Invoke-Starship-PreCommand {
}
```
## Cambia il titolo della finestra
## Change Window Title
Alcune shell prompt cambieranno automaticamente il titolo della finestra (ad esempio per riflettere la directory di lavoro). Fish lo fa per impostazione predefinita. Starship non lo fa, ma è abbastanza semplice aggiungere questa funzionalità a `bash` o `zsh`.
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash`, `zsh`, `cmd` or `powershell`.
Innanzitutto, bisogna definire una funzione per il cambio del titolo della finestra (identica sia per bash che zsh):
First, define a window title change function (identical in bash and zsh):
```bash
function set_win_title(){
echo -ne "\033]0; IL_TUO_TITOLO_QUI \007"
echo -ne "\033]0; YOUR_WINDOW_TITLE_HERE \007"
}
```
Puoi usare delle variabili per personalizzare questo titolo (`$USER`, `$HOSTNAME`, e `$PWD` sono le scelte più popolari).
You can use variables to customize this title (`$USER`, `$HOSTNAME`, and `$PWD` are popular choices).
In `bash`, impostare questa funzione per essere la precmd Starship function:
In `bash`, set this function to be the precmd starship function:
```bash
starship_precmd_user_func="set_win_title"
```
In `zsh`, aggiungi questo `precmd_functions` all'array:
In `zsh`, add this to the `precmd_functions` array:
```bash
precmd_functions+=(set_win_title)
```
Se ti piace il risultato, aggiungi queste righe al tuo file shell di configurazione (`~/.bashrc` o `~/.zshrc`) per renderlo permanente.
If you like the result, add these lines to your shell configuration file (`~/.bashrc` or `~/.zshrc`) to make it permanent.
Ad esempio, se desideri visualizzare la directory corrente nel titolo della scheda del terminale, aggiungi la seguente snippet al tuo `~/.bashrc` or `~/.zshrc`:
For example, if you want to display your current directory in your terminal tab title, add the following snippet to your `~/.bashrc` or `~/.zshrc`:
```bash
function set_win_title(){
@ -80,6 +104,16 @@ function set_win_title(){
starship_precmd_user_func="set_win_title"
```
For Cmd, you can change the window title using the `starship_preprompt_user_func` function.
```lua
function starship_preprompt_user_func(prompt)
console.settitle(os.getenv('USERNAME').."@"..os.getenv('COMPUTERNAME')..": "..os.getcwd())
end
load(io.popen('starship init cmd'):read("*a"))()
```
You can also set a similar output with PowerShell by creating a function named `Invoke-Starship-PreCommand`.
```powershell
@ -97,7 +131,7 @@ Some shells support a right prompt which renders on the same line as the input.
Note: The right prompt is a single line following the input location. To right align modules above the input line in a multi-line prompt, see the [fill module](/config/#fill).
`right_format` is currently supported for the following shells: elvish, fish, zsh.
`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd.
### Esempio
@ -117,10 +151,32 @@ Produces a prompt like the following:
▶ starship on  rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s
```
## Continuation Prompt
Some shells support a continuation prompt along with the normal prompt. This prompt is rendered instead of the normal prompt when the user has entered an incomplete statement (such as a single left parenthesis or quote).
Starship can set the continuation prompt using the `continuation_prompt` option. The default prompt is `"[∙](bright-black) "`.
Note: `continuation_prompt` should be set to a literal string without any variables.
Note: Continuation prompts are only available in the following shells:
- `bash`
- `zsh`
- `PowerShell`
### Esempio
```toml
# ~/.config/starship.toml
# A continuation prompt that displays two filled in arrows
continuation_prompt = "▶▶"
```
## Stile delle Stringhe
Le stringhe di stile sono un elenco di parole, separate da spazi bianchi. Le parole non sono sensibili alle maiuscole (cioè `grassetto` e `BoLd` sono considerate la stessa stringa). Ogni parola può essere una delle seguenti:
Style strings are a list of words, separated by whitespace. The words are not case sensitive (i.e. `bold` and `BoLd` are considered the same string). Each word can be one of the following:
- `bold`
- `italic`
@ -132,14 +188,14 @@ Le stringhe di stile sono un elenco di parole, separate da spazi bianchi. Le par
- `<color>`
- `none`
dove `<color>` è un colore specifico (discusso in seguito). `fg:<color>` e `<color>` attualmente fanno la stessa cosa, anche se questo potrebbe cambiare in futuro. `inverted` scambia lo sfondo e i colori in primo piano. L'ordine delle parole nella stringa non conta.
where `<color>` is a color specifier (discussed below). `fg:<color>` and `<color>` currently do the same thing, though this may change in the future. `inverted` swaps the background and foreground colors. The order of words in the string does not matter.
Il token `none` sovrascrive tutti gli altri token in una stringa se non fa parte di uno specificatore `bg:`, così ad esempio `fg:red none fg:blue` creerà una stringa senza stile. `bg:none` imposta come colore di sfondo quello predefinito così `fg:red bg:none` è equivalente a `red` o `fg:red` e `bg:green fg:red bg:none` è equivalente a `fg:red` o `red`. Potrà diventare un errore usare `none` in combinazione con altri token in futuro.
The `none` token overrides all other tokens in a string if it is not part of a `bg:` specifier, so that e.g. `fg:red none fg:blue` will still create a string with no styling. `bg:none` sets the background to the default color so `fg:red bg:none` is equivalent to `red` or `fg:red` and `bg:green fg:red bg:none` is also equivalent to `fg:red` or `red`. It may become an error to use `none` in conjunction with other tokens in the future.
Uno colore specifico può essere uno di questi:
A color specifier can be one of the following:
- Uno dei colori standard del terminale: `nero`, `rosso`, `verde`, `blu`, `giallo`, `viola`, `ciano`, `bianco`. Puoi eventualmente utilizzare il prefisso `bright-` per ottenere la versione luminosa (es. `bright-white`).
- Un `#` seguito da un valore esadecimale a sei cifre. Questo specifica un [colore esagesimale in RGB](https://www.w3schools.com/colors/colors_hexadecimal.asp).
- Un numero compreso tra 0-255. Specifica un [codice colore ANSI a 8 bit](https://i.stack.imgur.com/KTSQa.png).
- One of the standard terminal colors: `black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`. You can optionally prefix these with `bright-` to get the bright version (e.g. `bright-white`).
- A `#` followed by a six-digit hexadecimal number. This specifies an [RGB color hex code](https://www.w3schools.com/colors/colors_hexadecimal.asp).
- A number between 0-255. This specifies an [8-bit ANSI Color Code](https://i.stack.imgur.com/KTSQa.png).
Se sono specificati più colori per il primo piano/sfondo, l'ultimo nella stringa avrà la priorità.
If multiple colors are specified for foreground/background, the last one in the string will take priority.

View File

@ -24,18 +24,24 @@ disabled = true
È possibile modificare la posizione predefinita del file di configurazione con la variabile d'ambiente `STARSHIP_CONFIG`:
```sh
export STARSHIP_CONFIG=~/.starship/config.toml
export STARSHIP_CONFIG=~/example/non/default/path/starship.toml
```
Equivalentemente in PowerShell (Windows) potresti aggiungere questa riga al tuo `$PROFILE`:
```powershell
$ENV:STARSHIP_CONFIG = "$HOME\.starship\config.toml"
$ENV:STARSHIP_CONFIG = "$HOME\example\non\default\path\starship.toml"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CONFIG', 'C:\\Users\\user\\example\\non\\default\\path\\starship.toml')
```
### Logging
Per impostazione predefinita, starship salva i warning e gli errori in un file chiamato `~/.cache/starship/session_${STARSHIP_SESSION_KEY}. og`, dove la chiave di sessione è corrispondente a un'istanza del tuo terminale. Questo, tuttavia, può essere modificato utilizzando la variabile di ambiente `STARSHIP_CACHE`:
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
@ -47,23 +53,29 @@ Equivalentemente in PowerShell (Windows) potresti aggiungere questa riga al tuo
$ENV:STARSHIP_CACHE = "$HOME\AppData\Local\Temp"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CACHE', 'C:\\Users\\user\\AppData\\Local\\Temp')
```
### Terminologia
**Modulo**: Un componente nel prompt che dà informazioni basate su informazioni contestuali dal tuo sistema operativo. Ad esempio, il modulo "nodejs" mostra la versione di Node.js attualmente installata sul computer, se la directory corrente è un progetto Node.js.
**Module**: A component in the prompt giving information based on contextual information from your OS. For example, the "nodejs" module shows the version of Node.js that is currently installed on your computer, if your current directory is a Node.js project.
**Variable**: Sotto-componenti più piccoli che contengono informazioni fornite dal modulo. Per esempio, la variabile "version" nel modulo "nodejs" contiene la versione corrente di Node.js.
**Variable**: Smaller sub-components that contain information provided by the module. For example, the "version" variable in the "nodejs" module contains the current version of Node.js.
Per convenzione, la maggior parte dei moduli ha un prefisso di colore predefinito del terminale (ad esempio `via` in "nodejs") e uno spazio vuoto come suffisso.
By convention, most modules have a prefix of default terminal color (e.g. `via` in "nodejs") and an empty space as a suffix.
### Formato Stringhe
Le stringhe di formato sono il formato con cui un modulo stampa tutte le sue variabili. La maggior parte dei moduli ha una voce chiamata `formato` che configura il formato di visualizzazione del modulo. È possibile utilizzare testi, variabili e gruppi di testo in una stringa di formato.
Format strings are the format that a module prints all its variables with. Most modules have an entry called `format` that configures the display format of the module. You can use texts, variables and text groups in a format string.
#### Variable
Una variabile contiene un simbolo `$` seguito dal nome della variabile. The name of a variable can only contain letters, numbers and `_`.
A variable contains a `$` symbol followed by the name of the variable. The name of a variable can only contain letters, numbers and `_`.
Per esempio:
For example:
- `$version` è una stringa di formato con una variabile chiamata `version`.
- `$git_branch$git_commit` è una stringa di formato con due variabili denominate `git_branch` e `git_commit`.
@ -71,13 +83,13 @@ Per esempio:
#### Gruppo Testo
Un gruppo di testo è composto da due parti diverse.
A text group is made up of two different parts.
La prima parte, che è racchiusa tra `[]`, è una [format string](#format-strings). È possibile aggiungere testi, variabili o anche gruppi annidati di testo.
The first part, which is enclosed in a `[]`, is a [format string](#format-strings). You can add texts, variables, or even nested text groups in it.
Nella seconda parte, che è racchiusa tra `()`, è presente una [style string](#style-strings). Questa può essere usata per modificare lo stile della prima parte.
In the second part, which is enclosed in a `()`, is a [style string](#style-strings). This can be used to style the first part.
Per esempio:
For example:
- `[on](rosso grassetto)` stamperà una stringa `on` con testo in grassetto di colore rosso.
- `[⌘ $version](grassetto verde)` stamperà un simbolo `⌘` seguito dal contenuto della variabile `version`, con testo grassetto di colore verde.
@ -85,7 +97,7 @@ Per esempio:
#### Stile delle Stringhe
La maggior parte dei moduli in starship ti permettono di configurare i loro stili di visualizzazione. Questo viene fatto con una voce (solitamente chiamata `style`) che è una stringa che specifica la configurazione. Ecco alcuni esempi di stringhe di stile per quello che fanno. Per maggiori dettagli sulla sintassi completa, consulta la [guida di configurazione avanzata](/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"` imposta il testo verde su uno sfondo blu
- `"bg:blue fg:bright-green"` imposta un testo verde brillante su uno sfondo blu
@ -94,13 +106,13 @@ La maggior parte dei moduli in starship ti permettono di configurare i loro stil
- `"bold italic fg:purple"` imposta il testo viola in corsivo e grassetto
- `""` disabilita esplicitamente tutti gli stili
Nota che quello che assomiglia allo stile sarà controllato dal tuo emulatore terminale. Ad esempio, alcuni emulatori di terminale renderanno luminosi i colori invece del testo in grassetto, e alcuni temi colorati useranno gli stessi valori per i colori normali e luminosi. Inoltre, per ottenere il testo in corsivo, il tuo terminale deve supportare il corsivo.
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.
#### Formattazione condizionale delle stringhe
Una stringa di formato condizionale inserita in `(` e `)` non verrà presentata se tutte le variabili interne sono vuote.
A conditional format string wrapped in `(` and `)` will not render if all variables inside are empty.
Per esempio:
For example:
- `(@$region)` will show nothing if the variable `region` is `None` or empty string, otherwise `@` followed by the value of region.
- `(some text)` will always show nothing since there are no variables wrapped in the braces.
@ -425,13 +437,13 @@ By default it only changes color. If you also want to change its shape take a lo
::: warning
`error_symbol` is not supported on elvish and nu shell.
`error_symbol` is not supported on nu shell.
:::
::: warning
`vicmd_symbol` is only supported in fish and zsh.
`vicmd_symbol` is only supported in cmd, fish and zsh.
:::
@ -568,7 +580,7 @@ Bash users who need preexec-like functionality can use [rcaloras's bash_preexec
::: tip
Showing desktop notifications requires starship to be built with `rust-notify` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
Showing desktop notifications requires starship to be built with `notify-rust` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
:::
@ -713,20 +725,20 @@ format = "via [🔰 $version](bold red) "
## Deno
The `deno` module shows you your currently installed version of [Deno](https://deno.land/). By default the module will be shown if any of the following conditions are met:
- The current directory contains a `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
- The current directory contains a `deno.json`, `deno.jsonc`, `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
### Opzioni
| Opzione | Default | Descrizione |
| ------------------- | -------------------------------------------- | -------------------------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
| `version_format` | `"v${raw}"` | Il formato della versione. Le variabili disponibili sono `raw`, `major`, `minore`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Quali estensioni dovrebbero attivare questo modulo. |
| `detect_files` | `["mod.ts", "mod.js", "deps.ts", "deps.js"]` | Quali nomi di file dovrebbero attivare questo modulo. |
| `detect_folders` | `[]` | Quali cartelle dovrebbero attivare questo modulo. |
| `style` | `"green bold"` | Lo stile per il modulo. |
| `disabled` | `false` | Disables the `deno` module. |
| Opzione | Default | Descrizione |
| ------------------- | ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
| `version_format` | `"v${raw}"` | Il formato della versione. Le variabili disponibili sono `raw`, `major`, `minore`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Quali estensioni dovrebbero attivare questo modulo. |
| `detect_files` | `["deno.json", "deno.jsonc", "mod.ts", "mod.js", "deps.ts", "deps.js"]` | Quali nomi di file dovrebbero attivare questo modulo. |
| `detect_folders` | `[]` | Quali cartelle dovrebbero attivare questo modulo. |
| `style` | `"green bold"` | Lo stile per il modulo. |
| `disabled` | `false` | Disables the `deno` module. |
### Variables
@ -755,18 +767,19 @@ For example, given `~/Dev/Nix/nixpkgs/pkgs` where `nixpkgs` is the repo root, an
### Opzioni
| Opzione | Default | Descrizione |
| ------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `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)[$read_only]($read_only_style) "` | The format for the module. |
| `style` | `"bold cyan"` | Lo stile per il modulo. |
| `disabled` | `false` | Disables the `directory` module. |
| `read_only` | `"🔒"` | The symbol indicating current directory is read only. |
| `read_only_style` | `"red"` | The style for the read only symbol. |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | The symbol indicating home directory. |
| Opzione | Default | Descrizione |
| ------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `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)[$read_only]($read_only_style) "` | The format for the module. |
| `style` | `"bold cyan"` | Lo stile per il modulo. |
| `disabled` | `false` | Disables the `directory` module. |
| `read_only` | `"🔒"` | The symbol indicating current directory is read only. |
| `read_only_style` | `"red"` | The style for the read only symbol. |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | The symbol indicating home directory. |
| `use_os_path_sep` | `true` | Use the OS specific path seperator instead of always using `/` (e.g. `\` on Windows) |
<details>
<summary>This module has a few advanced configuration options that control how the directory is displayed.</summary>
@ -1334,22 +1347,23 @@ The `git_status` module shows symbols representing the state of the repo in your
### Opzioni
| Opzione | Default | Descrizione |
| ------------ | ----------------------------------------------- | ----------------------------------- |
| `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` |
| `style` | `"bold red"` | Lo stile per il modulo. |
| `disabled` | `false` | Disables the `git_status` module. |
| Opzione | Default | Descrizione |
| ------------------- | ----------------------------------------------- | ----------------------------------- |
| `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` |
| `style` | `"bold red"` | Lo stile per il modulo. |
| `ignore_submodules` | `false` | Ignore changes to submodules. |
| `disabled` | `false` | Disables the `git_status` module. |
### Variables
@ -1513,10 +1527,10 @@ The `hostname` module shows the system hostname.
### Variables
| Variable | Esempio | Descrizione |
| --------- | ------- | ------------------------------------ |
| symbol | | Mirrors the value of option `symbol` |
| style\* | | Mirrors the value of option `style` |
| Variable | Esempio | Descrizione |
| --------- | ---------- | ----------------------------------- |
| hostname | `computer` | The hostname of the computer |
| style\* | | Mirrors the value of option `style` |
\*: This variable can only be used as a part of a style string
@ -2133,7 +2147,7 @@ symbol = "☁️ "
## 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`, `composer`, `gradle`, `julia`, `mix`, `helm` and `shards` packages.
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`, `composer`, `gradle`, `julia`, `mix`, `helm`, `shards` 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
@ -2150,6 +2164,7 @@ The `package` module is shown when the current directory is the repository for a
- [**Shards**](https://crystal-lang.org/reference/the_shards_command/index.html) - The `shards` package version is extracted from the `shard.yml` present
- [**V**](https://vlang.io) - The `vlang` package version is extracted from the `v.mod` present
- [**SBT**](https://scala-sbt.org) - The `sbt` package version is extracted from the `build.sbt` present in the current directory
- [**Dart**](https://pub.dev/) - The `dart` package version is extracted from the `pubspec.yaml` present in the current directory
> ⚠️ The version being shown is that of the package whose source code is in your current directory, not your package manager.
@ -2673,6 +2688,8 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
| `elvish_indicator` | `esh` | A format string used to represent elvish. |
| `tcsh_indicator` | `tsh` | A format string used to represent tcsh. |
| `xonsh_indicator` | `xsh` | A format string used to represent xonsh. |
| `cmd_indicator` | `cmd` | A format string used to represent cmd. |
| `nu_indicator` | `nu` | A format string used to represent nu. |
| `unknown_indicator` | | The default value to be displayed when the shell is unknown. |
| `format` | `"[$indicator]($style) "` | The format for the module. |
| `style` | `"white bold"` | Lo stile per il modulo. |
@ -2778,7 +2795,7 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
:::
::: warning This module is not supported on elvish and nu shell. :::
::: warning This module is not supported on nu shell. :::
### Opzioni
@ -2804,6 +2821,7 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
| Variable | Esempio | Descrizione |
| -------------- | ------- | ------------------------------------------------------------------------------------------- |
| status | `127` | The exit code of the last command |
| hex_status | `0x7F` | The exit code of the last command in hex |
| int | `127` | The exit code of the last command |
| common_meaning | `ERROR` | Meaning of the code if not a signal |
| signal_number | `9` | Signal number corresponding to the exit code, only if signalled |

View File

@ -69,13 +69,13 @@ Se vedi simboli che non riconosci puoi usare `starship explain` per la spiegazio
You can enable the debug logs by using the `STARSHIP_LOG` env var. These logs can be very verbose so it is often useful to use the `module` command if you are trying to debug a particular module, for example, if you are trying to debug the `rust` module you could run the following command to get the trace logs and output from the module.
```sh
env STARHIP_LOG=trace starship module rust
env STARSHIP_LOG=trace starship module rust
```
If starship is being slow you can try using the `timings` command to see if there is a particular module or command that to blame.
```sh
env STARHIP_LOG=trace starship timings
env STARSHIP_LOG=trace starship timings
```
This will output the trace log and a breakdown of all modules that either took more than 1ms to execute or produced some output.
@ -117,6 +117,6 @@ Se Starship è stato installato utilizzando un gestore di pacchetti, fai riferim
Se Starship è stato installato utilizzando lo script di installazione, il seguente comando eliminerà il file binario:
```sh
# Individua ed elimina il binario di starship
sh -c 'rm "$(which starship)"'
# Locate and delete the starship binary
sh -c 'rm "$(command -v 'starship')"'
```

View File

@ -72,6 +72,22 @@
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-fr.png"
alt="Francese"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/id-ID/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-id.png"
alt="Bahasa Indonesia"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/it-IT/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-it.png"
alt="Italiano"
/></a>
&nbsp;
<a
@ -79,7 +95,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-jp.png"
alt="Giapponese"
alt="日本語"
/></a>
&nbsp;
<a
@ -87,7 +103,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-br.png"
alt="Portoghese del Brasile"
alt="Português do Brasil"
/></a>
&nbsp;
<a
@ -95,7 +111,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-ru.png"
alt="Russo"
alt="Русский"
/></a>
&nbsp;
<a
@ -103,7 +119,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-vn.png"
alt="Vietnamita"
alt="Tiếng Việt"
/></a>
&nbsp;
<a
@ -111,7 +127,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-cn.png"
alt="Cinese semplificato"
alt="简体中文"
/></a>
&nbsp;
<a
@ -119,7 +135,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-tw.png"
alt="Cinese tradizionale"
alt="繁體中文"
/></a>
</p>
@ -252,7 +268,7 @@
#### Elvish
**Attenzione** È supportato solo elvish v0.15 o superiore. Aggiungi quanto segue alla fine di `~/.elvish/rc.elv`:
**Warning** Only elvish v0.17 or higher is supported. Aggiungi quanto segue alla fine di `~/.elvish/rc.elv`:
```sh
# ~/.elvish/rc.elv
@ -283,6 +299,17 @@
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```
#### Nushell
**Warning** This will change in the future. È supportata solo la versione v0.33 o superiore. Add the following to your nu config file. Puoi controllare la posizione di questo file eseguendo `percorso di configurazione` in nu.

View File

@ -224,7 +224,7 @@ format = '\[[$symbol($version)]($style)\]'
format = '\[[$symbol($version)]($style)\]'
[sudo]
format = '\[[as $symbol]\]
format = '\[[as $symbol]\]'
[swift]
format = '\[[$symbol($version)]($style)\]'

View File

@ -18,7 +18,7 @@ features:
footer: ISC Licensed | Copyright © 2019-present Starship Contributors
#Used for the description meta tag, for SEO
metaTitle: "Starship: Cross-Shell Prompt"
description: Starship はミニマルで、非常に高速で、カスタマイズ性の高い、あらゆるシェルのためのプロンプトです! ミニマルかつ洗練された形で、あなたに必要な情報を表示します。 Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, and PowerShell.
description: Starship はミニマルで、非常に高速で、カスタマイズ性の高い、あらゆるシェルのためのプロンプトです! ミニマルかつ洗練された形で、あなたに必要な情報を表示します。 Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and PowerShell.
---
<div class="center">
@ -119,7 +119,7 @@ description: Starship はミニマルで、非常に高速で、カスタマイ
#### Elvish
::: warning elvish v0.15以上のみサポートされています。 :::
::: warning Only elvish v0.17 or higher is supported. :::
`~/.elvish/rc.elv` の最後に以下を追記してください。
@ -164,3 +164,14 @@ description: Starship はミニマルで、非常に高速で、カスタマイ
execx($(starship init xonsh))
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```

View File

@ -8,11 +8,35 @@ Starship は汎用性の高いシェルですが、時には特定の処理を
:::
## Bashのカスタムの事前プロンプトおよび事前実行コマンド
## Custom pre-prompt and pre-execution Commands in Cmd
Bashには、他のほとんどのシェルとは違い、正式な preexec / precmd フレームワークを持っていません。 そのため、 `bash`で完全にカスタマイズ可能なフックを提供することは困難です。 ただし、Starship はプロンプトを描画する一連の流れに、限定的に独自の関数を挿入することができます。
Clink provides extremely flexible APIs to run pre-prompt and pre-exec commands in Cmd shell. It is fairly simple to use with Starship. Make the following changes to your `starship.lua` file as per your requirements:
- 関数をプロンプトが描画される直前に実行するためには、新しい関数を定義して `starship_precmd_user_func` に割り当ててください。 例として、ロケットをプロンプトの前に表示させたければ、下記のようにしてください。
- To run a custom function right before the prompt is drawn, define a new function called `starship_preprompt_user_func`. This function receives the current prompt as a string that you can utilize. For example, to draw a rocket before the prompt, you would do
```lua
function starship_preprompt_user_func(prompt)
print("🚀")
end
load(io.popen('starship init cmd'):read("*a"))()
```
- To run a custom function right before a command is executed, define a new function called `starship_precmd_user_func`. This function receives the current commandline as a string that you can utilize. For example, to print the command that's about to be executed, you would do
```lua
function starship_precmd_user_func(line)
print("Executing: "..line)
end
load(io.popen('starship init cmd'):read("*a"))()
```
## Custom pre-prompt and pre-execution Commands in Bash
Bash does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `bash`. ただし、Starship はプロンプトを描画する一連の流れに、限定的に独自の関数を挿入することができます。
- To run a custom function right before the prompt is drawn, define a new function and then assign its name to `starship_precmd_user_func`. For example, to draw a rocket before the prompt, you would do
```bash
function blastoff(){
@ -21,13 +45,13 @@ function blastoff(){
starship_precmd_user_func="blastoff"
```
- コマンドの直前に関数を実行するために、[`DEBUG` トラップの仕組み](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/)を使うことができます。 しかし、Starship を初期化する前に DEBUG シグナルをトラップ*しなければいけません* Starship は DEBUGトラップの値を保護できますが、 starship の起動後にトラップが上書きされると、いくつかの機能は壊れてしまうでしょう。
- To run a custom function right before a command runs, you can use the [`DEBUG` trap mechanism](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). However, you **must** trap the DEBUG signal *before* initializing Starship! Starship can preserve the value of the DEBUG trap, but if the trap is overwritten after starship starts up, some functionality will break.
```bash
function blastoff(){
echo "🚀"
}
trap blastoff DEBUG # starshipを起動する前にDEBUGをトラップする
trap blastoff DEBUG # Trap DEBUG *before* running starship
eval $(starship init bash)
```
@ -43,11 +67,11 @@ function Invoke-Starship-PreCommand {
}
```
## ウィンドウのタイトルの変更
## Change Window Title
いくつかのシェルプロンプトはあなたのためにウィンドウのタイトルを自動的に変更します(例えば、カレントディレクトリを反映するために)。 特に Fish はデフォルトで変更を行います。 Starship はこれをしませんが、この機能を `bash``zsh` に追加することは簡単にできます。
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash`, `zsh`, `cmd` or `powershell`.
まず、ウィンドウのタイトルを変更する関数を定義してください( bash も zsh も同様に)
First, define a window title change function (identical in bash and zsh):
```bash
function set_win_title(){
@ -55,23 +79,23 @@ function set_win_title(){
}
```
タイトルをカスタマイズするために変数を利用することができます (`$USER` 、 `$HOSTNAME``$PWD` が一般的です)。
You can use variables to customize this title (`$USER`, `$HOSTNAME`, and `$PWD` are popular choices).
`bash` では関数を starship の precmd 関数としてセットしてください。
In `bash`, set this function to be the precmd starship function:
```bash
starship_precmd_user_func="set_win_title"
```
`zsh`では関数を `precmd_functions` の配列に追加してください。
In `zsh`, add this to the `precmd_functions` array:
```bash
precmd_functions+=(set_win_title)
```
もし結果に満足したら、永続化のためそれぞれの行をシェルの設定ファイル (`~/.bashrc` もしくは `~/.zshrc`) に追加してください。
If you like the result, add these lines to your shell configuration file (`~/.bashrc` or `~/.zshrc`) to make it permanent.
たとえば、現在のディレクトリをターミナルタブのタイトルに表示したい場合は、 `~/.bashrc`または`~/.zshrc`に以下のスニペットを追加します。
For example, if you want to display your current directory in your terminal tab title, add the following snippet to your `~/.bashrc` or `~/.zshrc`:
```bash
function set_win_title(){
@ -80,6 +104,16 @@ function set_win_title(){
starship_precmd_user_func="set_win_title"
```
For Cmd, you can change the window title using the `starship_preprompt_user_func` function.
```lua
function starship_preprompt_user_func(prompt)
console.settitle(os.getenv('USERNAME').."@"..os.getenv('COMPUTERNAME')..": "..os.getcwd())
end
load(io.popen('starship init cmd'):read("*a"))()
```
You can also set a similar output with PowerShell by creating a function named `Invoke-Starship-PreCommand`.
```powershell
@ -91,13 +125,13 @@ function Invoke-Starship-PreCommand {
Invoke-Expression (&starship init powershell)
```
## 右プロンプトの有効化
## Enable Right Prompt
シェルによっては、入力と同じ行にレンダリングされる右プロンプトをサポートしています。 Starship では `right_format` オプションを使って右プロンプトの内容を設定できます。 `format`で使用できるモジュールはすべて`right_format`でも使用できます。 変数`$all`には、`format`や`right_format`で明示的に使用されていないモジュールのみが格納されます。
Some shells support a right prompt which renders on the same line as the input. Starship can set the content of the right prompt using the `right_format` option. Any module that can be used in `format` is also supported in `right_format`. The `$all` variable will only contain modules not explicitly used in either `format` or `right_format`.
注意: 右プロンプトは入力の場所に続く単一の行です。 複数行のプロンプトで入力行の上を右寄せにするには、[fillモジュール](/config/#fill)を参照してください。
Note: The right prompt is a single line following the input location. To right align modules above the input line in a multi-line prompt, see the [fill module](/config/#fill).
`right_format` は現在、次のシェルでサポートされています: elvish, fish, zsh
`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd.
### 設定例
@ -111,16 +145,38 @@ format = """$character"""
right_format = """$all"""
```
次のようなプロンプトが生成されます:
Produces a prompt like the following:
```
▶ starship on  rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s
```
## Continuation Prompt
Some shells support a continuation prompt along with the normal prompt. This prompt is rendered instead of the normal prompt when the user has entered an incomplete statement (such as a single left parenthesis or quote).
Starship can set the continuation prompt using the `continuation_prompt` option. The default prompt is `"[∙](bright-black) "`.
Note: `continuation_prompt` should be set to a literal string without any variables.
Note: Continuation prompts are only available in the following shells:
- `bash`
- `zsh`
- `PowerShell`
### 設定例
```toml
# ~/.config/starship.toml
# A continuation prompt that displays two filled in arrows
continuation_prompt = "▶▶"
```
## スタイルの設定
スタイル文字列は空白で区切られた単語のリストです。 大文字小文字を区別しません(例えば、 `bold` と`BoLd` は同じだとみなされます)。 それぞれ以下のいずれか一つが該当します。
Style strings are a list of words, separated by whitespace. The words are not case sensitive (i.e. `bold` and `BoLd` are considered the same string). Each word can be one of the following:
- `bold`
- `italic`
@ -132,14 +188,14 @@ right_format = """$all"""
- `<color>`
- `none`
ここで、 `<color>` は色を指定します(以下で述べます)。 現在 `fg:<color>``<color>` は同様の動作ですが、将来変更される可能性があります。 `inverted` は背景と前景の色を交換します。 文字列中の単語の順序は関係ありません。
where `<color>` is a color specifier (discussed below). `fg:<color>` and `<color>` currently do the same thing, though this may change in the future. `inverted` swaps the background and foreground colors. The order of words in the string does not matter.
`none` トークンは、文字列中の`bg:` 指定子の一部でない場合、他のすべてのトークンをオーバーライドします。そのため、たとえば、`fg:red none fg:blue` と指定した場合、スタイルなしの文字列が作られます。 `bg:none` は背景色をデフォルトの色にセットするので、`fg:red bg:none` は `red``fg:red` と同じ意味になり、`bg:green fg:red bg:none` も `fg:red``red` と同じ意味になります。 将来 `none` を他の単語と一緒に使用することはエラーになるかもしれません。
The `none` token overrides all other tokens in a string if it is not part of a `bg:` specifier, so that e.g. `fg:red none fg:blue` will still create a string with no styling. `bg:none` sets the background to the default color so `fg:red bg:none` is equivalent to `red` or `fg:red` and `bg:green fg:red bg:none` is also equivalent to `fg:red` or `red`. It may become an error to use `none` in conjunction with other tokens in the future.
色は以下のいずれか1つを指定できます。
A color specifier can be one of the following:
- 標準的なターミナルカラーの `black``red``green``blue``yellow``purple``cyan``white`。 必要に応じて、より明るい色を得るために `bright-` を前につけることができます。(例えば、 `bright-white`
- `#` に続く16進数。 [RGB の16進数カラーコード](https://www.w3schools.com/colors/colors_hexadecimal.asp)を表します。
- 0-255 までの間の数字。 [8-bit ANSI カラーコード](https://i.stack.imgur.com/KTSQa.png) を表します。
- One of the standard terminal colors: `black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`. You can optionally prefix these with `bright-` to get the bright version (e.g. `bright-white`).
- A `#` followed by a six-digit hexadecimal number. This specifies an [RGB color hex code](https://www.w3schools.com/colors/colors_hexadecimal.asp).
- A number between 0-255. This specifies an [8-bit ANSI Color Code](https://i.stack.imgur.com/KTSQa.png).
複数の色が文字色/背景色に指定された際には、最後の指定が優先して選ばれます。
If multiple colors are specified for foreground/background, the last one in the string will take priority.

View File

@ -24,18 +24,24 @@ disabled = true
`STARSHIP_CONFIG` 環境変数を使用することによって、デフォルトの設定ファイルの場所を変更できます。
```sh
export STARSHIP_CONFIG=~/.starship/config.toml
export STARSHIP_CONFIG=~/example/non/default/path/starship.toml
```
PowerShell (Windows) で同様に `$PROFILE` にこの行を追加します。
```powershell
$ENV:STARSHIP_CONFIG = "$HOME\.starship\config.toml"
$ENV:STARSHIP_CONFIG = "$HOME\example\non\default\path\starship.toml"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CONFIG', 'C:\\Users\\user\\example\\non\\default\\path\\starship.toml')
```
### ロギング
デフォルトでは、Starship は警告やエラーログを `~/.cache/starship/session_${STARSHIP_SESSION_KEY}.log` という名前のファイルに出力します。このセッションキーはターミナルのインスタンスに相当します。 しかし、これは `STARSHIP_CACHE` という環境変数を使って変更できます:
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
@ -47,23 +53,29 @@ PowerShell (Windows) で同様に `$PROFILE` にこの行を追加します。
$ENV:STARSHIP_CACHE = "$HOME\AppData\Local\Temp"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CACHE', 'C:\\Users\\user\\AppData\\Local\\Temp')
```
### 用語
**モジュール**: OSのコンテキスト情報に基づいて情報を提供するプロンプト内のコンポーネントです。 例えば、現在のディレクトリが Node.js のプロジェクトの場合、現在コンピュータにインストールされている Node.js のバージョンが表示されます。
**Module**: A component in the prompt giving information based on contextual information from your OS. For example, the "nodejs" module shows the version of Node.js that is currently installed on your computer, if your current directory is a Node.js project.
**変数**: モジュールが提供する情報を含むサブコンポーネントを小さくする。 例えば、"nodejs" モジュールの "version" 変数には、Node.js の現在のバージョンが含まれています。
**Variable**: Smaller sub-components that contain information provided by the module. For example, the "version" variable in the "nodejs" module contains the current version of Node.js.
慣例により、ほとんどのモジュールにはデフォルトの端末色の接頭辞("nodejs" の `via` など)と接尾辞として空のスペースがあります。
By convention, most modules have a prefix of default terminal color (e.g. `via` in "nodejs") and an empty space as a suffix.
### 文字列のフォーマット
文字列の書式は、モジュールがすべての変数を出力する書式です。 ほとんどのモジュールには、モジュールの表示形式を設定する `format` というエントリがあります。 テキスト、変数、およびテキストグループをフォーマット文字列で使用できます。
Format strings are the format that a module prints all its variables with. Most modules have an entry called `format` that configures the display format of the module. You can use texts, variables and text groups in a format string.
#### 変数
変数には、 `$` 記号と、その変数の名前が続きます。 The name of a variable can only contain letters, numbers and `_`.
A variable contains a `$` symbol followed by the name of the variable. The name of a variable can only contain letters, numbers and `_`.
例:
For example:
- `$version` は、`version` という名前の変数を持つフォーマット文字列です。
- `$git_branch$git_commit``git_branch``git_commit` という2つの変数を持つフォーマット文字列です。
@ -71,13 +83,13 @@ $ENV:STARSHIP_CACHE = "$HOME\AppData\Local\Temp"
#### テキストグループ
テキストグループは二つの異なる部分で構成されています。
A text group is made up of two different parts.
`[]`で囲まれている最初の部分は、 [フォーマット文字列](#format-strings) です。 テキスト、変数、または入れ子になったテキストグループを追加できます。
The first part, which is enclosed in a `[]`, is a [format string](#format-strings). You can add texts, variables, or even nested text groups in it.
2 番目の部分では、 `()`で囲まれている [スタイル文字列](#style-strings) です。 This can be used to style the first part.
In the second part, which is enclosed in a `()`, is a [style string](#style-strings). This can be used to style the first part.
例:
For example:
- `[on](red bold)` は文字列 `on` に太字のテキストを赤色で表示します。
- `[⌘ $version](bold green)``⌘` 記号とその後に続く変数 `version` の値を、太字の緑色で表示します。
@ -85,7 +97,7 @@ $ENV:STARSHIP_CACHE = "$HOME\AppData\Local\Temp"
#### スタイルの設定
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"` は、青色の背景に明るい緑色のテキストを設定します
@ -94,13 +106,13 @@ 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.
#### 条件付きフォーマット設定
`(``)` 内のすべての変数が空の場合、条件付き書式文字列はレンダリングされません。
A conditional format string wrapped in `(` and `)` will not render if all variables inside are empty.
例:
For example:
- `(@$region)` は`region`が`None`または空だった場合表示されませんが、値がある場合は`@` に続いてregionの値が表示されます。
- `(some text)` は括弧の中に変数がないので、常に何も表示しません。
@ -112,18 +124,18 @@ The following symbols have special usage in a format string and must be escaped:
Note that TOML has [both basic strings and literal strings](https://toml.io/en/v1.0.0#string). It is recommended to use a literal string (surrounded by single quotes) in your config. If you want to use a basic string (surrounded by double quotes), you must escape the backslash itself (i.e. use `\\`).
例えば、新しい行に `$` 記号を表示したい場合、以下の `format` の設定が等価です。
For example, when you want to print a `$` symbol on a new line, the following configs for `format` are equivalent:
```toml
# 基本文字列と
# with basic string
format = "\n\\$"
# 複数行の基本文字列と
# with multiline basic string
format = """
\\$"""
# リテラル文字列と
# with literal string
format = '''
\$'''
@ -131,7 +143,7 @@ format = '''
## プロンプト
これは、プロンプト全体のオプションのリストです。
This is the list of prompt-wide configuration options.
### オプション
@ -149,23 +161,22 @@ format = '''
```toml
# ~/.config/starship.toml
# カスタムフォーマットを利用します
# Use custom format
format = """
[┌───────────────────>](bold green)
[](bold green)$directory$rust$package
[└─>](bold green) """
# starshipが現在のディレクトリ下のファイルをチェックするまで10ミリ秒待ちます
# Wait 10 milliseconds for starship to check files under the current directory.
scan_timeout = 10
# プロンプトの先頭の空行を無効にします
# Disable the blank line at the start of the prompt
add_newline = false
```
### デフォルトのプロンプトフォーマット
デフォルトの `format` は、空または `format` が指定されていない場合、プロンプトのフォーマットを定義するために使用されます。 デフォルトは次のとおりです。
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 = "$all"
@ -249,11 +260,11 @@ format="$all$directory$character"
## AWS
`aws` モジュールは現在のAWSプロファイルが表示されます。 これは `~/.aws/config` に記述されている `AWS_REGION`, `AWS_DEFAULT_REGION`, and `AWS_PROFILE` 環境変数に基づいています。 This module also shows an expiration timer when using temporary credentials.
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. This module also shows an expiration timer when using temporary credentials.
When using [aws-vault](https://github.com/99designs/aws-vault) the profile is read from the `AWS_VAULT` env var and the credentials expiration date is read from the `AWS_SESSION_EXPIRATION` env var.
[awsu](https://github.com/kreuzwerker/awsu) を使う場合、そのプロファイルは環境変数 `AWSU_PROFILE` から読まれます。
When using [awsu](https://github.com/kreuzwerker/awsu) the profile is read from the `AWSU_PROFILE` env var.
When using [AWSume](https://awsu.me) the profile is read from the `AWSUME_PROFILE` env var and the credentials expiration date is read from the `AWSUME_EXPIRATION` env var.
@ -348,7 +359,7 @@ style = "blue bold"
## バッテリー
`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%.
### オプション
@ -376,7 +387,7 @@ discharging_symbol = "💀 "
### バッテリーの表示
`display`オプションを使用して、バッテリーインジケーターを表示するタイミングthreshold、どのシンボルが使われるか(symbol) と外観styleを定義します。 `display` が提供されない場合、 デフォルトは次のとおりです。
The `display` configuration option is used to define when the battery indicator should be shown (threshold), which symbol would be used (symbol), and what it would like (style). If no `display` is provided. The default is as shown:
```toml
[[battery.display]]
@ -384,11 +395,11 @@ threshold = 10
style = "bold red"
```
`charging_symbol`と`discharging_symbol`オプションのデフォルト値はそれぞれ`battery`の `charging_symbol`と`discharging_symbol`になります。
The default value for the `charging_symbol` and `discharging_symbol` option is respectively the value of `battery`'s `charging_symbol` and `discharging_symbol` option.
#### オプション
`display`オプションは、次の表の通りです。
The `display` option is an array of the following table.
| オプション | デフォルト | 説明 |
| -------------------- | ---------- | -------------------------------------------------------------------------------------- |
@ -415,24 +426,24 @@ discharging_symbol = "💦"
## Character
`character`モジュールは、端末でテキストが入力される場所の横に文字(通常は矢印)を表示します。
The `character` module shows a character (usually an arrow) beside where the text is entered in your terminal.
文字は、最後のコマンドが成功したかどうかを示します。 表し方は下記の2つです。
The character will tell you whether the last command was successful or not. It can do this in two ways:
- 色の変更 (`赤`/`緑`)
- プロンプトの表示の変更 (``/`✖`)
デフォルトでは、色だけが変更されます。 形も変えてみたい場合は[このサンプル](#with-custom-error-shape)も参考にしてください。
By default it only changes color. If you also want to change its shape take a look at [this example](#with-custom-error-shape).
::: warning
`error_symbol`はelvishとnu shellでサポートされていません。
`error_symbol` is not supported on nu shell.
:::
::: warning
`vicmd_symbol`はfishとzshのみでサポートされています。
`vicmd_symbol` is only supported in cmd, fish and zsh.
:::
@ -485,7 +496,7 @@ vicmd_symbol = "[V](bold green) "
## CMake
`cmake`モジュールは、現在インストールされている[Cmake](https://cmake.org/)のバージョンを表示します。 デフォルトでは次のいずれかの条件が満たされると、モジュールがアクティブになります。
The `cmake` module shows the currently installed version of [CMake](https://cmake.org/). By default the module will be activated if any of the following conditions are met:
- カレントディレクトリに `CMakeLists.txt` ファイルが含まれている
- カレントディレクトリに `CMakeCache.txt` ファイルが含まれている
@ -515,7 +526,7 @@ vicmd_symbol = "[V](bold green) "
## COBOL / GNUCOBOL
`COBOL` モジュールは、現在インストールされているCOBOLのバージョンを表示します。 By default, the module will be shown if any of the following conditions are met:
The `cobol` module shows the currently installed version of COBOL. By default, the module will be shown if any of the following conditions are met:
- The current directory contains any files ending in `.cob` or `.COB`
- The current directory contains any files ending in `.cbl` or `.CBL`
@ -545,15 +556,15 @@ vicmd_symbol = "[V](bold green) "
## Command Duration
`cmd_duration`モジュールは、最後のコマンドの実行にかかった時間を示します。 モジュールが表示されるのは、コマンドが2秒以上かかった場合、または`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トラップをhookしない
::: warning Do not hook the DEBUG trap in Bash
`bash`でStarshipを実行している場合、 `eval $(starship init $0)`実行した後に`DEBUG`トラップをフックしないでください。そうしないと、このモジュールが**おそらくですが**壊れます。
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.
### オプション
@ -569,7 +580,7 @@ preexecのような機能を必要とするBashユーザーは、 [rcalorasのba
::: tip
デスクトップ通知を表示するには、 `rust-notify` をサポートしているstarshipをビルドする必要があります。 `show_notifications``true` となっている状態で `STARSHIP_LOG=debug starship module cmd_duration -d 60000` を実行することにより、starshipが通知をサポートしているかを確認することができます。
Showing desktop notifications requires starship to be built with `notify-rust` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
:::
@ -598,7 +609,7 @@ The `conda` module shows the current [Conda](https://docs.conda.io/en/latest/) e
::: tip
Note: これはconda自身の プロンプト修飾子 を抑制しません。`conda config --set changeps1 False` で実行することができます。
This does not suppress conda's own prompt modifier, you may want to run `conda config --set changeps1 False`.
:::
@ -634,7 +645,7 @@ format = "[$symbol$environment](dimmed green) "
## Crystal
`crystal`モジュールは、現在インストールされている[Crystal](https://crystal-lang.org/)のバージョンを表示します。 デフォルトでは次の条件のいずれかが満たされると、モジュールが表示されます。
The `crystal` module shows the currently installed version of [Crystal](https://crystal-lang.org/). デフォルトでは次の条件のいずれかが満たされると、モジュールが表示されます。
- カレントディレクトリに`shard.yml`ファイルが含まれている
- カレントディレクトリに`.cr`の拡張子のファイルが含まれている
@ -673,7 +684,7 @@ format = "via [✨ $version](bold blue) "
## Dart
`dart`モジュールは、現在インストールされている[Dart](https://dart.dev/)のバージョンを表示します。 デフォルトでは次の条件のいずれかが満たされると、モジュールが表示されます。
The `dart` module shows the currently installed version of [Dart](https://dart.dev/). デフォルトでは次の条件のいずれかが満たされると、モジュールが表示されます。
- カレントディレクトリに`.dart`の拡張子のファイルが含まれている
- カレントディレクトリに`.dart_tool`ディレクトリが含まれている
@ -713,21 +724,21 @@ format = "via [🔰 $version](bold red) "
## Deno
`deno`モジュールは、現在インストールされている[Deno](https://deno.land/)のバージョンを表示します。 デフォルトでは次の条件のいずれかが満たされると、モジュールが表示されます。
- カレントディレクトリに`mod.ts`、`mod.js`、`deps.ts`か`deps.js`が含まれている
The `deno` module shows you your currently installed version of [Deno](https://deno.land/). デフォルトでは次の条件のいずれかが満たされると、モジュールが表示されます。
- The current directory contains a `deno.json`, `deno.jsonc`, `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
### オプション
| オプション | デフォルト | 説明 |
| ------------------- | -------------------------------------------- | ------------------------------------------------------ |
| `format` | `"via [$symbol($version )]($style)"` | moduleのフォーマットです。 |
| `version_format` | `"v${raw}"` | バージョンのフォーマット。 使用可能な変数は`raw`、`major`、`minor`と`patch`です。 |
| `symbol` | `"🦕 "` | Dart のシンボルを表すフォーマット文字列 |
| `detect_extensions` | `[]` | どの拡張子がこのモジュールをアクティブにするか |
| `detect_files` | `["mod.ts", "mod.js", "deps.ts", "deps.js"]` | どのファイル名がこのモジュールをアクティブにするか |
| `detect_folders` | `[]` | どのフォルダーがこのモジュールをアクティブにするか |
| `style` | `"green bold"` | モジュールのスタイルです。 |
| `disabled` | `false` | `deno`モジュールを無効化します。 |
| オプション | デフォルト | 説明 |
| ------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------ |
| `format` | `"via [$symbol($version )]($style)"` | moduleのフォーマットです。 |
| `version_format` | `"v${raw}"` | バージョンのフォーマット。 使用可能な変数は`raw`、`major`、`minor`と`patch`です。 |
| `symbol` | `"🦕 "` | Dart のシンボルを表すフォーマット文字列 |
| `detect_extensions` | `[]` | どの拡張子がこのモジュールをアクティブにするか |
| `detect_files` | `["deno.json", "deno.jsonc", "mod.ts", "mod.js", "deps.ts", "deps.js"]` | どのファイル名がこのモジュールをアクティブにするか |
| `detect_folders` | `[]` | どのフォルダーがこのモジュールをアクティブにするか |
| `style` | `"green bold"` | モジュールのスタイルです。 |
| `disabled` | `false` | `deno`モジュールを無効化します。 |
### 変数
@ -748,29 +759,30 @@ format = "via [🦕 $version](green bold) "
## Directory
`directory`モジュールには、現在のディレクトリへのパスが表示され、3つの親フォルダは切り捨てられます。 ディレクトリは、現在の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`に設定されている場合を挙げます。 以前は`nixpkgs/pkgs`でしたが、`~/D/N/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)[$read_only]($read_only_style) "` | moduleのフォーマットです。 |
| `style` | `"bold cyan"` | モジュールのスタイルです。 |
| `disabled` | `false` | `directory`モジュールを無効にします。 |
| `read_only` | `"🔒"` | このシンボルが表示されている時、現在のディレクトリは読み取り専用です。 |
| `read_only_style` | `"red"` | 読み取り専用シンボルのスタイルです。 |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. 例: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | ホームディレクトリを示すシンボルです。 |
| オプション | デフォルト | 説明 |
| ------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `truncation_length` | `3` | 現在のディレクトリを切り捨てる親フォルダーの数です。 |
| `truncate_to_repo` | `true` | 現在いるgitリポジトリのルートに切り捨てるかどうかです。 |
| `format` | `"[$path]($style)[$read_only]($read_only_style) "` | moduleのフォーマットです。 |
| `style` | `"bold cyan"` | モジュールのスタイルです。 |
| `disabled` | `false` | `directory`モジュールを無効にします。 |
| `read_only` | `"🔒"` | このシンボルが表示されている時、現在のディレクトリは読み取り専用です。 |
| `read_only_style` | `"red"` | 読み取り専用シンボルのスタイルです。 |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. 例: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | ホームディレクトリを示すシンボルです。 |
| `use_os_path_sep` | `true` | Use the OS specific path seperator instead of always using `/` (e.g. `\` on Windows) |
<details>
<summary>このモジュールは、どのようにディレクトリを表示するかについての高度なオプションをいくつか持っています。</summary>
<summary>This module has a few advanced configuration options that control how the directory is displayed.</summary>
| Advanced Option | デフォルト | 説明 |
| --------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@ -847,9 +859,9 @@ format = "via [🐋 $context](blue bold)"
## Dotnet
`dotnet`モジュールはカレントディレクトリに関係する[.NET Core SDK](https://dotnet.microsoft.com/)のバージョンを表示します。 もし SDKは現在のディレクトリに固定されているのであれば、その固定されたバージョンが表示されます。 それ以外の場合、モジュール SDKの最新のインストールバージョンを示します。
The `dotnet` module shows the relevant version of the [.NET Core SDK](https://dotnet.microsoft.com/) 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.
デフォルトでは、このモジュールは現在のディレクトリに以下のファイルが 存在する場合にのみプロンプトで表示されます:
By default this module will only be shown in your prompt when one or more of the following files are present in the current directory:
- `global.json`
- `project.json`
@ -862,7 +874,7 @@ format = "via [🐋 $context](blue bold)"
You'll also need the .NET Core SDK installed in order to use it correctly.
内部的に、このモジュールは自身のバージョン検知のメカニズムを利用します。 `dotnet --version` を実行するより2倍速く実行できますが、.NET project一般的でないディレクトリlayoutの場合は間違ったバージョンが示されてしまうことがあります。 速度よりも精度が重要な場合は、次の方法でメカニズムを無効にできます。 モジュールオプションで`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.
@ -985,7 +997,7 @@ format = "via [ $version](cyan bold) "
## Environment Variable
The `env_var` module displays the current value of a selected environment variables. 次の条件のいずれかが満たされると、モジュールが表示されます。
The `env_var` module displays the current value of a selected environment variables. The module will be shown only if any of the following conditions are met:
- `variable`オプションが、既存の環境変数と一致する
- `variable`オプションが定義されておらず、`default`オプションが定義されている
@ -1084,7 +1096,7 @@ format = "via [e $version](bold red) "
## Fill
`fill` モジュールは行の余分なスペースを記号で埋めます。 一行に複数の`fill`モジュールが存在する場合、それらはスペースを均等に分割します。 これは、他のモジュールの位置合わせに便利です。
The `fill` module fills any extra space on the line with a symbol. If multiple `fill` modules are present in a line they will split the space evenly between them. This is useful for aligning other modules.
### オプション
@ -1114,7 +1126,7 @@ AA -------------------------------------------- BB -----------------------------
## Google Cloud (`gcloud`)
`gcloud` モジュールは、 [`gcloud`](https://cloud.google.com/sdk/gcloud) CLIの現在の設定が表示されます。 これは `~/.config/gcloud/active_config` ファイルと `~/.config/gcloud/configurations/config_{CONFIG NAME}` ファイルと `CLOUDSDK_CONFIG` 環境変数に基づきます。
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.
### オプション
@ -1175,7 +1187,7 @@ asia-northeast1 = "an1"
## Git Branch
`git_branch`モジュールは、現在のディレクトリにあるリポジトリのアクティブなブランチを表示します。
The `git_branch` module shows the active branch of the repo in your current directory.
### オプション
@ -1215,7 +1227,7 @@ truncation_symbol = ""
## Git Commit
`git_commit` モジュールは、カレントディレクトリのリポジトリの現在のコミットハッシュとタグ (もしあれば) を表示します。
The `git_commit` module shows the current commit hash and also the tag (if any) of the repo in your current directory.
### オプション
@ -1250,7 +1262,7 @@ tag_symbol = "🔖 "
## 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.
### オプション
@ -1294,7 +1306,7 @@ The `git_metrics` module will show the number of added and deleted lines in the
::: tip
このモジュールはデフォルトで無効になっています。 有効にするには、設定ファイルで`disabled`を`false`に設定します。
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -1331,30 +1343,31 @@ format = '[+$added]($added_style)/[-$deleted]($deleted_style) '
## Git Status
`git_status`モジュールは、現在のディレクトリのリポジトリの状態を表すシンボルを表示します。
The `git_status` module shows symbols representing the state of the repo in your current directory.
### オプション
| オプション | デフォルト | 説明 |
| ------------ | ----------------------------------------------- | -------------------------- |
| `format` | `'([\[$all_status$ahead_behind\]]($style) )'` | `git_status` のデフォルトフォーマット |
| `conflicted` | `"="` | このブランチにはマージの競合があります。 |
| `ahead` | `"⇡"` | `ahead`のフォーマット |
| `behind` | `"⇣"` | `behind`のフォーマット |
| `diverged` | `"⇕"` | `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` |
| `style` | `"bold red"` | モジュールのスタイルです。 |
| `disabled` | `false` | `git_status`モジュールを無効にします。 |
| オプション | デフォルト | 説明 |
| ------------------- | ----------------------------------------------- | --------------------------------- |
| `format` | `'([\[$all_status$ahead_behind\]]($style) )'` | `git_status` のデフォルトフォーマット |
| `conflicted` | `"="` | このブランチにはマージの競合があります。 |
| `ahead` | `"⇡"` | `ahead`のフォーマット |
| `behind` | `"⇣"` | `behind`のフォーマット |
| `diverged` | `"⇕"` | `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` |
| `style` | `"bold red"` | モジュールのスタイルです。 |
| `ignore_submodules` | `false` | Ignore changes to submodules. |
| `disabled` | `false` | Disables the `git_status` module. |
### 変数
` format` 内では以下の変数が利用できます。
The following variables can be used in `format`:
| 変数 | 説明 |
| -------------- | ------------------------------------------------------------------------------------------------------------- |
@ -1500,7 +1513,7 @@ format = "via [⎈ $version](bold white) "
## Hostname
`hostname`モジュールには、システムのホスト名が表示されます。
The `hostname` module shows the system hostname.
### オプション
@ -1514,10 +1527,10 @@ format = "via [⎈ $version](bold white) "
### 変数
| 変数 | 設定例 | 説明 |
| --------- | --- | ---------------------- |
| symbol | | オプション `記号` の値をミラーする |
| style\* | | オプション `style` の値をミラーする |
| 変数 | 設定例 | 説明 |
| --------- | ---------- | ---------------------------- |
| hostname | `computer` | The hostname of the computer |
| style\* | | オプション `style` の値をミラーする |
\*: この変数はスタイル文字列の一部としてのみ使用できます
@ -1574,7 +1587,7 @@ symbol = "🌟 "
## ジョブ
`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 `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.
The default functionality is:
@ -1672,7 +1685,7 @@ symbol = "∴ "
## Kotlin
`kotlin`モジュールは、現在インストールされている[Kotlin](https://kotlinlang.org/)のバージョンを表示します。 デフォルトでは次の条件のいずれかが満たされると、モジュールが表示されます。
The `kotlin` module shows the currently installed version of [Kotlin](https://kotlinlang.org/). デフォルトでは次の条件のいずれかが満たされると、モジュールが表示されます。
- カレントディレクトリに`.kt`もしくは`.kts`ファイルが含まれている
@ -1713,17 +1726,17 @@ symbol = "🅺 "
# ~/.config/starship.toml
[kotlin]
# Kotlinコンパイラバイナリを使用してバージョンを確認する
# Uses the Kotlin Compiler binary to get the installed version
kotlin_binary = "kotlinc"
```
## Kubernetes
Displays the current [Kubernetes context](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#context) name and, if set, the namespace from the kubeconfig file. namespace は kubconfigで設定する必要があります。設定は、`kubectl config set-context starship-cluster --namespace astronaut` といったコマンド行えます。 `$KUBECONFIG` 環境変数が設定されている場合、このモジュールは環境変数を優先して使用し、`~/.kube/config` は使用しません。
Displays the current [Kubernetes context](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#context) name and, if set, the namespace from the kubeconfig file. The namespace needs to be set in the kubeconfig file, this can be done via `kubectl config set-context starship-cluster --namespace astronaut`. If the `$KUBECONFIG` env var is set the module will use that if not it will use the `~/.kube/config`.
::: tip
このモジュールはデフォルトで無効になっています。 有効にするには、設定ファイルで`disabled`を`false`に設定します。
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -1785,7 +1798,7 @@ Long and automatically generated cluster names can be identified and shortened u
## Line Break
`line_break`モジュールは、プロンプトを2行に分割します。
The `line_break` module separates the prompt into two lines.
### オプション
@ -1845,14 +1858,13 @@ format = "via [🌕 $version](bold blue) "
## メモリ使用量
`memory_usage</ 0>モジュールは、現在のシステムメモリとスワップ使用量を示します。</p>
The `memory_usage` module shows current system memory and swap usage.
<p spaces-before="0">デフォルトでは、システムスワップの合計がゼロ以外の場合、スワップ使用量が表示されます。</p>
By default the swap usage is displayed if the total system swap is non-zero.
<p spaces-before="0">::: tip</p>
::: tip
<p spaces-before="0">このモジュールはデフォルトで無効になっています。
有効にするには、設定ファイルで<code>disabled`を`false`に設定します。
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -1893,7 +1905,7 @@ style = "bold dimmed green"
## Mercurial Branch
` hg_branch `モジュールは、現在のディレクトリにあるリポジトリのアクティブなブランチを示します。
The `hg_branch` module shows the active branch of the repo in your current directory.
### オプション
@ -1971,7 +1983,7 @@ symbol = "🎣 "
## Nix-shell
The `nix_shell` module shows the [nix-shell](https://nixos.org/guides/nix-pills/developing-with-nix-shell.html) environment. このモジュールは、nixシェル環境内にあるときに表示されます。
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.
### オプション
@ -2135,7 +2147,7 @@ symbol = "☁️ "
## パッケージのバージョン
`package`モジュールは、現在のディレクトリがパッケージのリポジトリである場合に表示され、現在のバージョンが表示されます。 The module currently supports `npm`, `nimble`, `cargo`, `poetry`, `composer`, `gradle`, `julia`, `mix`, `helm` and `shards` packages.
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`, `composer`, `gradle`, `julia`, `mix`, `helm`, `shards` 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
@ -2152,6 +2164,7 @@ symbol = "☁️ "
- [**Shards**](https://crystal-lang.org/reference/the_shards_command/index.html) - The `shards` package version is extracted from the `shard.yml` present
- [**V**](https://vlang.io) - The `vlang` package version is extracted from the `v.mod` present
- [**SBT**](https://scala-sbt.org) - The `sbt` package version is extracted from the `build.sbt` present in the current directory
- [**Dart**](https://pub.dev/) - The `dart` package version is extracted from the `pubspec.yaml` present in the current directory
> ⚠️ 表示されるバージョンは、パッケージマネージャーではなく、ソースコードが現在のディレクトリにあるパッケージのバージョンです。
@ -2365,7 +2378,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.
`pyenvversionname``true` に設定されている場合 、pyenv でのバージョン名が表示されます 。 そうでなければ、`python --version` を元にバージョン番号を表示します。
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`.
デフォルトでは次の条件のいずれかが満たされると、モジュールが表示されます。
@ -2532,7 +2545,7 @@ symbol = "🔴 "
## Ruby
デフォルトでは`ruby`モジュールは現在インストールされている[Ruby](https://www.ruby-lang.org/)のバージョンを表示します。 次の条件のいずれかが満たされると、モジュールが表示されます:
By default the `ruby` module shows the currently installed version of [Ruby](https://www.ruby-lang.org/). 次の条件のいずれかが満たされると、モジュールが表示されます:
- カレントディレクトリに`Gemfile`ファイルが含まれている
- カレントディレクトリに `.ruby-version` ファイルが含まれている
@ -2576,7 +2589,7 @@ symbol = "🔺 "
## Rust
デフォルトでは`rust`モジュールは現在インストールされている[Rust](https://www.rust-lang.org/)のバージョンを表示します。 次の条件のいずれかが満たされると、モジュールが表示されます:
By default the `rust` module shows the currently installed version of [Rust](https://www.rust-lang.org/). 次の条件のいずれかが満たされると、モジュールが表示されます:
- カレントディレクトリに`Cargo.toml`ファイルが含まれている
- カレントディレクトリに`.rs`の拡張子のファイルが含まれている
@ -2659,7 +2672,7 @@ The `shell` module shows an indicator for currently used shell.
::: tip
このモジュールはデフォルトで無効になっています。 有効にするには、設定ファイルで`disabled`を`false`に設定します。
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -2675,6 +2688,8 @@ The `shell` module shows an indicator for currently used shell.
| `elvish_indicator` | `esh` | A format string used to represent elvish. |
| `tcsh_indicator` | `tsh` | A format string used to represent tcsh. |
| `xonsh_indicator` | `xsh` | A format string used to represent xonsh. |
| `cmd_indicator` | `cmd` | A format string used to represent cmd. |
| `nu_indicator` | `nu` | A format string used to represent nu. |
| `unknown_indicator` | | The default value to be displayed when the shell is unknown. |
| `format` | `"[$indicator]($style) "` | moduleのフォーマットです。 |
| `style` | `"white bold"` | モジュールのスタイルです。 |
@ -2776,11 +2791,11 @@ The `status` module displays the exit code of the previous command. The module w
::: tip
このモジュールはデフォルトで無効になっています。 有効にするには、設定ファイルで`disabled`を`false`に設定します。
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
::: warning This module is not supported on elvish and nu shell. :::
::: warning This module is not supported on nu shell. :::
### オプション
@ -2806,6 +2821,7 @@ The `status` module displays the exit code of the previous command. The module w
| 変数 | 設定例 | 説明 |
| -------------- | ------- | ------------------------------------------------------------------------------------------- |
| status | `127` | The exit code of the last command |
| hex_status | `0x7F` | The exit code of the last command in hex |
| int | `127` | The exit code of the last command |
| common_meaning | `ERROR` | Meaning of the code if not a signal |
| signal_number | `9` | Signal number corresponding to the exit code, only if signalled |
@ -2838,7 +2854,7 @@ The `sudo` module displays if sudo credentials are currently cached. The module
::: tip
このモジュールはデフォルトで無効になっています。 有効にするには、設定ファイルで`disabled`を`false`に設定します。
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -2982,11 +2998,11 @@ format = "[🏎💨 $workspace]($style) "
## Time
`time`モジュールは、現在の**現地**時間を示します。 `format`設定は、時間の表示方法を制御するために[`chrono`](https://crates.io/crates/chrono)クレートによって使用されます。 使用可能なオプションを確認するには、[chrono strftimeのドキュメント](https://docs.rs/chrono/0.4.7/chrono/format/strftime/index.html)をご覧ください。
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.
::: tip
このモジュールはデフォルトで無効になっています。 有効にするには、設定ファイルで`disabled`を`false`に設定します。
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -3002,7 +3018,7 @@ format = "[🏎💨 $workspace]($style) "
| `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"`. それ以外の場合、デフォルトは`"%T"`です。 Manually setting `time_format` will override the `use_12hr` setting.
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.
### 変数
@ -3028,7 +3044,7 @@ time_range = "10:00:00-14:00:00"
## ユーザー名
`username`モジュールには、アクティブなユーザーのユーザー名が表示されます。 次の条件のいずれかが満たされると、モジュールが表示されます:
The `username` module shows active user's username. 次の条件のいずれかが満たされると、モジュールが表示されます:
- カレントユーザーがroot
- カレントユーザーが、ログインしているユーザーとは異なる

View File

@ -69,13 +69,13 @@ Starship executes different commands to get information to display in the prompt
You can enable the debug logs by using the `STARSHIP_LOG` env var. These logs can be very verbose so it is often useful to use the `module` command if you are trying to debug a particular module, for example, if you are trying to debug the `rust` module you could run the following command to get the trace logs and output from the module.
```sh
env STARHIP_LOG=trace starship module rust
env STARSHIP_LOG=trace starship module rust
```
If starship is being slow you can try using the `timings` command to see if there is a particular module or command that to blame.
```sh
env STARHIP_LOG=trace starship timings
env STARSHIP_LOG=trace starship timings
```
This will output the trace log and a breakdown of all modules that either took more than 1ms to execute or produced some output.
@ -117,6 +117,6 @@ Starship がパッケージマネージャを使用してインストールさ
Starship をインストールスクリプトを使用してインストールした場合、次のコマンドでバイナリが削除されます。
```sh
# starshipバイナリを見つけて削除
sh -c 'rm "$(which starship)"''
# Locate and delete the starship binary
sh -c 'rm "$(command -v 'starship')"'
```

View File

@ -72,6 +72,22 @@
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-fr.png"
alt="Français"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/id-ID/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-id.png"
alt="Bahasa Indonesia"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/it-IT/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-it.png"
alt="Italiano"
/></a>
&nbsp;
<a
@ -252,7 +268,7 @@
#### Elvish
**警告** elvish v0.15 以上のみがサポートされています。 `~/.elvish/rc.elv` の最後に以下を追記してください。
**Warning** Only elvish v0.17 or higher is supported. `~/.elvish/rc.elv` の最後に以下を追記してください。
```sh
# ~/.elvish/rc.elv
@ -283,9 +299,20 @@
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```
#### Nushell
**警告** これは将来的に変更されます。 nu バージョン 0.33 以降のみサポートされます。 nu 設定ファイルに以下を追加してください。 nu で`config path`を実行することで、設定ファイルの場所を確認できます。
**Warning** This will change in the future. nu バージョン 0.33 以降のみサポートされます。 Add the following to your nu config file. nu で`config path`を実行することで、設定ファイルの場所を確認できます。
```toml
startup = [

View File

@ -224,7 +224,7 @@ format = '\[[$symbol($version)]($style)\]'
format = '\[[$symbol($version)]($style)\]'
[sudo]
format = '\[[as $symbol]\]
format = '\[[as $symbol]\]'
[swift]
format = '\[[$symbol($version)]($style)\]'

View File

@ -18,7 +18,7 @@ features:
footer: ISC Licensed | Copyright © 2019-present Starship Contributors
#Used for the description meta tag, for SEO
metaTitle: "Starship: Cross-Shell Prompt"
description: Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the information you need, while staying sleek and minimal. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, and PowerShell.
description: Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the information you need, while staying sleek and minimal. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and PowerShell.
---
<div class="center">
@ -119,7 +119,7 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
#### Elvish
::: 주의 elvish v0.15 이상만 지원. :::
::: warning Only elvish v0.17 or higher is supported. :::
아래의 라인을 `~/.elvish/rc.elv` 마지막에 추가:
@ -164,3 +164,14 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
execx($(starship init xonsh))
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```

View File

@ -8,6 +8,30 @@ The configurations in this section are subject to change in future releases of S
:::
## Custom pre-prompt and pre-execution Commands in Cmd
Clink provides extremely flexible APIs to run pre-prompt and pre-exec commands in Cmd shell. It is fairly simple to use with Starship. Make the following changes to your `starship.lua` file as per your requirements:
- To run a custom function right before the prompt is drawn, define a new function called `starship_preprompt_user_func`. This function receives the current prompt as a string that you can utilize. For example, to draw a rocket before the prompt, you would do
```lua
function starship_preprompt_user_func(prompt)
print("🚀")
end
load(io.popen('starship init cmd'):read("*a"))()
```
- To run a custom function right before a command is executed, define a new function called `starship_precmd_user_func`. This function receives the current commandline as a string that you can utilize. For example, to print the command that's about to be executed, you would do
```lua
function starship_precmd_user_func(line)
print("Executing: "..line)
end
load(io.popen('starship init cmd'):read("*a"))()
```
## Custom pre-prompt and pre-execution Commands in Bash
Bash does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `bash`. However, Starship does give you limited ability to insert your own functions into the prompt-rendering procedure:
@ -45,7 +69,7 @@ function Invoke-Starship-PreCommand {
## Change Window Title
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash` or `zsh`.
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash`, `zsh`, `cmd` or `powershell`.
First, define a window title change function (identical in bash and zsh):
@ -80,6 +104,16 @@ function set_win_title(){
starship_precmd_user_func="set_win_title"
```
For Cmd, you can change the window title using the `starship_preprompt_user_func` function.
```lua
function starship_preprompt_user_func(prompt)
console.settitle(os.getenv('USERNAME').."@"..os.getenv('COMPUTERNAME')..": "..os.getcwd())
end
load(io.popen('starship init cmd'):read("*a"))()
```
You can also set a similar output with PowerShell by creating a function named `Invoke-Starship-PreCommand`.
```powershell
@ -97,7 +131,7 @@ Some shells support a right prompt which renders on the same line as the input.
Note: The right prompt is a single line following the input location. To right align modules above the input line in a multi-line prompt, see the [fill module](/config/#fill).
`right_format` is currently supported for the following shells: elvish, fish, zsh.
`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd.
### Example
@ -117,6 +151,28 @@ Produces a prompt like the following:
▶ starship on  rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s
```
## Continuation Prompt
Some shells support a continuation prompt along with the normal prompt. This prompt is rendered instead of the normal prompt when the user has entered an incomplete statement (such as a single left parenthesis or quote).
Starship can set the continuation prompt using the `continuation_prompt` option. The default prompt is `"[∙](bright-black) "`.
Note: `continuation_prompt` should be set to a literal string without any variables.
Note: Continuation prompts are only available in the following shells:
- `bash`
- `zsh`
- `파워셀`
### Example
```toml
# ~/.config/starship.toml
# A continuation prompt that displays two filled in arrows
continuation_prompt = "▶▶"
```
## Style Strings

View File

@ -24,13 +24,19 @@ disabled = true
You can change default configuration file location with `STARSHIP_CONFIG` environment variable:
```sh
export STARSHIP_CONFIG=~/.starship/config.toml
export STARSHIP_CONFIG=~/example/non/default/path/starship.toml
```
Equivalently in PowerShell (Windows) would be adding this line to your `$PROFILE`:
```powershell
$ENV:STARSHIP_CONFIG = "$HOME\.starship\config.toml"
$ENV:STARSHIP_CONFIG = "$HOME\example\non\default\path\starship.toml"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CONFIG', 'C:\\Users\\user\\example\\non\\default\\path\\starship.toml')
```
### Logging
@ -47,6 +53,12 @@ Equivalently in PowerShell (Windows) would be adding this line to your `$PROFILE
$ENV:STARSHIP_CACHE = "$HOME\AppData\Local\Temp"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CACHE', 'C:\\Users\\user\\AppData\\Local\\Temp')
```
### Terminology
**Module**: A component in the prompt giving information based on contextual information from your OS. For example, the "nodejs" module shows the version of Node.js that is currently installed on your computer, if your current directory is a Node.js project.
@ -425,13 +437,13 @@ By default it only changes color. If you also want to change its shape take a lo
::: warning
`error_symbol` is not supported on elvish and nu shell.
`error_symbol` is not supported on nu shell.
:::
::: warning
`vicmd_symbol` is only supported in fish and zsh.
`vicmd_symbol` is only supported in cmd, fish and zsh.
:::
@ -568,7 +580,7 @@ Bash users who need preexec-like functionality can use [rcaloras's bash_preexec
::: tip
Showing desktop notifications requires starship to be built with `rust-notify` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
Showing desktop notifications requires starship to be built with `notify-rust` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
:::
@ -713,20 +725,20 @@ format = "via [🔰 $version](bold red) "
## Deno
The `deno` module shows you your currently installed version of [Deno](https://deno.land/). By default the module will be shown if any of the following conditions are met:
- The current directory contains a `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
- The current directory contains a `deno.json`, `deno.jsonc`, `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
### Options
| Option | Default | Description |
| ------------------- | -------------------------------------------- | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
| `detect_files` | `["mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `"green bold"` | The style for the module. |
| `disabled` | `false` | Disables the `deno` module. |
| Option | Default | Description |
| ------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
| `detect_files` | `["deno.json", "deno.jsonc", "mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `"green bold"` | The style for the module. |
| `disabled` | `false` | Disables the `deno` module. |
### Variables
@ -755,18 +767,19 @@ For example, given `~/Dev/Nix/nixpkgs/pkgs` where `nixpkgs` is the repo root, an
### Options
| Option | Default | Description |
| ------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `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)[$read_only]($read_only_style) "` | The format for the module. |
| `style` | `"bold cyan"` | The style for the module. |
| `disabled` | `false` | Disables the `directory` module. |
| `read_only` | `"🔒"` | The symbol indicating current directory is read only. |
| `read_only_style` | `"red"` | The style for the read only symbol. |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | The symbol indicating home directory. |
| Option | Default | Description |
| ------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `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)[$read_only]($read_only_style) "` | The format for the module. |
| `style` | `"bold cyan"` | The style for the module. |
| `disabled` | `false` | Disables the `directory` module. |
| `read_only` | `"🔒"` | The symbol indicating current directory is read only. |
| `read_only_style` | `"red"` | The style for the read only symbol. |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | The symbol indicating home directory. |
| `use_os_path_sep` | `true` | Use the OS specific path seperator instead of always using `/` (e.g. `\` on Windows) |
<details>
<summary>This module has a few advanced configuration options that control how the directory is displayed.</summary>
@ -1334,22 +1347,23 @@ The `git_status` module shows symbols representing the state of the repo in your
### Options
| Option | Default | Description |
| ------------ | ----------------------------------------------- | ----------------------------------- |
| `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` |
| `style` | `"bold red"` | The style for the module. |
| `disabled` | `false` | Disables the `git_status` module. |
| Option | Default | Description |
| ------------------- | ----------------------------------------------- | ----------------------------------- |
| `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` |
| `style` | `"bold red"` | The style for the module. |
| `ignore_submodules` | `false` | Ignore changes to submodules. |
| `disabled` | `false` | Disables the `git_status` module. |
### Variables
@ -1513,10 +1527,10 @@ The `hostname` module shows the system hostname.
### Variables
| Variable | Example | Description |
| --------- | ------- | ------------------------------------ |
| symbol | | Mirrors the value of option `symbol` |
| style\* | | Mirrors the value of option `style` |
| Variable | Example | Description |
| --------- | ---------- | ----------------------------------- |
| hostname | `computer` | The hostname of the computer |
| style\* | | Mirrors the value of option `style` |
\*: This variable can only be used as a part of a style string
@ -2133,7 +2147,7 @@ symbol = "☁️ "
## 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`, `composer`, `gradle`, `julia`, `mix`, `helm` and `shards` packages.
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`, `composer`, `gradle`, `julia`, `mix`, `helm`, `shards` 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
@ -2150,6 +2164,7 @@ The `package` module is shown when the current directory is the repository for a
- [**Shards**](https://crystal-lang.org/reference/the_shards_command/index.html) - The `shards` package version is extracted from the `shard.yml` present
- [**V**](https://vlang.io) - The `vlang` package version is extracted from the `v.mod` present
- [**SBT**](https://scala-sbt.org) - The `sbt` package version is extracted from the `build.sbt` present in the current directory
- [**Dart**](https://pub.dev/) - The `dart` package version is extracted from the `pubspec.yaml` present in the current directory
> ⚠️ The version being shown is that of the package whose source code is in your current directory, not your package manager.
@ -2673,6 +2688,8 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
| `elvish_indicator` | `esh` | A format string used to represent elvish. |
| `tcsh_indicator` | `tsh` | A format string used to represent tcsh. |
| `xonsh_indicator` | `xsh` | A format string used to represent xonsh. |
| `cmd_indicator` | `cmd` | A format string used to represent cmd. |
| `nu_indicator` | `nu` | A format string used to represent nu. |
| `unknown_indicator` | | The default value to be displayed when the shell is unknown. |
| `format` | `"[$indicator]($style) "` | The format for the module. |
| `style` | `"white bold"` | The style for the module. |
@ -2778,7 +2795,7 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
:::
::: warning This module is not supported on elvish and nu shell. :::
::: warning This module is not supported on nu shell. :::
### Options
@ -2804,6 +2821,7 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
| Variable | Example | Description |
| -------------- | ------- | ------------------------------------------------------------------------------------------- |
| status | `127` | The exit code of the last command |
| hex_status | `0x7F` | The exit code of the last command in hex |
| int | `127` | The exit code of the last command |
| common_meaning | `ERROR` | Meaning of the code if not a signal |
| signal_number | `9` | Signal number corresponding to the exit code, only if signalled |

View File

@ -69,13 +69,13 @@ If you see symbols that you don't recognise you can use `starship explain` to ex
You can enable the debug logs by using the `STARSHIP_LOG` env var. These logs can be very verbose so it is often useful to use the `module` command if you are trying to debug a particular module, for example, if you are trying to debug the `rust` module you could run the following command to get the trace logs and output from the module.
```sh
env STARHIP_LOG=trace starship module rust
env STARSHIP_LOG=trace starship module rust
```
If starship is being slow you can try using the `timings` command to see if there is a particular module or command that to blame.
```sh
env STARHIP_LOG=trace starship timings
env STARSHIP_LOG=trace starship timings
```
This will output the trace log and a breakdown of all modules that either took more than 1ms to execute or produced some output.
@ -118,5 +118,5 @@ If Starship was installed using the install script, the following command will d
```sh
# Locate and delete the starship binary
sh -c 'rm "$(which starship)"'
sh -c 'rm "$(command -v 'starship')"'
```

View File

@ -72,6 +72,22 @@
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-fr.png"
alt="Français"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/id-ID/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-id.png"
alt="Bahasa Indonesia"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/it-IT/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-it.png"
alt="Italiano"
/></a>
&nbsp;
<a
@ -252,7 +268,7 @@
#### Elvish
**Warning** Only elvish v0.15 or higher is supported. 아래의 라인을 `~/.elvish/rc.elv` 마지막에 추가:
**Warning** Only elvish v0.17 or higher is supported. 아래의 라인을 `~/.elvish/rc.elv` 마지막에 추가:
```sh
# ~/.elvish/rc.elv
@ -283,6 +299,17 @@
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```
#### Nushell
**Warning** This will change in the future. Only nu version v0.33 or higher is supported. Add the following to your nu config file. You can check the location of this file by running `config path` in nu.

View File

@ -224,7 +224,7 @@ format = '\[[$symbol($version)]($style)\]'
format = '\[[$symbol($version)]($style)\]'
[sudo]
format = '\[[as $symbol]\]
format = '\[[as $symbol]\]'
[swift]
format = '\[[$symbol($version)]($style)\]'

View File

@ -18,7 +18,7 @@ features:
footer: ISC Licensed | Copyright © 2019-present Starship Contributors
#Used for the description meta tag, for SEO
metaTitle: "Starship: Cross-Shell Prompt"
description: Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the information you need, while staying sleek and minimal. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, and PowerShell.
description: Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the information you need, while staying sleek and minimal. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and PowerShell.
---
<div class="center">
@ -119,7 +119,7 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
#### Elvish
::: warning Only elvish v0.15 or higher is supported. :::
::: warning Only elvish v0.17 or higher is supported. :::
Add the following to the end of `~/.elvish/rc.elv`:
@ -164,3 +164,14 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
execx($(starship init xonsh))
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```

View File

@ -8,6 +8,30 @@ The configurations in this section are subject to change in future releases of S
:::
## Custom pre-prompt and pre-execution Commands in Cmd
Clink provides extremely flexible APIs to run pre-prompt and pre-exec commands in Cmd shell. It is fairly simple to use with Starship. Make the following changes to your `starship.lua` file as per your requirements:
- To run a custom function right before the prompt is drawn, define a new function called `starship_preprompt_user_func`. This function receives the current prompt as a string that you can utilize. For example, to draw a rocket before the prompt, you would do
```lua
function starship_preprompt_user_func(prompt)
print("🚀")
end
load(io.popen('starship init cmd'):read("*a"))()
```
- To run a custom function right before a command is executed, define a new function called `starship_precmd_user_func`. This function receives the current commandline as a string that you can utilize. For example, to print the command that's about to be executed, you would do
```lua
function starship_precmd_user_func(line)
print("Executing: "..line)
end
load(io.popen('starship init cmd'):read("*a"))()
```
## Custom pre-prompt and pre-execution Commands in Bash
Bash does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `bash`. However, Starship does give you limited ability to insert your own functions into the prompt-rendering procedure:
@ -45,7 +69,7 @@ function Invoke-Starship-PreCommand {
## Change Window Title
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash` or `zsh`.
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash`, `zsh`, `cmd` or `powershell`.
First, define a window title change function (identical in bash and zsh):
@ -80,6 +104,16 @@ function set_win_title(){
starship_precmd_user_func="set_win_title"
```
For Cmd, you can change the window title using the `starship_preprompt_user_func` function.
```lua
function starship_preprompt_user_func(prompt)
console.settitle(os.getenv('USERNAME').."@"..os.getenv('COMPUTERNAME')..": "..os.getcwd())
end
load(io.popen('starship init cmd'):read("*a"))()
```
You can also set a similar output with PowerShell by creating a function named `Invoke-Starship-PreCommand`.
```powershell
@ -97,7 +131,7 @@ Some shells support a right prompt which renders on the same line as the input.
Note: The right prompt is a single line following the input location. To right align modules above the input line in a multi-line prompt, see the [fill module](/config/#fill).
`right_format` is currently supported for the following shells: elvish, fish, zsh.
`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd.
### Example
@ -117,6 +151,28 @@ Produces a prompt like the following:
▶ starship on  rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s
```
## Continuation Prompt
Some shells support a continuation prompt along with the normal prompt. This prompt is rendered instead of the normal prompt when the user has entered an incomplete statement (such as a single left parenthesis or quote).
Starship can set the continuation prompt using the `continuation_prompt` option. The default prompt is `"[∙](bright-black) "`.
Note: `continuation_prompt` should be set to a literal string without any variables.
Note: Continuation prompts are only available in the following shells:
- `bash`
- `zsh`
- `PowerShell`
### Example
```toml
# ~/.config/starship.toml
# A continuation prompt that displays two filled in arrows
continuation_prompt = "▶▶"
```
## Style Strings

View File

@ -24,13 +24,19 @@ disabled = true
You can change default configuration file location with `STARSHIP_CONFIG` environment variable:
```sh
export STARSHIP_CONFIG=~/.starship/config.toml
export STARSHIP_CONFIG=~/example/non/default/path/starship.toml
```
Equivalently in PowerShell (Windows) would be adding this line to your `$PROFILE`:
```powershell
$ENV:STARSHIP_CONFIG = "$HOME\.starship\config.toml"
$ENV:STARSHIP_CONFIG = "$HOME\example\non\default\path\starship.toml"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CONFIG', 'C:\\Users\\user\\example\\non\\default\\path\\starship.toml')
```
### Logging
@ -47,6 +53,12 @@ Equivalently in PowerShell (Windows) would be adding this line to your `$PROFILE
$ENV:STARSHIP_CACHE = "$HOME\AppData\Local\Temp"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CACHE', 'C:\\Users\\user\\AppData\\Local\\Temp')
```
### Terminology
**Module**: A component in the prompt giving information based on contextual information from your OS. For example, the "nodejs" module shows the version of Node.js that is currently installed on your computer, if your current directory is a Node.js project.
@ -425,13 +437,13 @@ By default it only changes color. If you also want to change its shape take a lo
::: warning
`error_symbol` is not supported on elvish and nu shell.
`error_symbol` is not supported on nu shell.
:::
::: warning
`vicmd_symbol` is only supported in fish and zsh.
`vicmd_symbol` is only supported in cmd, fish and zsh.
:::
@ -568,7 +580,7 @@ Bash users who need preexec-like functionality can use [rcaloras's bash_preexec
::: tip
Showing desktop notifications requires starship to be built with `rust-notify` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
Showing desktop notifications requires starship to be built with `notify-rust` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
:::
@ -713,20 +725,20 @@ format = "via [🔰 $version](bold red) "
## Deno
The `deno` module shows you your currently installed version of [Deno](https://deno.land/). By default the module will be shown if any of the following conditions are met:
- The current directory contains a `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
- The current directory contains a `deno.json`, `deno.jsonc`, `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
### Options
| Option | Default | Description |
| ------------------- | -------------------------------------------- | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
| `detect_files` | `["mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `"green bold"` | The style for the module. |
| `disabled` | `false` | Disables the `deno` module. |
| Option | Default | Description |
| ------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
| `detect_files` | `["deno.json", "deno.jsonc", "mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `"green bold"` | The style for the module. |
| `disabled` | `false` | Disables the `deno` module. |
### Variables
@ -755,18 +767,19 @@ For example, given `~/Dev/Nix/nixpkgs/pkgs` where `nixpkgs` is the repo root, an
### Options
| Option | Default | Description |
| ------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `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)[$read_only]($read_only_style) "` | The format for the module. |
| `style` | `"bold cyan"` | The style for the module. |
| `disabled` | `false` | Disables the `directory` module. |
| `read_only` | `"🔒"` | The symbol indicating current directory is read only. |
| `read_only_style` | `"red"` | The style for the read only symbol. |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | The symbol indicating home directory. |
| Option | Default | Description |
| ------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `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)[$read_only]($read_only_style) "` | The format for the module. |
| `style` | `"bold cyan"` | The style for the module. |
| `disabled` | `false` | Disables the `directory` module. |
| `read_only` | `"🔒"` | The symbol indicating current directory is read only. |
| `read_only_style` | `"red"` | The style for the read only symbol. |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | The symbol indicating home directory. |
| `use_os_path_sep` | `true` | Use the OS specific path seperator instead of always using `/` (e.g. `\` on Windows) |
<details>
<summary>This module has a few advanced configuration options that control how the directory is displayed.</summary>
@ -1334,22 +1347,23 @@ The `git_status` module shows symbols representing the state of the repo in your
### Options
| Option | Default | Description |
| ------------ | ----------------------------------------------- | ----------------------------------- |
| `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` |
| `style` | `"bold red"` | The style for the module. |
| `disabled` | `false` | Disables the `git_status` module. |
| Option | Default | Description |
| ------------------- | ----------------------------------------------- | ----------------------------------- |
| `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` |
| `style` | `"bold red"` | The style for the module. |
| `ignore_submodules` | `false` | Ignore changes to submodules. |
| `disabled` | `false` | Disables the `git_status` module. |
### Variables
@ -1513,10 +1527,10 @@ The `hostname` module shows the system hostname.
### Variables
| Variable | Example | Description |
| --------- | ------- | ------------------------------------ |
| symbol | | Mirrors the value of option `symbol` |
| style\* | | Mirrors the value of option `style` |
| Variable | Example | Description |
| --------- | ---------- | ----------------------------------- |
| hostname | `computer` | The hostname of the computer |
| style\* | | Mirrors the value of option `style` |
\*: This variable can only be used as a part of a style string
@ -2133,7 +2147,7 @@ symbol = "☁️ "
## 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`, `composer`, `gradle`, `julia`, `mix`, `helm` and `shards` packages.
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`, `composer`, `gradle`, `julia`, `mix`, `helm`, `shards` 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
@ -2150,6 +2164,7 @@ The `package` module is shown when the current directory is the repository for a
- [**Shards**](https://crystal-lang.org/reference/the_shards_command/index.html) - The `shards` package version is extracted from the `shard.yml` present
- [**V**](https://vlang.io) - The `vlang` package version is extracted from the `v.mod` present
- [**SBT**](https://scala-sbt.org) - The `sbt` package version is extracted from the `build.sbt` present in the current directory
- [**Dart**](https://pub.dev/) - The `dart` package version is extracted from the `pubspec.yaml` present in the current directory
> ⚠️ The version being shown is that of the package whose source code is in your current directory, not your package manager.
@ -2673,6 +2688,8 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
| `elvish_indicator` | `esh` | A format string used to represent elvish. |
| `tcsh_indicator` | `tsh` | A format string used to represent tcsh. |
| `xonsh_indicator` | `xsh` | A format string used to represent xonsh. |
| `cmd_indicator` | `cmd` | A format string used to represent cmd. |
| `nu_indicator` | `nu` | A format string used to represent nu. |
| `unknown_indicator` | | The default value to be displayed when the shell is unknown. |
| `format` | `"[$indicator]($style) "` | The format for the module. |
| `style` | `"white bold"` | The style for the module. |
@ -2778,7 +2795,7 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
:::
::: warning This module is not supported on elvish and nu shell. :::
::: warning This module is not supported on nu shell. :::
### Options
@ -2804,6 +2821,7 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
| Variable | Example | Description |
| -------------- | ------- | ------------------------------------------------------------------------------------------- |
| status | `127` | The exit code of the last command |
| hex_status | `0x7F` | The exit code of the last command in hex |
| int | `127` | The exit code of the last command |
| common_meaning | `ERROR` | Meaning of the code if not a signal |
| signal_number | `9` | Signal number corresponding to the exit code, only if signalled |

View File

@ -69,13 +69,13 @@ If you see symbols that you don't recognise you can use `starship explain` to ex
You can enable the debug logs by using the `STARSHIP_LOG` env var. These logs can be very verbose so it is often useful to use the `module` command if you are trying to debug a particular module, for example, if you are trying to debug the `rust` module you could run the following command to get the trace logs and output from the module.
```sh
env STARHIP_LOG=trace starship module rust
env STARSHIP_LOG=trace starship module rust
```
If starship is being slow you can try using the `timings` command to see if there is a particular module or command that to blame.
```sh
env STARHIP_LOG=trace starship timings
env STARSHIP_LOG=trace starship timings
```
This will output the trace log and a breakdown of all modules that either took more than 1ms to execute or produced some output.
@ -118,5 +118,5 @@ If Starship was installed using the install script, the following command will d
```sh
# Locate and delete the starship binary
sh -c 'rm "$(which starship)"'
sh -c 'rm "$(command -v 'starship')"'
```

View File

@ -70,6 +70,22 @@
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-fr.png"
alt="Français"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/id-ID/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-id.png"
alt="Bahasa Indonesia"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/it-IT/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-it.png"
alt="Italiano"
/></a>
&nbsp;
<a
@ -250,7 +266,7 @@
#### Elvish
**Warning** Only elvish v0.15 or higher is supported. Add the following to the end of `~/.elvish/rc.elv`:
**Warning** Only elvish v0.17 or higher is supported. Add the following to the end of `~/.elvish/rc.elv`:
```sh
# ~/.elvish/rc.elv
@ -281,6 +297,17 @@
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```
#### Nushell
**Warning** This will change in the future. Add the following to your nu config file. De locatie van hiervan kunt u vinden door `config path` uit te voeren in nushell.

View File

@ -224,7 +224,7 @@ format = '\[[$symbol($version)]($style)\]'
format = '\[[$symbol($version)]($style)\]'
[sudo]
format = '\[[as $symbol]\]
format = '\[[as $symbol]\]'
[swift]
format = '\[[$symbol($version)]($style)\]'

View File

@ -18,7 +18,7 @@ features:
footer: ISC Licensed | Copyright © 2019-present Starship Contributors
#Used for the description meta tag, for SEO
metaTitle: "Starship: Cross-Shell Prompt"
description: Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the information you need, while staying sleek and minimal. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, and PowerShell.
description: Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the information you need, while staying sleek and minimal. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and PowerShell.
---
<div class="center">
@ -119,7 +119,7 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
#### Elvish
::: warning Only elvish v0.15 or higher is supported. :::
::: warning Only elvish v0.17 or higher is supported. :::
Dodaj na koniec pliku `~/.elvish/rc.elv`:
@ -164,3 +164,14 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
execx($(starship init xonsh))
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```

View File

@ -8,6 +8,30 @@ Konfiguracja opisana w tej sekcji może ulec zmianie w przyszłych wydaniach Sta
:::
## Custom pre-prompt and pre-execution Commands in Cmd
Clink provides extremely flexible APIs to run pre-prompt and pre-exec commands in Cmd shell. It is fairly simple to use with Starship. Make the following changes to your `starship.lua` file as per your requirements:
- To run a custom function right before the prompt is drawn, define a new function called `starship_preprompt_user_func`. This function receives the current prompt as a string that you can utilize. For example, to draw a rocket before the prompt, you would do
```lua
function starship_preprompt_user_func(prompt)
print("🚀")
end
load(io.popen('starship init cmd'):read("*a"))()
```
- To run a custom function right before a command is executed, define a new function called `starship_precmd_user_func`. This function receives the current commandline as a string that you can utilize. For example, to print the command that's about to be executed, you would do
```lua
function starship_precmd_user_func(line)
print("Executing: "..line)
end
load(io.popen('starship init cmd'):read("*a"))()
```
## Custom pre-prompt and pre-execution Commands in Bash
Bash does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `bash`. However, Starship does give you limited ability to insert your own functions into the prompt-rendering procedure:
@ -45,7 +69,7 @@ function Invoke-Starship-PreCommand {
## Change Window Title
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash` or `zsh`.
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash`, `zsh`, `cmd` or `powershell`.
First, define a window title change function (identical in bash and zsh):
@ -80,6 +104,16 @@ function set_win_title(){
starship_precmd_user_func="set_win_title"
```
For Cmd, you can change the window title using the `starship_preprompt_user_func` function.
```lua
function starship_preprompt_user_func(prompt)
console.settitle(os.getenv('USERNAME').."@"..os.getenv('COMPUTERNAME')..": "..os.getcwd())
end
load(io.popen('starship init cmd'):read("*a"))()
```
You can also set a similar output with PowerShell by creating a function named `Invoke-Starship-PreCommand`.
```powershell
@ -97,7 +131,7 @@ Some shells support a right prompt which renders on the same line as the input.
Note: The right prompt is a single line following the input location. To right align modules above the input line in a multi-line prompt, see the [fill module](/config/#fill).
`right_format` is currently supported for the following shells: elvish, fish, zsh.
`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd.
### Example
@ -117,6 +151,28 @@ Produces a prompt like the following:
▶ starship on  rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s
```
## Continuation Prompt
Some shells support a continuation prompt along with the normal prompt. This prompt is rendered instead of the normal prompt when the user has entered an incomplete statement (such as a single left parenthesis or quote).
Starship can set the continuation prompt using the `continuation_prompt` option. The default prompt is `"[∙](bright-black) "`.
Note: `continuation_prompt` should be set to a literal string without any variables.
Note: Continuation prompts are only available in the following shells:
- `bash`
- `zsh`
- `PowerShell`
### Example
```toml
# ~/.config/starship.toml
# A continuation prompt that displays two filled in arrows
continuation_prompt = "▶▶"
```
## Style Strings

View File

@ -24,18 +24,24 @@ disabled = true
Możesz zmienić domyślną lokalizację pliku konfiguracyjnego za pomocą zmiennej środowiskowej `STARSHIP_CONFIG`:
```sh
export STARSHIP_CONFIG=~/.starship/config.toml
export STARSHIP_CONFIG=~/example/non/default/path/starship.toml
```
Odpowiednikiem dla PowerShell (Windows) jest dodanie następującej linii w twoim `$PROFILE`:
```powershell
$ENV:STARSHIP_CONFIG = "$HOME\.starship\config.toml"
$ENV:STARSHIP_CONFIG = "$HOME\example\non\default\path\starship.toml"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CONFIG', 'C:\\Users\\user\\example\\non\\default\\path\\starship.toml')
```
### Logi
Starship domyślnie loguje ostrzeżenia i błędy do pliku o nazwie`~/.cache/starship/session_${STARSHIP_SESSION_KEY}.log`, gdzie klucz sesji odpowiada twojej instancji terminala. Można to zmienić za pomocą zmiennej środowiskowej `STARSHIP_CACHE`:
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
@ -47,23 +53,29 @@ Odpowiednikiem dla PowerShell (Windows) jest dodanie następującej linii w twoi
$ENV:STARSHIP_CACHE = "$HOME\AppData\Local\Temp"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CACHE', 'C:\\Users\\user\\AppData\\Local\\Temp')
```
### Glosariusz
**Moduł**: Komponent wiersza poleceń, który dostarcza informacji opartych na kontekście twojego systemu operacyjnego. Przykładowo, moduł "nodejs" pokazuje wersję Node.js, która jest obecnie zainstalowana na twoim komputerze, jeżeli znajdujesz się w folderze zawierającym projekt Node.js.
**Module**: A component in the prompt giving information based on contextual information from your OS. For example, the "nodejs" module shows the version of Node.js that is currently installed on your computer, if your current directory is a Node.js project.
**Zmienna**: Mniejszy podkomponent zawierający informacje dostarczane przez moduł. Przykładowo, zmienna "version" w module "nodejs" zawiera obecną wersję Node.js.
**Variable**: Smaller sub-components that contain information provided by the module. For example, the "version" variable in the "nodejs" module contains the current version of Node.js.
W ramach konwencji większość modułów posiada przedrostek w domyślnym kolorze terminala (n.p. `via` w "nodejs") oraz pojedynczy odstęp za treścią modułu.
By convention, most modules have a prefix of default terminal color (e.g. `via` in "nodejs") and an empty space as a suffix.
### Formatowanie
Moduły wypisują swoje zmienne przy użyciu ciągów formatujących. Większość modułów posiada wpis o nazwie `format`, który konfiguruje format wyświetlania modułu. W ciągach formatujących można używać tekstu, zmiennych oraz grup tekstowych.
Format strings are the format that a module prints all its variables with. Most modules have an entry called `format` that configures the display format of the module. You can use texts, variables and text groups in a format string.
#### Zmienne
Zmienna zawiera symbol `$`, po którym następuje nazwa zmiennej. The name of a variable can only contain letters, numbers and `_`.
A variable contains a `$` symbol followed by the name of the variable. The name of a variable can only contain letters, numbers and `_`.
Na przykład:
For example:
- `$version` to ciąg formatujący ze zmienną o nazwie `version`.
- `$git_branch$git_commit` zawiera dwie zmienne: `git_branch` i `git_commit`.
@ -71,13 +83,13 @@ Na przykład:
#### Grupy tekstowe
Grupa tekstowa składa się z dwóch oddzielnych części.
A text group is made up of two different parts.
Pierwsza część, otoczona `[]`, to [ciąg formatujący](#format-strings). You can add texts, variables, or even nested text groups in it.
The first part, which is enclosed in a `[]`, is a [format string](#format-strings). You can add texts, variables, or even nested text groups in it.
In the second part, which is enclosed in a `()`, is a [style string](#style-strings). This can be used to style the first part.
Na przykład:
For example:
- `[on](red bold)` will print a string `on` with bold text colored red.
- `[⌘ $version](bold green)` will print a symbol `⌘` followed by the content of variable `version`, with bold text colored green.
@ -100,7 +112,7 @@ Note that what styling looks like will be controlled by your terminal emulator.
A conditional format string wrapped in `(` and `)` will not render if all variables inside are empty.
Na przykład:
For example:
- `(@$region)` will show nothing if the variable `region` is `None` or empty string, otherwise `@` followed by the value of region.
- `(some text)` will always show nothing since there are no variables wrapped in the braces.
@ -425,13 +437,13 @@ By default it only changes color. If you also want to change its shape take a lo
::: warning
`error_symbol` is not supported on elvish and nu shell.
`error_symbol` is not supported on nu shell.
:::
::: warning
`vicmd_symbol` is only supported in fish and zsh.
`vicmd_symbol` is only supported in cmd, fish and zsh.
:::
@ -568,7 +580,7 @@ Bash users who need preexec-like functionality can use [rcaloras's bash_preexec
::: tip
Showing desktop notifications requires starship to be built with `rust-notify` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
Showing desktop notifications requires starship to be built with `notify-rust` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
:::
@ -713,20 +725,20 @@ format = "via [🔰 $version](bold red) "
## Deno
The `deno` module shows you your currently installed version of [Deno](https://deno.land/). By default the module will be shown if any of the following conditions are met:
- The current directory contains a `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
- The current directory contains a `deno.json`, `deno.jsonc`, `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
### Options
| Option | Default | Description |
| ------------------- | -------------------------------------------- | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
| `detect_files` | `["mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `"green bold"` | The style for the module. |
| `disabled` | `false` | Disables the `deno` module. |
| Option | Default | Description |
| ------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
| `detect_files` | `["deno.json", "deno.jsonc", "mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `"green bold"` | The style for the module. |
| `disabled` | `false` | Disables the `deno` module. |
### Variables
@ -755,18 +767,19 @@ For example, given `~/Dev/Nix/nixpkgs/pkgs` where `nixpkgs` is the repo root, an
### Options
| Option | Default | Description |
| ------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `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)[$read_only]($read_only_style) "` | The format for the module. |
| `style` | `"bold cyan"` | The style for the module. |
| `disabled` | `false` | Disables the `directory` module. |
| `read_only` | `"🔒"` | The symbol indicating current directory is read only. |
| `read_only_style` | `"red"` | The style for the read only symbol. |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | The symbol indicating home directory. |
| Option | Default | Description |
| ------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `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)[$read_only]($read_only_style) "` | The format for the module. |
| `style` | `"bold cyan"` | The style for the module. |
| `disabled` | `false` | Disables the `directory` module. |
| `read_only` | `"🔒"` | The symbol indicating current directory is read only. |
| `read_only_style` | `"red"` | The style for the read only symbol. |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | The symbol indicating home directory. |
| `use_os_path_sep` | `true` | Use the OS specific path seperator instead of always using `/` (e.g. `\` on Windows) |
<details>
<summary>This module has a few advanced configuration options that control how the directory is displayed.</summary>
@ -1334,22 +1347,23 @@ The `git_status` module shows symbols representing the state of the repo in your
### Options
| Option | Default | Description |
| ------------ | ----------------------------------------------- | ----------------------------------- |
| `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` |
| `style` | `"bold red"` | The style for the module. |
| `disabled` | `false` | Disables the `git_status` module. |
| Option | Default | Description |
| ------------------- | ----------------------------------------------- | ----------------------------------- |
| `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` |
| `style` | `"bold red"` | The style for the module. |
| `ignore_submodules` | `false` | Ignore changes to submodules. |
| `disabled` | `false` | Disables the `git_status` module. |
### Variables
@ -1513,10 +1527,10 @@ The `hostname` module shows the system hostname.
### Variables
| Zmienne | Example | Description |
| --------- | ------- | ------------------------------------ |
| symbol | | Mirrors the value of option `symbol` |
| style\* | | Mirrors the value of option `style` |
| Zmienne | Example | Description |
| --------- | ---------- | ----------------------------------- |
| hostname | `computer` | The hostname of the computer |
| style\* | | Mirrors the value of option `style` |
\*: This variable can only be used as a part of a style string
@ -2133,7 +2147,7 @@ symbol = "☁️ "
## 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`, `composer`, `gradle`, `julia`, `mix`, `helm` and `shards` packages.
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`, `composer`, `gradle`, `julia`, `mix`, `helm`, `shards` 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
@ -2150,6 +2164,7 @@ The `package` module is shown when the current directory is the repository for a
- [**Shards**](https://crystal-lang.org/reference/the_shards_command/index.html) - The `shards` package version is extracted from the `shard.yml` present
- [**V**](https://vlang.io) - The `vlang` package version is extracted from the `v.mod` present
- [**SBT**](https://scala-sbt.org) - The `sbt` package version is extracted from the `build.sbt` present in the current directory
- [**Dart**](https://pub.dev/) - The `dart` package version is extracted from the `pubspec.yaml` present in the current directory
> ⚠️ The version being shown is that of the package whose source code is in your current directory, not your package manager.
@ -2673,6 +2688,8 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
| `elvish_indicator` | `esh` | A format string used to represent elvish. |
| `tcsh_indicator` | `tsh` | A format string used to represent tcsh. |
| `xonsh_indicator` | `xsh` | A format string used to represent xonsh. |
| `cmd_indicator` | `cmd` | A format string used to represent cmd. |
| `nu_indicator` | `nu` | A format string used to represent nu. |
| `unknown_indicator` | | The default value to be displayed when the shell is unknown. |
| `format` | `"[$indicator]($style) "` | The format for the module. |
| `style` | `"white bold"` | The style for the module. |
@ -2778,7 +2795,7 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
:::
::: warning This module is not supported on elvish and nu shell. :::
::: warning This module is not supported on nu shell. :::
### Options
@ -2804,6 +2821,7 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
| Zmienne | Example | Description |
| -------------- | ------- | ------------------------------------------------------------------------------------------- |
| status | `127` | The exit code of the last command |
| hex_status | `0x7F` | The exit code of the last command in hex |
| int | `127` | The exit code of the last command |
| common_meaning | `ERROR` | Meaning of the code if not a signal |
| signal_number | `9` | Signal number corresponding to the exit code, only if signalled |

View File

@ -69,13 +69,13 @@ Jeśli zauważyłeś symbole których nie rozpoznajesz, możesz użyć `starship
You can enable the debug logs by using the `STARSHIP_LOG` env var. These logs can be very verbose so it is often useful to use the `module` command if you are trying to debug a particular module, for example, if you are trying to debug the `rust` module you could run the following command to get the trace logs and output from the module.
```sh
env STARHIP_LOG=trace starship module rust
env STARSHIP_LOG=trace starship module rust
```
If starship is being slow you can try using the `timings` command to see if there is a particular module or command that to blame.
```sh
env STARHIP_LOG=trace starship timings
env STARSHIP_LOG=trace starship timings
```
This will output the trace log and a breakdown of all modules that either took more than 1ms to execute or produced some output.
@ -118,5 +118,5 @@ If Starship was installed using the install script, the following command will d
```sh
# Locate and delete the starship binary
sh -c 'rm "$(which starship)"'
sh -c 'rm "$(command -v 'starship')"'
```

View File

@ -72,6 +72,22 @@
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-fr.png"
alt="Français"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/id-ID/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-id.png"
alt="Bahasa Indonesia"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/it-IT/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-it.png"
alt="Italiano"
/></a>
&nbsp;
<a
@ -252,7 +268,7 @@
#### Elvish
**Uwaga** Działa tylko dla wersji powłoki elvish v0.15 lub wyższej. Dodaj na koniec pliku `~/.elvish/rc.elv`:
**Warning** Only elvish v0.17 or higher is supported. Dodaj na koniec pliku `~/.elvish/rc.elv`:
```sh
# ~/.elvish/rc.elv
@ -283,9 +299,20 @@
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```
#### Nushell
**Uwaga** Może ulec zmianie w przyszłości. Działa tylko dla wersji powłoki nu v0.33 lub wyższej. Dodaj do pliku konfiguracyjnego nu. Możesz sprawdzić lokalizację tego pliku wywołując polecenie `config path` w powłoce nu.
**Warning** This will change in the future. Działa tylko dla wersji powłoki nu v0.33 lub wyższej. Add the following to your nu config file. Możesz sprawdzić lokalizację tego pliku wywołując polecenie `config path` w powłoce nu.
```toml
startup = [

View File

@ -224,7 +224,7 @@ format = '\[[$symbol($version)]($style)\]'
format = '\[[$symbol($version)]($style)\]'
[sudo]
format = '\[[as $symbol]\]
format = '\[[as $symbol]\]'
[swift]
format = '\[[$symbol($version)]($style)\]'

View File

@ -18,7 +18,7 @@ features:
footer: Licenciado pelo ISC | Todos os direitos reservados © 2019-Presente | Contribuidores Starship
#Used for the description meta tag, for SEO
metaTitle: "Starship: Cross-Shell Prompt"
description: O Starship é o prompt minimalista, extremamente rápido e extremamente personalizável para qualquer shell! Mostra as informações que você precisa, mantendo-se elegante e minimalista. Instalação rápida disponível para Bash, Fish, ZSH, ION, Tcsh, Elvish, Nu, Xonsh and PowerShell.
description: O Starship é o prompt minimalista, extremamente rápido e extremamente personalizável para qualquer shell! Mostra as informações que você precisa, mantendo-se elegante e minimalista. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and PowerShell.
---
<div class="center">
@ -119,7 +119,7 @@ description: O Starship é o prompt minimalista, extremamente rápido e extremam
#### Elvish
::: Atenção Apenas a versão v0.15 ou superior do elvish é suportada. :::
::: warning Apenas a versão elvish v0.17 ou superior é suportada. :::
Adicione o comando a seguir ao final do arquivo `~/.elvish/rc.elv`:
@ -164,3 +164,14 @@ description: O Starship é o prompt minimalista, extremamente rápido e extremam
execx($(starship init xonsh))
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```

View File

@ -8,11 +8,35 @@ As configurações nesta seção estão sujeitas a alterações em futuras vers
:::
## Comandos personalizados de pre-prompt e pre-execution no Bash
## Custom pre-prompt and pre-execution Commands in Cmd
O Bash não possui uma estrutura formal para os hooks preexec/precmd como a maioria dos outros shells. Por esse motivo, é difícil fornecer hooks totalmente customizáveis no `bash`. No entanto, Starship te oferece uma capacidade limitada de inserir suas próprias funções na processo de prompt-rendering:
Clink provides extremely flexible APIs to run pre-prompt and pre-exec commands in Cmd shell. It is fairly simple to use with Starship. Make the following changes to your `starship.lua` file as per your requirements:
- Para rodar uma função personalizada antes do prompt iniciar, defina uma nova função e atribua seu nome para `starship_precmd_user_func`. Por exemplo, para desenhar um foguete antes do prompt iniciar você faria
- To run a custom function right before the prompt is drawn, define a new function called `starship_preprompt_user_func`. This function receives the current prompt as a string that you can utilize. For example, to draw a rocket before the prompt, you would do
```lua
function starship_preprompt_user_func(prompt)
print("🚀")
end
load(io.popen('starship init cmd'):read("*a"))()
```
- To run a custom function right before a command is executed, define a new function called `starship_precmd_user_func`. This function receives the current commandline as a string that you can utilize. For example, to print the command that's about to be executed, you would do
```lua
function starship_precmd_user_func(line)
print("Executing: "..line)
end
load(io.popen('starship init cmd'):read("*a"))()
```
## Custom pre-prompt and pre-execution Commands in Bash
Bash does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `bash`. No entanto, Starship te oferece uma capacidade limitada de inserir suas próprias funções na processo de prompt-rendering:
- To run a custom function right before the prompt is drawn, define a new function and then assign its name to `starship_precmd_user_func`. For example, to draw a rocket before the prompt, you would do
```bash
function blastoff(){
@ -21,21 +45,21 @@ function blastoff(){
starship_precmd_user_func="blastoff"
```
- Para rodar uma função personalizada antes que um comando seja executado, você pode usar [`DEBUG` como mecanismo de armadilha](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). No entanto, você **deve** prender o sinal de DEBUG *antes* de inicializar o Starship! O Starship consegue preservar o valor da armadilha DEBUG, mas se a armadilha for substituída depois do starship iniciar, algumas funções iram quebrar.
- To run a custom function right before a command runs, you can use the [`DEBUG` trap mechanism](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). However, you **must** trap the DEBUG signal *before* initializing Starship! Starship can preserve the value of the DEBUG trap, but if the trap is overwritten after starship starts up, some functionality will break.
```bash
function blastoff(){
echo "🚀"
}
trap blastoff DEBUG # Trap Inicia o debug antes de iniciar o starship
trap blastoff DEBUG # Trap DEBUG *before* running starship
eval $(starship init bash)
```
## Comandos personalizados de pre-prompt e pre-execution no PowerShell
## Custom pre-prompt and pre-execution Commands in PowerShell
O PowerShell não possui uma estrutura formal para os hooks preexec/precmd como a maioria dos outros shells. Por esse motivo, é difícil fornecer hooks totalmente customizáveis no `powershell`. No entanto, Starship te oferece uma capacidade limitada de inserir suas próprias funções na processo de prompt-rendering:
PowerShell does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `powershell`. No entanto, Starship te oferece uma capacidade limitada de inserir suas próprias funções na processo de prompt-rendering:
Crie uma função chamada `Invoke-Starship-PreCommand`
Create a function named `Invoke-Starship-PreCommand`
```powershell
function Invoke-Starship-PreCommand {
@ -43,11 +67,11 @@ function Invoke-Starship-PreCommand {
}
```
## Altera o título da janela
## Change Window Title
Alguns shell prompts iram alterar o titulo da janela automaticamente para você (e.x: para espelhar o diretório atual). Fish faz isso por padrão. Starship não faz isso, mas é bastante simples adicionar esta funcionalidade ao `bash` ou `zsh`.
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash`, `zsh`, `cmd` or `powershell`.
Primeiro, defina uma função de alteração de titulo de janela (é o mesmo para bash e zsh):
First, define a window title change function (identical in bash and zsh):
```bash
function set_win_title(){
@ -55,23 +79,23 @@ function set_win_title(){
}
```
Você pode usar variáveis para customizar o titulo (`$USER`, `$HOSTNAME`, e `$PWD` são escolhas populares).
You can use variables to customize this title (`$USER`, `$HOSTNAME`, and `$PWD` are popular choices).
No `bash`, defina esta função como a precedente da função starship:
In `bash`, set this function to be the precmd starship function:
```bash
starship_precmd_user_func="set_win_title"
```
No `zsh`, adicione no array `precmd_functions`:
In `zsh`, add this to the `precmd_functions` array:
```bash
precmd_functions+=(set_win_title)
```
Se você gostar do resultado, adicione esta linha ao seu arquivo de configuração de shell (`~/.bashrc` or `~/.zshrc`) para torna-lo permanente.
If you like the result, add these lines to your shell configuration file (`~/.bashrc` or `~/.zshrc`) to make it permanent.
Por exemplo, se você quiser exibir seu diretório atual no seu titulo de aba do terminal, adicione o seguinte snippet ao seu `~/.bashrc` ou `~/.zshrc`:
For example, if you want to display your current directory in your terminal tab title, add the following snippet to your `~/.bashrc` or `~/.zshrc`:
```bash
function set_win_title(){
@ -80,7 +104,17 @@ function set_win_title(){
starship_precmd_user_func="set_win_title"
```
Você também pode definir uma saída semelhante com o PowerShell criando uma função chamada `Invoke-Starship-PreCommand`.
For Cmd, you can change the window title using the `starship_preprompt_user_func` function.
```lua
function starship_preprompt_user_func(prompt)
console.settitle(os.getenv('USERNAME').."@"..os.getenv('COMPUTERNAME')..": "..os.getcwd())
end
load(io.popen('starship init cmd'):read("*a"))()
```
You can also set a similar output with PowerShell by creating a function named `Invoke-Starship-PreCommand`.
```powershell
# edit $PROFILE
@ -91,36 +125,58 @@ function Invoke-Starship-PreCommand {
Invoke-Expression (&starship init powershell)
```
## Ativando o Prompt Direito
## Enable Right Prompt
Alguns shells suportam um prompt no lado direito que renderiza na mesma linha do input. Starship consegue definir o conteúdo do prompt direito usando a opção `right_format`. Qualquer módulo pode ser usado no `format` é suportado o `right_format`. A variável `$all` só irá alterar os módulos que não usaram de forma explicita o `format` ou `right_format`.
Some shells support a right prompt which renders on the same line as the input. Starship can set the content of the right prompt using the `right_format` option. Any module that can be used in `format` is also supported in `right_format`. The `$all` variable will only contain modules not explicitly used in either `format` or `right_format`.
Nota: O prompt direito é uma linha única seguindo o local de entrada. Para alinhar à direita os módulos acima a linha de entrada em um prompt de várias linhas, consulte o [módulo fill](/config/#fill).
Note: The right prompt is a single line following the input location. To right align modules above the input line in a multi-line prompt, see the [fill module](/config/#fill).
`right_format` é atualmente suportado para os seguintes shells: elvish, fish, zsh.
`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd.
### Exemplo
```toml
# ~/.config/starship.toml
# Um prompt esquerdo minimo
# A minimal left prompt
format = """$character"""
# Move o resto do prompt para direita
# move the rest of the prompt to the right
right_format = """$all"""
```
Gera um prompt parecido com o seguinte:
Produces a prompt like the following:
```
▶ starship on  rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s
```
## Continuation Prompt
Some shells support a continuation prompt along with the normal prompt. This prompt is rendered instead of the normal prompt when the user has entered an incomplete statement (such as a single left parenthesis or quote).
Starship can set the continuation prompt using the `continuation_prompt` option. The default prompt is `"[∙](bright-black) "`.
Note: `continuation_prompt` should be set to a literal string without any variables.
Note: Continuation prompts are only available in the following shells:
- `bash`
- `zsh`
- `PowerShell`
### Exemplo
```toml
# ~/.config/starship.toml
# A continuation prompt that displays two filled in arrows
continuation_prompt = "▶▶"
```
## Estilo dos textos
Estilo de strings são uma lista de palavras, separadas por espaço. As palavras não são case sensitive (ou seja `bold` e `BoLd` são consideradas iguais). Cada palavra pode ser uma das seguintes:
Style strings are a list of words, separated by whitespace. The words are not case sensitive (i.e. `bold` and `BoLd` are considered the same string). Each word can be one of the following:
- `bold`
- `italic`
@ -132,14 +188,14 @@ Estilo de strings são uma lista de palavras, separadas por espaço. As palavras
- `<color>`
- `none`
onde `<color>` é uma especialista de cores (discutido abaixo). `fg:<color>` e `<color>` atualmente fazem a mesma coisa, isto deve mudar no futuro. `inverted` troca as cores de background e foreground. A ordem de palavras na string não importa.
where `<color>` is a color specifier (discussed below). `fg:<color>` and `<color>` currently do the same thing, though this may change in the future. `inverted` swaps the background and foreground colors. The order of words in the string does not matter.
O token `none` substitui todos os outros tokens na string se ele não fizer parte de um `bg:` especificado que seja, por exemplo `fg:red none fg:blue` ainda criará uma string sem estilo. `bg:none` define a cor padrão de background então `fg:red bg:none` é equivalente a `red` ou `fg:red` e `bg:green fg:red bg:none` é equivalente a `fg:red` ou`red`. Pode se transformar em um erro ao usar `none` em um conjunto de outros tokens no futuro.
The `none` token overrides all other tokens in a string if it is not part of a `bg:` specifier, so that e.g. `fg:red none fg:blue` will still create a string with no styling. `bg:none` sets the background to the default color so `fg:red bg:none` is equivalent to `red` or `fg:red` and `bg:green fg:red bg:none` is also equivalent to `fg:red` or `red`. It may become an error to use `none` in conjunction with other tokens in the future.
Um especialista em cores pode ser um dos seguintes:
A color specifier can be one of the following:
- Um dos padrões de cores no terminal: `black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`. Você pode de forma opcional prefixar com `bright-` para obter uma versão mais brilhante/clara (ex `bright-white`).
- Um `#` seguido por um número de seis dígitos hexadecimais. Isto especifica um [Código RGB em formato hexadecimal](https://www.w3schools.com/colors/colors_hexadecimal.asp).
- Um número entre 0-255. Este especifica um [Código de Cor ANSI 8 bits](https://i.stack.imgur.com/KTSQa.png).
- One of the standard terminal colors: `black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`. You can optionally prefix these with `bright-` to get the bright version (e.g. `bright-white`).
- A `#` followed by a six-digit hexadecimal number. This specifies an [RGB color hex code](https://www.w3schools.com/colors/colors_hexadecimal.asp).
- A number between 0-255. This specifies an [8-bit ANSI Color Code](https://i.stack.imgur.com/KTSQa.png).
Se múltiplas cores forem especificadas para foreground/background, a ultima da string que terá prioridade.
If multiple colors are specified for foreground/background, the last one in the string will take priority.

File diff suppressed because it is too large Load Diff

View File

@ -56,31 +56,31 @@ Se você está tendo um erro como "_version 'GLIBC_2.18' not found (required by
sh -c "$(curl -fsSL https://starship.rs/install.sh)" -- --platform unknown-linux-musl
```
## Why do I see `Executing command "..." timed out.` warnings?
## Porque eu vejo alertas de `Executing command "..." timed out.`?
Starship executes different commands to get information to display in the prompt, for example the version of a program or the current git status. To make sure starship doesn't hang while trying to execute these commands we set a time limit, if a command takes longer than this limit starship will stop the execution of the command and output the above warning, this is expected behaviour. This time limit is configurable using the [`command_timeout` key](/config/#prompt) so if you want you can increase the time limit. You can also follow the debugging steps below to see which command is being slow and see if you can optimise it. Finally you can set the `STARSHIP_LOG` env var to `error` to hide these warnings.
O Starship executa comandos diferentes para recuperar as informações para exibir no prompt, por exemplo a versão de um programa ou o status atual do git. Para ter certeza de que o starship não travou durante uma execução destes comandos nos definimos um limite de tempo, se um comando ultrapassar este limite o starship vai parar a execução do comando e exibe o alerta acima, esse é um comportamento esperado. Este limite de tempo é configurado usando o [`command_timeout` key](/config/#prompt) então se você quiser você pode aumentar este limite. Você pode também seguir os passos para debugar para ver qual comando esta demorando e se você pode otimizar ele. Finalmente você pode definir a variável de ambiente `STARSHIP_LOG` para `error` para esconder estes alertas.
## Eu vejo símbolos que não entendo ou não esperado, o que isso significa?
Se você vê símbolos que não reconhece você pode usar `starship explain` para exibir os módulos que estão sendo mostrados no momento.
## Starship is doing something unexpected, how can I debug it?
## O Starship esta fazendo algo inesperado, como eu posso debugar?
You can enable the debug logs by using the `STARSHIP_LOG` env var. These logs can be very verbose so it is often useful to use the `module` command if you are trying to debug a particular module, for example, if you are trying to debug the `rust` module you could run the following command to get the trace logs and output from the module.
Você pode ativar os logs de debug usando a variavel de ambiente `STARSHIP_LOG`. Este logs podem ser bastantes verboso então é bastante útil usar o comando `module` se você esta tentando debugar um modulo em particular, por exemplo, se você esta tentando debugar o modulo `rust` você pode executar o seguinte comando para rastrear logs e saídas do modulo.
```sh
env STARHIP_LOG=trace starship module rust
env STARSHIP_LOG=trace starship module rust
```
If starship is being slow you can try using the `timings` command to see if there is a particular module or command that to blame.
Se o starship começa a ficar lento você pode tentar usar o comando `timings` para ver se tem um modulo ou comando para culpar.
```sh
env STARHIP_LOG=trace starship timings
env STARSHIP_LOG=trace starship timings
```
This will output the trace log and a breakdown of all modules that either took more than 1ms to execute or produced some output.
Isto vai retornar o rastreamento do log e um detalhamento de todos os módulos que levam mais que 1ms para executar ou produzir alguma saída.
Finally if you find a bug you can use the `bug-report` command to create a Github issue.
Finalmente se você quer procurar um bug você pode usar o comando `bug-report` para criar uma issue no Github.
```sh
starship bug-report
@ -117,6 +117,6 @@ Se o Starship foi instalando usando algum gerenciador de pacotes, por favor cons
Se o Starship foi instalado usando o script de instalação, o comando abaixo irá remover o binário:
```sh
# Localiza e deleta o binario do starship
sh -c 'rm "$(which starship)"'
# Locate and delete the starship binary
sh -c 'rm "$(command -v 'starship')"'
```

View File

@ -72,6 +72,22 @@
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-fr.png"
alt="Français"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/id-ID/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-id.png"
alt="Bahasa Indonesia"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/it-IT/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-it.png"
alt="Italiano"
/></a>
&nbsp;
<a
@ -252,7 +268,7 @@
#### Elvish
**Atenção** Apenas a versão v0.15 ou superior do elvish é suportada. Adicione o comando a seguir ao final do arquivo `~/.elvish/rc.elv`:
**Atenção** Apenas a versão elvish v0.17 ou superior é suportada. Adicione o comando a seguir ao final do arquivo `~/.elvish/rc.elv`:
```sh
# ~/.elvish/rc.elv
@ -283,9 +299,20 @@
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```
#### Nushell
**Atenção** Isto vai mudar no futuro. Apenas a versão v0.33 do nu ou superior é suportada. Adicione o seguinte no seu arquivo de configuração do nu. Você pode verificar o local deste arquivo rodando `config path` in nu.
**Warning** This will change in the future. Apenas a versão v0.33 do nu ou superior é suportada. Add the following to your nu config file. Você pode verificar o local deste arquivo rodando `config path` in nu.
```toml
startup = [

View File

@ -39,7 +39,7 @@ sh -c "$(curl -fsSL https://starship.rs/install.sh)" -- --bin-dir /data/data/com
### Instalação
On Funtoo Linux, starship can be installed from [core-kit](https://github.com/funtoo/core-kit/tree/1.4-release/app-shells/starship) via Portage:
No Funtoo Linux, o starship pode ser instalado a partir do [core-kit](https://github.com/funtoo/core-kit/tree/1.4-release/app-shells/starship) via Portage:
```sh
emerge app-shells/starship

View File

@ -224,7 +224,7 @@ format = '\[[$symbol($version)]($style)\]'
format = '\[[$symbol($version)]($style)\]'
[sudo]
format = '\[[as $symbol]\]
format = '\[[as $symbol]\]'
[swift]
format = '\[[$symbol($version)]($style)\]'

View File

@ -18,7 +18,7 @@ features:
footer: ISC Licensed | Copyright © 2019-present Starship Contributors
#Used for the description meta tag, for SEO
metaTitle: "Starship: Cross-Shell Prompt"
description: Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the information you need, while staying sleek and minimal. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, and PowerShell.
description: Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the information you need, while staying sleek and minimal. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and PowerShell.
---
<div class="center">
@ -119,7 +119,7 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
#### Elvish
::: warning Only elvish v0.15 or higher is supported. :::
::: warning Only elvish v0.17 or higher is supported. :::
Add the following to the end of `~/.elvish/rc.elv`:
@ -164,3 +164,14 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
execx($(starship init xonsh))
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```

View File

@ -8,6 +8,30 @@ The configurations in this section are subject to change in future releases of S
:::
## Custom pre-prompt and pre-execution Commands in Cmd
Clink provides extremely flexible APIs to run pre-prompt and pre-exec commands in Cmd shell. It is fairly simple to use with Starship. Make the following changes to your `starship.lua` file as per your requirements:
- To run a custom function right before the prompt is drawn, define a new function called `starship_preprompt_user_func`. This function receives the current prompt as a string that you can utilize. For example, to draw a rocket before the prompt, you would do
```lua
function starship_preprompt_user_func(prompt)
print("🚀")
end
load(io.popen('starship init cmd'):read("*a"))()
```
- To run a custom function right before a command is executed, define a new function called `starship_precmd_user_func`. This function receives the current commandline as a string that you can utilize. For example, to print the command that's about to be executed, you would do
```lua
function starship_precmd_user_func(line)
print("Executing: "..line)
end
load(io.popen('starship init cmd'):read("*a"))()
```
## Custom pre-prompt and pre-execution Commands in Bash
Bash does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `bash`. However, Starship does give you limited ability to insert your own functions into the prompt-rendering procedure:
@ -45,7 +69,7 @@ function Invoke-Starship-PreCommand {
## Change Window Title
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash` or `zsh`.
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash`, `zsh`, `cmd` or `powershell`.
First, define a window title change function (identical in bash and zsh):
@ -80,6 +104,16 @@ function set_win_title(){
starship_precmd_user_func="set_win_title"
```
For Cmd, you can change the window title using the `starship_preprompt_user_func` function.
```lua
function starship_preprompt_user_func(prompt)
console.settitle(os.getenv('USERNAME').."@"..os.getenv('COMPUTERNAME')..": "..os.getcwd())
end
load(io.popen('starship init cmd'):read("*a"))()
```
You can also set a similar output with PowerShell by creating a function named `Invoke-Starship-PreCommand`.
```powershell
@ -97,7 +131,7 @@ Some shells support a right prompt which renders on the same line as the input.
Note: The right prompt is a single line following the input location. To right align modules above the input line in a multi-line prompt, see the [fill module](/config/#fill).
`right_format` is currently supported for the following shells: elvish, fish, zsh.
`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd.
### Example
@ -117,6 +151,28 @@ Produces a prompt like the following:
▶ starship on  rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s
```
## Continuation Prompt
Some shells support a continuation prompt along with the normal prompt. This prompt is rendered instead of the normal prompt when the user has entered an incomplete statement (such as a single left parenthesis or quote).
Starship can set the continuation prompt using the `continuation_prompt` option. The default prompt is `"[∙](bright-black) "`.
Note: `continuation_prompt` should be set to a literal string without any variables.
Note: Continuation prompts are only available in the following shells:
- `bash`
- `zsh`
- `PowerShell`
### Example
```toml
# ~/.config/starship.toml
# A continuation prompt that displays two filled in arrows
continuation_prompt = "▶▶"
```
## Style Strings

View File

@ -24,13 +24,19 @@ disabled = true
You can change default configuration file location with `STARSHIP_CONFIG` environment variable:
```sh
export STARSHIP_CONFIG=~/.starship/config.toml
export STARSHIP_CONFIG=~/example/non/default/path/starship.toml
```
Equivalently in PowerShell (Windows) would be adding this line to your `$PROFILE`:
```powershell
$ENV:STARSHIP_CONFIG = "$HOME\.starship\config.toml"
$ENV:STARSHIP_CONFIG = "$HOME\example\non\default\path\starship.toml"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CONFIG', 'C:\\Users\\user\\example\\non\\default\\path\\starship.toml')
```
### Logging
@ -47,6 +53,12 @@ Equivalently in PowerShell (Windows) would be adding this line to your `$PROFILE
$ENV:STARSHIP_CACHE = "$HOME\AppData\Local\Temp"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CACHE', 'C:\\Users\\user\\AppData\\Local\\Temp')
```
### Terminology
**Module**: A component in the prompt giving information based on contextual information from your OS. For example, the "nodejs" module shows the version of Node.js that is currently installed on your computer, if your current directory is a Node.js project.
@ -425,13 +437,13 @@ By default it only changes color. If you also want to change its shape take a lo
::: warning
`error_symbol` is not supported on elvish and nu shell.
`error_symbol` is not supported on nu shell.
:::
::: warning
`vicmd_symbol` is only supported in fish and zsh.
`vicmd_symbol` is only supported in cmd, fish and zsh.
:::
@ -568,7 +580,7 @@ Bash users who need preexec-like functionality can use [rcaloras's bash_preexec
::: tip
Showing desktop notifications requires starship to be built with `rust-notify` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
Showing desktop notifications requires starship to be built with `notify-rust` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
:::
@ -713,20 +725,20 @@ format = "via [🔰 $version](bold red) "
## Deno
The `deno` module shows you your currently installed version of [Deno](https://deno.land/). By default the module will be shown if any of the following conditions are met:
- The current directory contains a `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
- The current directory contains a `deno.json`, `deno.jsonc`, `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
### Options
| Option | Default | Description |
| ------------------- | -------------------------------------------- | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
| `detect_files` | `["mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `"green bold"` | The style for the module. |
| `disabled` | `false` | Disables the `deno` module. |
| Option | Default | Description |
| ------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
| `detect_files` | `["deno.json", "deno.jsonc", "mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `"green bold"` | The style for the module. |
| `disabled` | `false` | Disables the `deno` module. |
### Variables
@ -755,18 +767,19 @@ For example, given `~/Dev/Nix/nixpkgs/pkgs` where `nixpkgs` is the repo root, an
### Options
| Option | Default | Description |
| ------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `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)[$read_only]($read_only_style) "` | The format for the module. |
| `style` | `"bold cyan"` | The style for the module. |
| `disabled` | `false` | Disables the `directory` module. |
| `read_only` | `"🔒"` | The symbol indicating current directory is read only. |
| `read_only_style` | `"red"` | The style for the read only symbol. |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | The symbol indicating home directory. |
| Option | Default | Description |
| ------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `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)[$read_only]($read_only_style) "` | The format for the module. |
| `style` | `"bold cyan"` | The style for the module. |
| `disabled` | `false` | Disables the `directory` module. |
| `read_only` | `"🔒"` | The symbol indicating current directory is read only. |
| `read_only_style` | `"red"` | The style for the read only symbol. |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | The symbol indicating home directory. |
| `use_os_path_sep` | `true` | Use the OS specific path seperator instead of always using `/` (e.g. `\` on Windows) |
<details>
<summary>This module has a few advanced configuration options that control how the directory is displayed.</summary>
@ -1334,22 +1347,23 @@ The `git_status` module shows symbols representing the state of the repo in your
### Options
| Option | Default | Description |
| ------------ | ----------------------------------------------- | ----------------------------------- |
| `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` |
| `style` | `"bold red"` | The style for the module. |
| `disabled` | `false` | Disables the `git_status` module. |
| Option | Default | Description |
| ------------------- | ----------------------------------------------- | ----------------------------------- |
| `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` |
| `style` | `"bold red"` | The style for the module. |
| `ignore_submodules` | `false` | Ignore changes to submodules. |
| `disabled` | `false` | Disables the `git_status` module. |
### Variables
@ -1513,10 +1527,10 @@ The `hostname` module shows the system hostname.
### Variables
| Variable | Example | Description |
| --------- | ------- | ------------------------------------ |
| symbol | | Mirrors the value of option `symbol` |
| style\* | | Mirrors the value of option `style` |
| Variable | Example | Description |
| --------- | ---------- | ----------------------------------- |
| hostname | `computer` | The hostname of the computer |
| style\* | | Mirrors the value of option `style` |
\*: This variable can only be used as a part of a style string
@ -2133,7 +2147,7 @@ symbol = "☁️ "
## 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`, `composer`, `gradle`, `julia`, `mix`, `helm` and `shards` packages.
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`, `composer`, `gradle`, `julia`, `mix`, `helm`, `shards` 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
@ -2150,6 +2164,7 @@ The `package` module is shown when the current directory is the repository for a
- [**Shards**](https://crystal-lang.org/reference/the_shards_command/index.html) - The `shards` package version is extracted from the `shard.yml` present
- [**V**](https://vlang.io) - The `vlang` package version is extracted from the `v.mod` present
- [**SBT**](https://scala-sbt.org) - The `sbt` package version is extracted from the `build.sbt` present in the current directory
- [**Dart**](https://pub.dev/) - The `dart` package version is extracted from the `pubspec.yaml` present in the current directory
> ⚠️ The version being shown is that of the package whose source code is in your current directory, not your package manager.
@ -2673,6 +2688,8 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
| `elvish_indicator` | `esh` | A format string used to represent elvish. |
| `tcsh_indicator` | `tsh` | A format string used to represent tcsh. |
| `xonsh_indicator` | `xsh` | A format string used to represent xonsh. |
| `cmd_indicator` | `cmd` | A format string used to represent cmd. |
| `nu_indicator` | `nu` | A format string used to represent nu. |
| `unknown_indicator` | | The default value to be displayed when the shell is unknown. |
| `format` | `"[$indicator]($style) "` | The format for the module. |
| `style` | `"white bold"` | The style for the module. |
@ -2778,7 +2795,7 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
:::
::: warning This module is not supported on elvish and nu shell. :::
::: warning This module is not supported on nu shell. :::
### Options
@ -2804,6 +2821,7 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
| Variable | Example | Description |
| -------------- | ------- | ------------------------------------------------------------------------------------------- |
| status | `127` | The exit code of the last command |
| hex_status | `0x7F` | The exit code of the last command in hex |
| int | `127` | The exit code of the last command |
| common_meaning | `ERROR` | Meaning of the code if not a signal |
| signal_number | `9` | Signal number corresponding to the exit code, only if signalled |

View File

@ -69,13 +69,13 @@ If you see symbols that you don't recognise you can use `starship explain` to ex
You can enable the debug logs by using the `STARSHIP_LOG` env var. These logs can be very verbose so it is often useful to use the `module` command if you are trying to debug a particular module, for example, if you are trying to debug the `rust` module you could run the following command to get the trace logs and output from the module.
```sh
env STARHIP_LOG=trace starship module rust
env STARSHIP_LOG=trace starship module rust
```
If starship is being slow you can try using the `timings` command to see if there is a particular module or command that to blame.
```sh
env STARHIP_LOG=trace starship timings
env STARSHIP_LOG=trace starship timings
```
This will output the trace log and a breakdown of all modules that either took more than 1ms to execute or produced some output.
@ -118,5 +118,5 @@ If Starship was installed using the install script, the following command will d
```sh
# Locate and delete the starship binary
sh -c 'rm "$(which starship)"'
sh -c 'rm "$(command -v 'starship')"'
```

View File

@ -72,6 +72,22 @@
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-fr.png"
alt="Français"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/id-ID/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-id.png"
alt="Bahasa Indonesia"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/it-IT/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-it.png"
alt="Italiano"
/></a>
&nbsp;
<a
@ -252,7 +268,7 @@
#### Elvish
**Warning** Only elvish v0.15 or higher is supported. Add the following to the end of `~/.elvish/rc.elv`:
**Warning** Only elvish v0.17 or higher is supported. Add the following to the end of `~/.elvish/rc.elv`:
```sh
# ~/.elvish/rc.elv
@ -283,6 +299,17 @@
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```
#### Nushell
**Warning** This will change in the future. Only nu version v0.33 or higher is supported. Add the following to your nu config file. You can check the location of this file by running `config path` in nu.

View File

@ -224,7 +224,7 @@ format = '\[[$symbol($version)]($style)\]'
format = '\[[$symbol($version)]($style)\]'
[sudo]
format = '\[[as $symbol]\]
format = '\[[as $symbol]\]'
[swift]
format = '\[[$symbol($version)]($style)\]'

View File

@ -18,7 +18,7 @@ features:
footer: Под лицензией ISC | Авторское право © 2019-настоящее Starship Contributors
#Used for the description meta tag, for SEO
metaTitle: "Starship: Cross-Shell Prompt"
description: Starship - минимальная, быстрая и бесконечная настраиваемая командная строка для любой оболочки! Показывает нужную вам информацию, оставаясь красивой и минималистичной. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, and PowerShell.
description: Starship - минимальная, быстрая и бесконечная настраиваемая командная строка для любой оболочки! Показывает нужную вам информацию, оставаясь красивой и минималистичной. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and PowerShell.
---
<div class="center">
@ -119,7 +119,7 @@ description: Starship - минимальная, быстрая и бесконе
#### Elvish
::: warning Only elvish v0.15 or higher is supported. :::
::: warning Only elvish v0.17 or higher is supported. :::
Добавьте следующую строку в конец `~/.elvish/rc.elv`:
@ -164,3 +164,14 @@ description: Starship - минимальная, быстрая и бесконе
execx($(starship init xonsh))
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```

View File

@ -8,11 +8,35 @@
:::
## Пользовательские команды перед командной строкой и перед запуском Bash
## Custom pre-prompt and pre-execution Commands in Cmd
Bash не имеет формальной среды preexec/precmd, как и большинство других оболочек. Из-за этого трудно предоставить полностью настраиваемые хуки в `bash`. Тем не менее, Starship дает вам ограниченную возможность вставить собственные функции в процедуру отображения подсказки:
Clink provides extremely flexible APIs to run pre-prompt and pre-exec commands in Cmd shell. It is fairly simple to use with Starship. Make the following changes to your `starship.lua` file as per your requirements:
- Чтобы запустить пользовательскую функцию прямо перед отображением подсказки, определите новую функцию и затем назначьте ей имя `starship_precmd_user_func`. Например, чтобы нарисовать ракету перед появлением подсказки, сделайте
- To run a custom function right before the prompt is drawn, define a new function called `starship_preprompt_user_func`. This function receives the current prompt as a string that you can utilize. For example, to draw a rocket before the prompt, you would do
```lua
function starship_preprompt_user_func(prompt)
print("🚀")
end
load(io.popen('starship init cmd'):read("*a"))()
```
- To run a custom function right before a command is executed, define a new function called `starship_precmd_user_func`. This function receives the current commandline as a string that you can utilize. For example, to print the command that's about to be executed, you would do
```lua
function starship_precmd_user_func(line)
print("Executing: "..line)
end
load(io.popen('starship init cmd'):read("*a"))()
```
## Custom pre-prompt and pre-execution Commands in Bash
Bash does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `bash`. Тем не менее, Starship дает вам ограниченную возможность вставить собственные функции в процедуру отображения подсказки:
- To run a custom function right before the prompt is drawn, define a new function and then assign its name to `starship_precmd_user_func`. For example, to draw a rocket before the prompt, you would do
```bash
function blastoff(){
@ -21,7 +45,7 @@ function blastoff(){
starship_precmd_user_func="blastoff"
```
- To run a custom function right before a command runs, you can use the [`DEBUG` trap mechanism](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). Тем не менее, вы **должны** поймать сигнал DEBUG *перед* инициализацией Starship! Starship может сохранить значение ловушки DEBUG, но если ловушка перезаписана после запуска Starship, некоторая функциональность сломается.
- To run a custom function right before a command runs, you can use the [`DEBUG` trap mechanism](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). However, you **must** trap the DEBUG signal *before* initializing Starship! Starship can preserve the value of the DEBUG trap, but if the trap is overwritten after starship starts up, some functionality will break.
```bash
function blastoff(){
@ -43,11 +67,11 @@ function Invoke-Starship-PreCommand {
}
```
## Изменение заголовка окна
## Change Window Title
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish даже делает это по умолчанию. Starship не делает этого, но достаточно легко добавить эту функциональность к `bash` или `zsh`.
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash`, `zsh`, `cmd` or `powershell`.
Сначала задайте функцию изменения заголовка окна (идентичную в bash и zsh):
First, define a window title change function (identical in bash and zsh):
```bash
function set_win_title(){
@ -55,15 +79,15 @@ function set_win_title(){
}
```
Вы можете использовать переменные для настройки этого заголовка (`$USER`, `$HOSTNAME`, и `$PWD` являются популярными вариантами).
You can use variables to customize this title (`$USER`, `$HOSTNAME`, and `$PWD` are popular choices).
В `bash`, установите эту функцию как функцию precmd в Starship:
In `bash`, set this function to be the precmd starship function:
```bash
starship_precmd_user_func="set_win_title"
```
В `zsh`, добавьте это в массив `precmd_functions`:
In `zsh`, add this to the `precmd_functions` array:
```bash
precmd_functions+=(set_win_title)
@ -71,7 +95,7 @@ precmd_functions+=(set_win_title)
If you like the result, add these lines to your shell configuration file (`~/.bashrc` or `~/.zshrc`) to make it permanent.
Например, если вы хотите отобразить ваш текущий каталог в заголовке вкладки терминала, добавьте следующие строки в `~/. bashrc` или `~/.zshrc`:
For example, if you want to display your current directory in your terminal tab title, add the following snippet to your `~/.bashrc` or `~/.zshrc`:
```bash
function set_win_title(){
@ -80,6 +104,16 @@ function set_win_title(){
starship_precmd_user_func="set_win_title"
```
For Cmd, you can change the window title using the `starship_preprompt_user_func` function.
```lua
function starship_preprompt_user_func(prompt)
console.settitle(os.getenv('USERNAME').."@"..os.getenv('COMPUTERNAME')..": "..os.getcwd())
end
load(io.popen('starship init cmd'):read("*a"))()
```
You can also set a similar output with PowerShell by creating a function named `Invoke-Starship-PreCommand`.
```powershell
@ -97,7 +131,7 @@ Some shells support a right prompt which renders on the same line as the input.
Note: The right prompt is a single line following the input location. To right align modules above the input line in a multi-line prompt, see the [fill module](/config/#fill).
`right_format` is currently supported for the following shells: elvish, fish, zsh.
`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd.
### Пример
@ -117,10 +151,32 @@ Produces a prompt like the following:
▶ starship on  rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s
```
## Continuation Prompt
Some shells support a continuation prompt along with the normal prompt. This prompt is rendered instead of the normal prompt when the user has entered an incomplete statement (such as a single left parenthesis or quote).
Starship can set the continuation prompt using the `continuation_prompt` option. The default prompt is `"[∙](bright-black) "`.
Note: `continuation_prompt` should be set to a literal string without any variables.
Note: Continuation prompts are only available in the following shells:
- `bash`
- `zsh`
- `PowerShell`
### Пример
```toml
# ~/.config/starship.toml
# A continuation prompt that displays two filled in arrows
continuation_prompt = "▶▶"
```
## Строки стиля
Строки стиля - это список слов, разделенных пробелами. Слова не чувствительны к регистру (то есть `bold` и `BoLd` считаются одной строкой). Каждое слово может быть одним из следующих:
Style strings are a list of words, separated by whitespace. The words are not case sensitive (i.e. `bold` and `BoLd` are considered the same string). Each word can be one of the following:
- `bold`
- `italic`
@ -132,14 +188,14 @@ Produces a prompt like the following:
- `<color>`
- `none`
где `<color>` является цветовым спецификатором (обсуждается ниже). `fg:<color>` and `<color>` currently do the same thing, though this may change in the future. `inverted` swaps the background and foreground colors. Порядок слов в строке не имеет значения.
where `<color>` is a color specifier (discussed below). `fg:<color>` and `<color>` currently do the same thing, though this may change in the future. `inverted` swaps the background and foreground colors. The order of words in the string does not matter.
Токен `none` переопределяет все остальные токены в строке, если он не является частью спецификатора `bg:` так, например, `fg:red none fg:blue` все равно создаст строку без стиля. `bg:none` sets the background to the default color so `fg:red bg:none` is equivalent to `red` or `fg:red` and `bg:green fg:red bg:none` is also equivalent to `fg:red` or `red`. Использование `none` в сочетании с другими токенами может стать ошибкой в будущем.
The `none` token overrides all other tokens in a string if it is not part of a `bg:` specifier, so that e.g. `fg:red none fg:blue` will still create a string with no styling. `bg:none` sets the background to the default color so `fg:red bg:none` is equivalent to `red` or `fg:red` and `bg:green fg:red bg:none` is also equivalent to `fg:red` or `red`. It may become an error to use `none` in conjunction with other tokens in the future.
Цветовой спецификатор может быть одним из следующих:
A color specifier can be one of the following:
- Некоторые из стандартных цветов терминалов: `black`, `red`, `green`, `blue`, `gellow`, `purple`, `cyan`, `white`. Вы можете по желанию добавить префикс `bright-`, чтобы получить яркую версию (например, `bright-white`).
- `#`, за которой следует шестизначное шестнадцатеричное число. Это определяет [шестнадцатеричный код цвета RGB](https://www.w3schools.com/colors/colors_hexadecimal.asp).
- Число от 0 до 255. Это определяет [8-битный код цвета ANSI](https://i.stack.imgur.com/KTSQa.png).
- One of the standard terminal colors: `black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`. You can optionally prefix these with `bright-` to get the bright version (e.g. `bright-white`).
- A `#` followed by a six-digit hexadecimal number. This specifies an [RGB color hex code](https://www.w3schools.com/colors/colors_hexadecimal.asp).
- A number between 0-255. This specifies an [8-bit ANSI Color Code](https://i.stack.imgur.com/KTSQa.png).
Если для переднего плана/фона задано несколько цветов, то последняя из строк будет иметь приоритет.
If multiple colors are specified for foreground/background, the last one in the string will take priority.

View File

@ -24,18 +24,24 @@ disabled = true
You can change default configuration file location with `STARSHIP_CONFIG` environment variable:
```sh
export STARSHIP_CONFIG=~/.starship/config.toml
export STARSHIP_CONFIG=~/example/non/default/path/starship.toml
```
Аналогично в PowerShell (Windows) следует добавить эту строку в `$PROFILE`:
```powershell
$ENV:STARSHIP_CONFIG = "$HOME\.starship\config.toml"
$ENV:STARSHIP_CONFIG = "$HOME\example\non\default\path\starship.toml"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CONFIG', 'C:\\Users\\user\\example\\non\\default\\path\\starship.toml')
```
### Логгирование (Запись действий)
По умолчанию в starship записываются предупреждения и ошибки в файл с именем `~/.cache/starship/session_${STARSHIP_SESSION_KEY}.log`, где ключ сессии соответствует экземпляру терминала. Это, однако, может быть изменено с помощью переменной окружения `STARSHIP_CACHE`:
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
@ -47,23 +53,29 @@ export STARSHIP_CACHE=~/.starship/cache
$ENV:STARSHIP_CACHE = "$HOME\AppData\Local\Temp"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CACHE', 'C:\\Users\\user\\AppData\\Local\\Temp')
```
### Терминология
**Модуль**: Компонент строки, дающий информацию на основе контекстной информации вашей ОС. For example, the "nodejs" module shows the version of Node.js that is currently installed on your computer, if your current directory is a Node.js project.
**Module**: A component in the prompt giving information based on contextual information from your OS. For example, the "nodejs" module shows the version of Node.js that is currently installed on your computer, if your current directory is a Node.js project.
**Variable**: Smaller sub-components that contain information provided by the module. For example, the "version" variable in the "nodejs" module contains the current version of Node.js.
По традициям, большинство модулей имеют префикс цвета терминала по умолчанию (например, `через` в "узлах") и пустое пространство как суффикс.
By convention, most modules have a prefix of default terminal color (e.g. `via` in "nodejs") and an empty space as a suffix.
### Форматирование строк
Формат строк - это формат, с которым модуль печатает все переменные. Большинство модулей имеют запись `формата`, который настраивает формат отображения модуля. Вы можете использовать тексты, переменные и группы текста в строке формата.
Format strings are the format that a module prints all its variables with. Most modules have an entry called `format` that configures the display format of the module. You can use texts, variables and text groups in a format string.
#### Переменная
Переменная содержит символ `$`, за которым следует имя переменной. The name of a variable can only contain letters, numbers and `_`.
A variable contains a `$` symbol followed by the name of the variable. The name of a variable can only contain letters, numbers and `_`.
Например:
For example:
- `$version` это строка формата с именем `версии`.
- `$git_branch$git_commit` это строка формата с двумя переменными `git_branch` и `git_commit`.
@ -71,13 +83,13 @@ $ENV:STARSHIP_CACHE = "$HOME\AppData\Local\Temp"
#### Группа текста
Текстовая группа состоит из двух различных частей.
A text group is made up of two different parts.
Первая часть, которая заключена в `[]`, это [формат строки](#format-strings). Вы можете добавлять в него тексты, переменные, или даже вложенные текстовые группы.
The first part, which is enclosed in a `[]`, is a [format string](#format-strings). You can add texts, variables, or even nested text groups in it.
Во второй части, которая заключена в `()`, это строка стиля [](#style-strings). This can be used to style the first part.
In the second part, which is enclosed in a `()`, is a [style string](#style-strings). This can be used to style the first part.
Например:
For example:
- `[on](red bold)` будет печатать строку `on` жирным текстом красного цвета.
- `[⌘ $version](bold green)` will print a symbol `⌘` followed by the content of variable `version`, with bold text colored green.
@ -85,7 +97,7 @@ $ENV:STARSHIP_CACHE = "$HOME\AppData\Local\Temp"
#### Строки стиля
В 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"` устанавливает ярко-зеленый текст на синем фоне
@ -94,13 +106,13 @@ $ENV:STARSHIP_CACHE = "$HOME\AppData\Local\Temp"
- `"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.
#### Строки условного формата
Строка условного формата, завернутая в `(` и `)` не будет отображаться, если все переменные внутри являются пустыми.
A conditional format string wrapped in `(` and `)` will not render if all variables inside are empty.
Например:
For example:
- `(@$region)` will show nothing if the variable `region` is `None` or empty string, otherwise `@` followed by the value of region.
- `(некоторый текст)` всегда не показывает ничего, поскольку в скобках нет переменных.
@ -112,18 +124,18 @@ The following symbols have special usage in a format string and must be escaped:
Note that TOML has [both basic strings and literal strings](https://toml.io/en/v1.0.0#string). It is recommended to use a literal string (surrounded by single quotes) in your config. If you want to use a basic string (surrounded by double quotes), you must escape the backslash itself (i.e. use `\\`).
Например, когда вы хотите напечатать символ `$` на новой строке, следующие настройки для `формата` эквивалентны:
For example, when you want to print a `$` symbol on a new line, the following configs for `format` are equivalent:
```toml
# с базовой строкой
# with basic string
format = "\n\\$"
# с многолинейной строкой
# with multiline basic string
format = """
\\$"""
# со строкой, состоящей из литералов
# with literal string
format = '''
\$'''
@ -131,7 +143,7 @@ format = '''
## Командная строка
Ниже находится список опций, применяющихся для всей командной строки.
This is the list of prompt-wide configuration options.
### Опции
@ -149,13 +161,13 @@ format = '''
```toml
# ~/.config/starship.toml
# Собственное форматирование оболочки
# Use custom format
format = """
[┌───────────────────>](bold green)
[](bold green)$directory$rust$package
[└─>](bold green) """
# Подождите 10 милисекунд пока starship прочитает файлы в этой директории.
# Wait 10 milliseconds for starship to check files under the current directory.
scan_timeout = 10
# Disable the blank line at the start of the prompt
@ -164,7 +176,7 @@ add_newline = false
### Формат оболочки по умолчанию
Формат по умолчанию `format` используется для определения формата подсказки (prompt), если `format` пустой или отсутствует. Значение по умолчанию:
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 = "$all"
@ -248,7 +260,7 @@ format="$all$directory$character"
## AWS
Модуль `aws` показывает текущий регион и профиль AWS. Основано на `AWS_REGION`, `AWS_DEFAULT_REGION`, и `AWS_PROFILE` переменных окружения и файле`~/.aws/config`. This module also shows an expiration timer when using temporary credentials.
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. This module also shows an expiration timer when using temporary credentials.
When using [aws-vault](https://github.com/99designs/aws-vault) the profile is read from the `AWS_VAULT` env var and the credentials expiration date is read from the `AWS_SESSION_EXPIRATION` env var.
@ -347,7 +359,7 @@ style = "blue bold"
## Батарея
Модуль `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%.
### Опции
@ -375,7 +387,7 @@ discharging_symbol = "💀 "
### Отображение батареи
The `display` configuration option is used to define when the battery indicator should be shown (threshold), which symbol would be used (symbol), and what it would like (style). Если `display` не предоставлено. Значение по умолчанию:
The `display` configuration option is used to define when the battery indicator should be shown (threshold), which symbol would be used (symbol), and what it would like (style). If no `display` is provided. The default is as shown:
```toml
[[battery.display]]
@ -387,7 +399,7 @@ The default value for the `charging_symbol` and `discharging_symbol` option is r
#### Опции
Опция `display` представляет собой массив следующей таблицы.
The `display` option is an array of the following table.
| Параметр | По умолчанию | Описание |
| -------------------- | ------------ | --------------------------------------------------------------------------------------------------------- |
@ -414,9 +426,9 @@ discharging_symbol = "💦"
## Символ
Модуль `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 (``/`✖`)
@ -425,13 +437,13 @@ By default it only changes color. If you also want to change its shape take a lo
::: warning
`error_symbol` is not supported on elvish and nu shell.
`error_symbol` is not supported on nu shell.
:::
::: warning
`vicmd_symbol` is only supported in fish and zsh.
`vicmd_symbol` is only supported in cmd, fish and zsh.
:::
@ -544,15 +556,15 @@ The `cobol` module shows the currently installed version of COBOL. By default, t
## Длительность команды
Модуль `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.
::: предупреждение Не подключайте ловушку DEBUG к Bash
::: warning Do not hook the DEBUG trap in Bash
Если вы испоьзуете Starship в `bash`, не подключайте ловушку `DEBUG` после запуска `eval $(starship init $0)`, иначе этот модуль сломается.
If you are running Starship in `bash`, do not hook the `DEBUG` trap after running `eval $(starship init $0)`, or this module **will** break.
:::
Пользователи Bash, которым нужна функциональность, подобная preexec, могут использовать [фреймворк bash_preexec от rcaloras](https://github.com/rcaloras/bash-preexec). Просто определите массивы `preexec_functions` и `precmd_functions` перед запуском `eval $(starship init $0)`, а затем продолжайте нормально.
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.
### Опции
@ -566,9 +578,9 @@ The `cobol` module shows the currently installed version of COBOL. By default, t
| `show_notifications` | `false` | Show desktop notifications when command completes. |
| `min_time_to_notify` | `45_000` | Shortest duration for notification (in milliseconds). |
::: tip Подсказка
::: tip
Showing desktop notifications requires starship to be built with `rust-notify` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
Showing desktop notifications requires starship to be built with `notify-rust` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
:::
@ -595,9 +607,9 @@ format = "underwent [$duration](bold yellow)"
The `conda` module shows the current [Conda](https://docs.conda.io/en/latest/) environment, if `$CONDA_DEFAULT_ENV` is set.
::: tip Подсказка
::: tip
Это не подавляет модификатор командной строки самой conda. Возможно, вы захотите запустить `conda config --set changeps1 False`.
This does not suppress conda's own prompt modifier, you may want to run `conda config --set changeps1 False`.
:::
@ -713,20 +725,20 @@ format = "via [🔰 $version](bold red) "
## Deno
The `deno` module shows you your currently installed version of [Deno](https://deno.land/). By default the module will be shown if any of the following conditions are met:
- Текущий каталог содержит файл `mod.ts`, `mod.js`, `deps.ts` или `deps.js`
- The current directory contains a `deno.json`, `deno.jsonc`, `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
### Опции
| Параметр | По умолчанию | Описание |
| ------------------- | -------------------------------------------- | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | Формат модуля. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
| `detect_files` | `["mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `"green bold"` | Стиль модуля. |
| `disabled` | `false` | Disables the `deno` module. |
| Параметр | По умолчанию | Описание |
| ------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | Формат модуля. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
| `detect_files` | `["deno.json", "deno.jsonc", "mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `"green bold"` | Стиль модуля. |
| `disabled` | `false` | Disables the `deno` module. |
### Переменные
@ -747,29 +759,30 @@ format = "via [🦕 $version](green bold) "
## Каталог
Модуль `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, вместо скрытия усеченного каталога, вы увидите укороченное имя каталога, зависимое от числа символов вы установите для этой опции.
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)[$read_only]($read_only_style) "` | Формат модуля. |
| `style` | `"bold cyan"` | Стиль модуля. |
| `disabled` | `false` | Отключает модуль `directory`. |
| `read_only` | `"🔒"` | The symbol indicating current directory is read only. |
| `read_only_style` | `"red"` | The style for the read only symbol. |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | The symbol indicating home directory. |
| Параметр | По умолчанию | Описание |
| ------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `truncation_length` | `3` | Количество родительских папок, к которым должен быть усечен текущий каталог. |
| `truncate_to_repo` | `true` | Следует или нет обрезать до корня репозитория git, в котором вы находитесь. |
| `format` | `"[$path]($style)[$read_only]($read_only_style) "` | Формат модуля. |
| `style` | `"bold cyan"` | Стиль модуля. |
| `disabled` | `false` | Отключает модуль `directory`. |
| `read_only` | `"🔒"` | The symbol indicating current directory is read only. |
| `read_only_style` | `"red"` | The style for the read only symbol. |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | The symbol indicating home directory. |
| `use_os_path_sep` | `true` | Use the OS specific path seperator instead of always using `/` (e.g. `\` on Windows) |
<details>
<summary>Этот модуль имеет несколько расширенных опций конфигурации, которые контролируют отображение каталога.</summary>
<summary>This module has a few advanced configuration options that control how the directory is displayed.</summary>
| Advanced Option | По умолчанию | Описание |
| --------------------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@ -785,7 +798,7 @@ format = "via [🦕 $version](green bold) "
"src/com/long/java/path" = "mypath"
```
`fish_style_pwd_dir_length` взаимодействует со стандартными параметрами усечения, которые могут сначала показаться странными: если он не равен нулю, элементы пути, который обычно усекается, вместо этого отображаются с указанным количеством символов. For example, the path `/built/this/city/on/rock/and/roll`, which would normally be displayed as as `rock/and/roll`, would be displayed as `/b/t/c/o/rock/and/roll` with `fish_style_pwd_dir_length = 1`--the path components that would normally be removed are displayed with a single character. For `fish_style_pwd_dir_length = 2`, it would be `/bu/th/ci/on/rock/and/roll`.
`fish_style_pwd_dir_length` interacts with the standard truncation options in a way that can be surprising at first: if it's non-zero, the components of the path that would normally be truncated are instead displayed with that many characters. For example, the path `/built/this/city/on/rock/and/roll`, which would normally be displayed as as `rock/and/roll`, would be displayed as `/b/t/c/o/rock/and/roll` with `fish_style_pwd_dir_length = 1`--the path components that would normally be removed are displayed with a single character. For `fish_style_pwd_dir_length = 2`, it would be `/bu/th/ci/on/rock/and/roll`.
</details>
@ -846,7 +859,7 @@ format = "via [🐋 $context](blue bold)"
## Dotnet
The `dotnet` module shows the relevant version of the [.NET Core SDK](https://dotnet.microsoft.com/) for the current directory. Если SDK был закреплен в текущей директории, будет показана закрепленная версия. В противном случае модуль отображает последнюю установленную версию SDK.
The `dotnet` module shows the relevant version of the [.NET Core SDK](https://dotnet.microsoft.com/) 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.
By default this module will only be shown in your prompt when one or more of the following files are present in the current directory:
@ -861,7 +874,7 @@ By default this module will only be shown in your prompt when one or more of the
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.
@ -984,7 +997,7 @@ format = "via [ $version](cyan bold) "
## Переменная Окружения
The `env_var` module displays the current value of a selected environment variables. Модуль будет показан только в том случае, если любое из следующих условий соблюдено:
The `env_var` module displays the current value of a selected environment variables. The module will be shown only if any of the following conditions are met:
- Опция `variable` соответствует существующей переменной среды
- Опция `variable` не определена, но определена опция `default`
@ -1174,7 +1187,7 @@ asia-northeast1 = "an1"
## Ветвь Git
Модуль `git_branch` показывает активную ветку репозитория в вашем текущей директории.
The `git_branch` module shows the active branch of the repo in your current directory.
### Опции
@ -1249,7 +1262,7 @@ tag_symbol = "🔖 "
## Состояние Git
Модуль `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.
### Опции
@ -1291,9 +1304,9 @@ cherry_pick = "[🍒 PICKING](bold red)"
The `git_metrics` module will show the number of added and deleted lines in the current git repository.
::: tip Подсказка
::: tip
По умолчанию этот модуль отключен. Чтобы включить его, установите `disabled` на `false` в файле конфигурации.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -1330,26 +1343,27 @@ format = '[+$added]($added_style)/[-$deleted]($deleted_style) '
## Статус Git
Модуль `git_status` отображает символы, представляющие состояние репозитория в вашей текущей директории.
The `git_status` module shows symbols representing the state of the repo in your current directory.
### Опции
| Параметр | По умолчанию | Описание |
| ------------ | ----------------------------------------------- | ----------------------------------- |
| `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` |
| `style` | `"bold red"` | Стиль модуля. |
| `disabled` | `false` | Отключает модуль `git_status`. |
| Параметр | По умолчанию | Описание |
| ------------------- | ----------------------------------------------- | ----------------------------------- |
| `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` |
| `style` | `"bold red"` | Стиль модуля. |
| `ignore_submodules` | `false` | Ignore changes to submodules. |
| `disabled` | `false` | Disables the `git_status` module. |
### Переменные
@ -1402,7 +1416,7 @@ renamed = "👅"
deleted = "🗑"
```
Показывать счетчик впереди/позади для отслеживаемой ветки
Show ahead/behind count of the branch being tracked
```toml
# ~/.config/starship.toml
@ -1499,7 +1513,7 @@ format = "via [⎈ $version](bold white) "
## Имя хоста
Модуль `hostname` отображает имя системного хоста.
The `hostname` module shows the system hostname.
### Опции
@ -1513,10 +1527,10 @@ format = "via [⎈ $version](bold white) "
### Переменные
| Переменная | Пример | Описание |
| ---------- | ------ | ------------------------------------ |
| symbol | | Отражает значение параметра `symbol` |
| style\* | | Отражает значение параметра `style` |
| Переменная | Пример | Описание |
| ---------- | ---------- | ----------------------------------- |
| hostname | `computer` | The hostname of the computer |
| style\* | | Отражает значение параметра `style` |
\*: Эта переменная может использоваться только в качестве части строки style
@ -1573,7 +1587,7 @@ symbol = "🌟 "
## Задачи
Модуль `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 `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.
The default functionality is:
@ -1720,9 +1734,9 @@ kotlin_binary = "kotlinc"
Displays the current [Kubernetes context](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#context) name and, if set, the namespace from the kubeconfig file. The namespace needs to be set in the kubeconfig file, this can be done via `kubectl config set-context starship-cluster --namespace astronaut`. If the `$KUBECONFIG` env var is set the module will use that if not it will use the `~/.kube/config`.
::: tip Подсказка
::: tip
По умолчанию этот модуль отключен. Чтобы включить его, установите `disabled` на `false` в файле конфигурации.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -1784,7 +1798,7 @@ Long and automatically generated cluster names can be identified and shortened u
## Перевод Строки
Модуль `line_break` разделяет командную строку на две строки.
The `line_break` module separates the prompt into two lines.
### Опции
@ -1844,13 +1858,13 @@ format = "via [🌕 $version](bold blue) "
## Использование памяти
Модуль `memory_usage` отображает текущую системную память и использование подкачки.
The `memory_usage` module shows current system memory and swap usage.
По умолчанию использование подкачки отображается, если общая сумма подкачки системы не равна нулю.
By default the swap usage is displayed if the total system swap is non-zero.
::: tip Подсказка
::: tip
По умолчанию этот модуль отключен. Чтобы включить его, установите `disabled` на `false` в файле конфигурации.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -1891,7 +1905,7 @@ style = "bold dimmed green"
## Ветка Mercurial
Модуль `hg_branch` показывает активную ветку репозитория в вашем текущем каталоге.
The `hg_branch` module shows the active branch of the repo in your current directory.
### Опции
@ -1969,7 +1983,7 @@ symbol = "🎣 "
## Nix-shell
The `nix_shell` module shows the [nix-shell](https://nixos.org/guides/nix-pills/developing-with-nix-shell.html) environment. Модуль будет показываться внутри среды 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.
### Опции
@ -2133,7 +2147,7 @@ symbol = "☁️ "
## Версия пакета
Модуль `package` отображается, когда текущий каталог является репозиторием для пакета и показывает его текущую версию. The module currently supports `npm`, `nimble`, `cargo`, `poetry`, `composer`, `gradle`, `julia`, `mix`, `helm` and `shards` packages.
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`, `composer`, `gradle`, `julia`, `mix`, `helm`, `shards` 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
@ -2150,6 +2164,7 @@ symbol = "☁️ "
- [**Shards**](https://crystal-lang.org/reference/the_shards_command/index.html) - The `shards` package version is extracted from the `shard.yml` present
- [**V**](https://vlang.io) - The `vlang` package version is extracted from the `v.mod` present
- [**SBT**](https://scala-sbt.org) - The `sbt` package version is extracted from the `build.sbt` present in the current directory
- [**Dart**](https://pub.dev/) - The `dart` package version is extracted from the `pubspec.yaml` present in the current directory
> ⚠ Показана версия пакета, исходный код которого находится в текущем каталоге, а не в менеджере пакетов.
@ -2267,7 +2282,7 @@ format = "via [🔹 $version](147 bold) "
The `pulumi` module shows the currently selected [Pulumi Stack](https://www.pulumi.com/docs/intro/concepts/stack/) and version.
::: tip Подсказка
::: tip
By default the Pulumi version is not shown, since it takes an order of magnitude longer to load then most plugins (~70ms). If you still want to enable it, [follow the example shown below](#with-pulumi-version).
@ -2393,7 +2408,7 @@ By default the module will be shown if any of the following conditions are met:
| `detect_folders` | `[]` | Which folders should trigger this module |
| `disabled` | `false` | Disables the `python` module. |
::: tip Подсказка
::: tip
The `python_binary` variable accepts either a string or a list of strings. Starship will try executing each binary until it gets a result. Note you can only change the binary that Starship executes to get the version of Python not the arguments that are used.
@ -2655,9 +2670,9 @@ symbol = "🌟 "
The `shell` module shows an indicator for currently used shell.
::: tip Подсказка
::: tip
По умолчанию этот модуль отключен. Чтобы включить его, установите `disabled` на `false` в файле конфигурации.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -2673,6 +2688,8 @@ The `shell` module shows an indicator for currently used shell.
| `elvish_indicator` | `esh` | A format string used to represent elvish. |
| `tcsh_indicator` | `tsh` | A format string used to represent tcsh. |
| `xonsh_indicator` | `xsh` | A format string used to represent xonsh. |
| `cmd_indicator` | `cmd` | A format string used to represent cmd. |
| `nu_indicator` | `nu` | A format string used to represent nu. |
| `unknown_indicator` | | The default value to be displayed when the shell is unknown. |
| `format` | `"[$indicator]($style) "` | Формат модуля. |
| `style` | `"white bold"` | Стиль модуля. |
@ -2772,13 +2789,13 @@ format = '[📦 \[$env\]]($style) '
The `status` module displays the exit code of the previous command. The module will be shown only if the exit code is not `0`.
::: tip Подсказка
::: tip
По умолчанию этот модуль отключен. Чтобы включить его, установите `disabled` на `false` в файле конфигурации.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
::: warning This module is not supported on elvish and nu shell. :::
::: warning This module is not supported on nu shell. :::
### Опции
@ -2804,6 +2821,7 @@ The `status` module displays the exit code of the previous command. The module w
| Переменная | Пример | Описание |
| -------------- | ------- | ------------------------------------------------------------------------------------------- |
| status | `127` | The exit code of the last command |
| hex_status | `0x7F` | The exit code of the last command in hex |
| int | `127` | The exit code of the last command |
| common_meaning | `ERROR` | Meaning of the code if not a signal |
| signal_number | `9` | Signal number corresponding to the exit code, only if signalled |
@ -2834,9 +2852,9 @@ disabled = false
The `sudo` module displays if sudo credentials are currently cached. The module will only be shown if credentials are cached.
::: tip Подсказка
::: tip
По умолчанию этот модуль отключен. Чтобы включить его, установите `disabled` на `false` в файле конфигурации.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -2923,7 +2941,7 @@ format = "via [🏎 $version](red bold)"
The `terraform` module shows the currently selected [Terraform workspace](https://www.terraform.io/docs/language/state/workspaces.html) and version.
::: tip Подсказка
::: tip
By default the Terraform version is not shown, since this is slow for current versions of Terraform when a lot of plugins are in use. If you still want to enable it, [follow the example shown below](#with-terraform-version).
@ -2980,11 +2998,11 @@ format = "[🏎💨 $workspace]($style) "
## Время
Модуль `time` показывает текущее **локальное** время. Значение конфигурации `format` используется пакетом [`chrono`](https://crates.io/crates/chrono) для контроля того, как отображается время. Ознакомьтесь с [документацией chrono strftime](https://docs.rs/chrono/0.4.7/chrono/format/strftime/index.html), чтобы увидеть доступные параметры.
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.
::: tip Подсказка
::: tip
По умолчанию этот модуль отключен. Чтобы включить его, установите `disabled` на `false` в файле конфигурации.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -3000,7 +3018,7 @@ format = "[🏎💨 $workspace]($style) "
| `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"`. Иначе по умолчанию используется `"%T"`. Manually setting `time_format` will override the `use_12hr` setting.
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.
### Переменные
@ -3026,14 +3044,14 @@ time_range = "10:00:00-14:00:00"
## Имя пользователя
Модуль `username` показывает имя активного пользователя. Модуль будет показан, если любое из следующих условий соблюдено:
The `username` module shows active user's username. Модуль будет показан, если любое из следующих условий соблюдено:
- Текущий пользователь - root
- Текущий пользователь отличается от залогиненного
- Пользователь подключен к SSH-сессии
- Переменная `show_always` равна true
::: tip Подсказка
::: tip
SSH connection is detected by checking environment variables `SSH_CONNECTION`, `SSH_CLIENT`, and `SSH_TTY`. If your SSH host does not set up these variables, one workaround is to set one of them with a dummy value.
@ -3224,19 +3242,19 @@ These modules will be shown if any of the following conditions are met:
- The `when` command returns 0
- The current Operating System (std::env::consts::OS) matchs with `os` field if defined.
::: tip Подсказка
::: tip
Multiple custom modules can be defined by using a `.`.
:::
::: tip Подсказка
::: tip
The order in which custom modules are shown can be individually set by including `${custom.foo}` in the top level `format` (as it includes a dot, you need to use `${...}`). By default, the `custom` module will simply show all custom modules in the order they were defined.
:::
::: tip Подсказка
::: tip
[Issue #1252](https://github.com/starship/starship/discussions/1252) contains examples of custom modules. If you have an interesting example not covered there, feel free to share it there!

View File

@ -69,13 +69,13 @@ If you see symbols that you don't recognise you can use `starship explain` to ex
You can enable the debug logs by using the `STARSHIP_LOG` env var. These logs can be very verbose so it is often useful to use the `module` command if you are trying to debug a particular module, for example, if you are trying to debug the `rust` module you could run the following command to get the trace logs and output from the module.
```sh
env STARHIP_LOG=trace starship module rust
env STARSHIP_LOG=trace starship module rust
```
If starship is being slow you can try using the `timings` command to see if there is a particular module or command that to blame.
```sh
env STARHIP_LOG=trace starship timings
env STARSHIP_LOG=trace starship timings
```
This will output the trace log and a breakdown of all modules that either took more than 1ms to execute or produced some output.
@ -118,5 +118,5 @@ If Starship was installed using the install script, the following command will d
```sh
# Locate and delete the starship binary
sh -c 'rm "$(which starship)"'
sh -c 'rm "$(command -v 'starship')"'
```

View File

@ -72,6 +72,22 @@
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-fr.png"
alt="Français"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/id-ID/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-id.png"
alt="Bahasa Indonesia"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/it-IT/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-it.png"
alt="Italiano"
/></a>
&nbsp;
<a
@ -138,8 +154,8 @@
- **Настраиваемая:** настройте каждый элемент вашей командной строки.
- **Универсальная:** работает с любой оболочкой, на любой операционной системе.
- **Умная:** сразу показывает соответствующую информацию.
- **Богатая функциями:** поддержка всех ваших любимых инструментов.
- **Легкая:** быстро установить - начните использовать ее в считанные минуты.
- **Много функций:** поддержка всех ваших любимых инструментов.
- **Легкая:** быстрая установка - начните использовать ее в считанные минуты.
<p align="center">
<a href="https://starship.rs/config/"><strong>Изучите документацию Starship&nbsp;&nbsp;</strong></a>
@ -149,13 +165,13 @@
## 🚀 Установка
### Требования
### Обязательные требования
- Установленный и включённый [шрифт Powerline](https://www.nerdfonts.com/) (например, [Fira Code Nerd Font](https://www.nerdfonts.com/font-downloads)).
### Начало работы
**Note**: due to the proliferation of different platforms, only a subset of supported platforms are shown below. Can't see yours? Have a look at the [extra platform instructions](https://starship.rs/installing/).
**Примечание**: из-за распространения большого количества операционных систем, список поддерживаемых указан ниже. Can't see yours? Ознакомьтесь с [дополнительными инструкциями по платформе](https://starship.rs/installing/).
1. Установите двоичный файл **starship**:
@ -252,7 +268,7 @@
#### Elvish
**Внимание** Поддерживается только elvish v0.15 или выше. Добавьте следующую строку в конец `~/.elvish/rc.elv`:
**Warning** Only elvish v0.17 or higher is supported. Добавьте следующую строку в конец `~/.elvish/rc.elv`:
```sh
# ~/.elvish/rc.elv
@ -283,6 +299,17 @@
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```
#### Nushell
**Warning** This will change in the future. Only nu version v0.33 or higher is supported. Add the following to your nu config file. You can check the location of this file by running `config path` in nu.

View File

@ -224,7 +224,7 @@ format = '\[[$symbol($version)]($style)\]'
format = '\[[$symbol($version)]($style)\]'
[sudo]
format = '\[[as $symbol]\]
format = '\[[as $symbol]\]'
[swift]
format = '\[[$symbol($version)]($style)\]'

View File

@ -18,7 +18,7 @@ features:
footer: ISC Licensed | Copyright © 2019-present Starship Contributors
#Used for the description meta tag, for SEO
metaTitle: "Starship: Cross-Shell Prompt"
description: Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the information you need, while staying sleek and minimal. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, and PowerShell.
description: Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the information you need, while staying sleek and minimal. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and PowerShell.
---
<div class="center">
@ -119,7 +119,7 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
#### Elvish
::: warning Only elvish v0.15 or higher is supported. :::
::: warning Only elvish v0.17 or higher is supported. :::
Add the following to the end of `~/.elvish/rc.elv`:
@ -164,3 +164,14 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
execx($(starship init xonsh))
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```

View File

@ -8,19 +8,44 @@ Bu bölümdeki yapılandırmalar, Starship'in gelecekteki sürümlerinde değiş
:::
## Bash'e Özel ön-komut istemi(pre-prompt) ve ön-çalıştırma(pre-execution) Komutları
## Custom pre-prompt and pre-execution Commands in Cmd
Bash, çoğu diğer kabuklar gibi resmi bir preexec/precmd çerçevesine sahip değildir. Bu yüzden, `Bash'i` tamamen özelleştirmek zordur. Ancak Starship, size istem oluşturma prosedürü sayesinde kendi işlevlerinizi ekleme konusunda sınırlı bir yetenek sağlar:
Clink provides extremely flexible APIs to run pre-prompt and pre-exec commands in Cmd shell. It is fairly simple to use with Starship. Make the following changes to your `starship.lua` file as per your requirements:
- Özel bir işlemi başlatmak için çizimin bitmesinden önce yeni bir işlev oluşturup adlandırmanız gerekmektedir.`starship_precmd_user_func`. Örneğin komut isteminden önce bir roket çizmek isterseniz
- To run a custom function right before the prompt is drawn, define a new function called `starship_preprompt_user_func`. This function receives the current prompt as a string that you can utilize. For example, to draw a rocket before the prompt, you would do
```bash
echo "🚀"
}
starship_precmd_user_func="fırlatıldı"
```lua
function starship_preprompt_user_func(prompt)
print("🚀")
end
load(io.popen('starship init cmd'):read("*a"))()
```
- Özel bir işlemi başlatmadan hemen önce komut istemini çalıştırıp, [`DEBUG`filtreleme mekanizmasını](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/) kullanabilirsiniz. Bununla birlikte, Starship başlatılmadan hemen *önce*, </strong>DEBUG sinyalini filtrelemek<1>**zorundasınız.</0>! Starship, DEBUG filtrelemesinin ardından bazı değerleri içerisinde barındırabilir ancak filtreleme işlemi starship başlatıldıktan sonra yazılırsa bazı fonksiyonlar devre dışı kalabilir.</li> </ul>
- To run a custom function right before a command is executed, define a new function called `starship_precmd_user_func`. This function receives the current commandline as a string that you can utilize. For example, to print the command that's about to be executed, you would do
```lua
function starship_precmd_user_func(line)
print("Executing: "..line)
end
load(io.popen('starship init cmd'):read("*a"))()
```
## Custom pre-prompt and pre-execution Commands in Bash
Bash does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `bash`. Ancak Starship, size istem oluşturma prosedürü sayesinde kendi işlevlerinizi ekleme konusunda sınırlı bir yetenek sağlar:
- To run a custom function right before the prompt is drawn, define a new function and then assign its name to `starship_precmd_user_func`. For example, to draw a rocket before the prompt, you would do
```bash
function blastoff(){
echo "🚀"
}
starship_precmd_user_func="blastoff"
```
- To run a custom function right before a command runs, you can use the [`DEBUG` trap mechanism](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). However, you **must** trap the DEBUG signal *before* initializing Starship! Starship can preserve the value of the DEBUG trap, but if the trap is overwritten after starship starts up, some functionality will break.
```bash
function blastoff(){
@ -42,9 +67,9 @@ function Invoke-Starship-PreCommand {
}
```
## Pencere Başlığını Değiştirme
## Change Window Title
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash` or `zsh`.
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash`, `zsh`, `cmd` or `powershell`.
First, define a window title change function (identical in bash and zsh):
@ -79,6 +104,16 @@ function set_win_title(){
starship_precmd_user_func="set_win_title"
```
For Cmd, you can change the window title using the `starship_preprompt_user_func` function.
```lua
function starship_preprompt_user_func(prompt)
console.settitle(os.getenv('USERNAME').."@"..os.getenv('COMPUTERNAME')..": "..os.getcwd())
end
load(io.popen('starship init cmd'):read("*a"))()
```
You can also set a similar output with PowerShell by creating a function named `Invoke-Starship-PreCommand`.
```powershell
@ -96,7 +131,7 @@ Some shells support a right prompt which renders on the same line as the input.
Note: The right prompt is a single line following the input location. To right align modules above the input line in a multi-line prompt, see the [fill module](/config/#fill).
`right_format` is currently supported for the following shells: elvish, fish, zsh.
`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd.
### Example
@ -116,6 +151,28 @@ Produces a prompt like the following:
▶ starship on  rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s
```
## Continuation Prompt
Some shells support a continuation prompt along with the normal prompt. This prompt is rendered instead of the normal prompt when the user has entered an incomplete statement (such as a single left parenthesis or quote).
Starship can set the continuation prompt using the `continuation_prompt` option. The default prompt is `"[∙](bright-black) "`.
Note: `continuation_prompt` should be set to a literal string without any variables.
Note: Continuation prompts are only available in the following shells:
- `bash`
- `zsh`
- `PowerShell`
### Example
```toml
# ~/.config/starship.toml
# A continuation prompt that displays two filled in arrows
continuation_prompt = "▶▶"
```
## Style Strings

View File

@ -24,13 +24,19 @@ disabled = true
You can change default configuration file location with `STARSHIP_CONFIG` environment variable:
```sh
export STARSHIP_CONFIG=~/.starship/config.toml
export STARSHIP_CONFIG=~/example/non/default/path/starship.toml
```
Equivalently in PowerShell (Windows) would be adding this line to your `$PROFILE`:
```powershell
$ENV:STARSHIP_CONFIG = "$HOME\.starship\config.toml"
$ENV:STARSHIP_CONFIG = "$HOME\example\non\default\path\starship.toml"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CONFIG', 'C:\\Users\\user\\example\\non\\default\\path\\starship.toml')
```
### Logging
@ -47,6 +53,12 @@ Equivalently in PowerShell (Windows) would be adding this line to your `$PROFILE
$ENV:STARSHIP_CACHE = "$HOME\AppData\Local\Temp"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CACHE', 'C:\\Users\\user\\AppData\\Local\\Temp')
```
### Terminology
**Module**: A component in the prompt giving information based on contextual information from your OS. For example, the "nodejs" module shows the version of Node.js that is currently installed on your computer, if your current directory is a Node.js project.
@ -425,13 +437,13 @@ By default it only changes color. If you also want to change its shape take a lo
::: uyarı
`error_symbol` is not supported on elvish and nu shell.
`error_symbol` is not supported on nu shell.
:::
::: uyarı
`vicmd_symbol` is only supported in fish and zsh.
`vicmd_symbol` is only supported in cmd, fish and zsh.
:::
@ -568,7 +580,7 @@ Bash users who need preexec-like functionality can use [rcaloras's bash_preexec
::: tip
Showing desktop notifications requires starship to be built with `rust-notify` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
Showing desktop notifications requires starship to be built with `notify-rust` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
:::
@ -713,20 +725,20 @@ format = "via [🔰 $version](bold red) "
## Deno
The `deno` module shows you your currently installed version of [Deno](https://deno.land/). By default the module will be shown if any of the following conditions are met:
- The current directory contains a `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
- The current directory contains a `deno.json`, `deno.jsonc`, `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
### Options
| Option | Default | Description |
| ------------------- | -------------------------------------------- | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
| `detect_files` | `["mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `"green bold"` | The style for the module. |
| `disabled` | `false` | Disables the `deno` module. |
| Option | Default | Description |
| ------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
| `detect_files` | `["deno.json", "deno.jsonc", "mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `"green bold"` | The style for the module. |
| `disabled` | `false` | Disables the `deno` module. |
### Variables
@ -755,18 +767,19 @@ For example, given `~/Dev/Nix/nixpkgs/pkgs` where `nixpkgs` is the repo root, an
### Options
| Option | Default | Description |
| ------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `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)[$read_only]($read_only_style) "` | The format for the module. |
| `style` | `"bold cyan"` | The style for the module. |
| `disabled` | `false` | Disables the `directory` module. |
| `read_only` | `"🔒"` | The symbol indicating current directory is read only. |
| `read_only_style` | `"red"` | The style for the read only symbol. |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | The symbol indicating home directory. |
| Option | Default | Description |
| ------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `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)[$read_only]($read_only_style) "` | The format for the module. |
| `style` | `"bold cyan"` | The style for the module. |
| `disabled` | `false` | Disables the `directory` module. |
| `read_only` | `"🔒"` | The symbol indicating current directory is read only. |
| `read_only_style` | `"red"` | The style for the read only symbol. |
| `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | The symbol indicating home directory. |
| `use_os_path_sep` | `true` | Use the OS specific path seperator instead of always using `/` (e.g. `\` on Windows) |
<details>
<summary>This module has a few advanced configuration options that control how the directory is displayed.</summary>
@ -1334,22 +1347,23 @@ The `git_status` module shows symbols representing the state of the repo in your
### Options
| Option | Default | Description |
| ------------ | ----------------------------------------------- | ----------------------------------- |
| `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` |
| `style` | `"bold red"` | The style for the module. |
| `disabled` | `false` | Disables the `git_status` module. |
| Option | Default | Description |
| ------------------- | ----------------------------------------------- | ----------------------------------- |
| `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` |
| `style` | `"bold red"` | The style for the module. |
| `ignore_submodules` | `false` | Ignore changes to submodules. |
| `disabled` | `false` | Disables the `git_status` module. |
### Variables
@ -1513,10 +1527,10 @@ The `hostname` module shows the system hostname.
### Variables
| Variable | Example | Description |
| --------- | ------- | ------------------------------------ |
| symbol | | Mirrors the value of option `symbol` |
| style\* | | Mirrors the value of option `style` |
| Variable | Example | Description |
| --------- | ---------- | ----------------------------------- |
| hostname | `computer` | The hostname of the computer |
| style\* | | Mirrors the value of option `style` |
\*: This variable can only be used as a part of a style string
@ -2133,7 +2147,7 @@ symbol = "☁️ "
## 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`, `composer`, `gradle`, `julia`, `mix`, `helm` and `shards` packages.
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`, `composer`, `gradle`, `julia`, `mix`, `helm`, `shards` 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
@ -2150,6 +2164,7 @@ The `package` module is shown when the current directory is the repository for a
- [**Shards**](https://crystal-lang.org/reference/the_shards_command/index.html) - The `shards` package version is extracted from the `shard.yml` present
- [**V**](https://vlang.io) - The `vlang` package version is extracted from the `v.mod` present
- [**SBT**](https://scala-sbt.org) - The `sbt` package version is extracted from the `build.sbt` present in the current directory
- [**Dart**](https://pub.dev/) - The `dart` package version is extracted from the `pubspec.yaml` present in the current directory
> ⚠️ The version being shown is that of the package whose source code is in your current directory, not your package manager.
@ -2673,6 +2688,8 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
| `elvish_indicator` | `esh` | A format string used to represent elvish. |
| `tcsh_indicator` | `tsh` | A format string used to represent tcsh. |
| `xonsh_indicator` | `xsh` | A format string used to represent xonsh. |
| `cmd_indicator` | `cmd` | A format string used to represent cmd. |
| `nu_indicator` | `nu` | A format string used to represent nu. |
| `unknown_indicator` | | The default value to be displayed when the shell is unknown. |
| `format` | `"[$indicator]($style) "` | The format for the module. |
| `style` | `"white bold"` | The style for the module. |
@ -2778,7 +2795,7 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
:::
::: warning This module is not supported on elvish and nu shell. :::
::: warning This module is not supported on nu shell. :::
### Options
@ -2804,6 +2821,7 @@ This module is disabled by default. To enable it, set `disabled` to `false` in y
| Variable | Example | Description |
| -------------- | ------- | ------------------------------------------------------------------------------------------- |
| status | `127` | The exit code of the last command |
| hex_status | `0x7F` | The exit code of the last command in hex |
| int | `127` | The exit code of the last command |
| common_meaning | `ERROR` | Meaning of the code if not a signal |
| signal_number | `9` | Signal number corresponding to the exit code, only if signalled |

View File

@ -69,13 +69,13 @@ If you see symbols that you don't recognise you can use `starship explain` to ex
You can enable the debug logs by using the `STARSHIP_LOG` env var. These logs can be very verbose so it is often useful to use the `module` command if you are trying to debug a particular module, for example, if you are trying to debug the `rust` module you could run the following command to get the trace logs and output from the module.
```sh
env STARHIP_LOG=trace starship module rust
env STARSHIP_LOG=trace starship module rust
```
If starship is being slow you can try using the `timings` command to see if there is a particular module or command that to blame.
```sh
env STARHIP_LOG=trace starship timings
env STARSHIP_LOG=trace starship timings
```
This will output the trace log and a breakdown of all modules that either took more than 1ms to execute or produced some output.
@ -118,5 +118,5 @@ If Starship was installed using the install script, the following command will d
```sh
# Locate and delete the starship binary
sh -c 'rm "$(which starship)"'
sh -c 'rm "$(command -v 'starship')"'
```

View File

@ -72,6 +72,22 @@
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-fr.png"
alt="Français"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/id-ID/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-id.png"
alt="Bahasa Indonesia"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/it-IT/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-it.png"
alt="Italiano"
/></a>
&nbsp;
<a
@ -252,7 +268,7 @@
#### Elvish
**Warning** Only elvish v0.15 or higher is supported. Add the following to the end of `~/.elvish/rc.elv`:
**Warning** Only elvish v0.17 or higher is supported. Add the following to the end of `~/.elvish/rc.elv`:
```sh
# ~/.elvish/rc.elv
@ -283,6 +299,17 @@
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```
#### Nushell
**Warning** This will change in the future. Only nu version v0.33 or higher is supported. Add the following to your nu config file. You can check the location of this file by running `config path` in nu.

View File

@ -224,7 +224,7 @@ format = '\[[$symbol($version)]($style)\]'
format = '\[[$symbol($version)]($style)\]'
[sudo]
format = '\[[as $symbol]\]
format = '\[[as $symbol]\]'
[swift]
format = '\[[$symbol($version)]($style)\]'

View File

@ -18,7 +18,7 @@ features:
footer: Cấp phép bởi ISC | Bản quyền © 2019-nay Starship Contributors
#Used for the description meta tag, for SEO
metaTitle: "Starship: Cross-Shell Prompt"
description: Starship là prompt nhỏ, cực nhanh, và khả năng tuỳ biến mạnh mẽ cho bất kì shell nào! Hiển thị thông tin bạn cần, trong khi vẫn giữ cho đẹp và nhỏ gọn. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, and PowerShell.
description: Starship là prompt nhỏ, cực nhanh, và khả năng tuỳ biến mạnh mẽ cho bất kì shell nào! Hiển thị thông tin bạn cần, trong khi vẫn giữ cho đẹp và nhỏ gọn. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and PowerShell.
---
<div class="center">
@ -119,7 +119,7 @@ eval $(starship init ion)
#### Elvish
::: warning Chỉ elvish v0.15 hoặc cao hơn được hỗ trợ. :::
::: warning Only elvish v0.17 or higher is supported. :::
Thêm đoạn sau vào cuối tệp tin `~/.elvish/rc.elv`:
@ -164,3 +164,14 @@ eval $(starship init ion)
execx($(starship init xonsh))
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```

View File

@ -8,11 +8,35 @@ Các tùy chỉnh được mô tả trong phần này có thể sẽ thay đổi
:::
## Tùy chỉnh các hàm được thực thi trước prompt và các lệnh Linux mặc định của bash shell
## Custom pre-prompt and pre-execution Commands in Cmd
Bash không có một preexec/precmd framework chính thống giống như các shells khác. Do đó rất khó để cung cấp các hook với khả năng tuỳ biến hoàn toàn cho `bash` shell. Tuy nhiên, Starship cho phép bạn viết các hàm riêng của bạn để tùy biến việc render prompt:
Clink provides extremely flexible APIs to run pre-prompt and pre-exec commands in Cmd shell. It is fairly simple to use with Starship. Make the following changes to your `starship.lua` file as per your requirements:
- Để thực thi một hàm custom trước khi prompt được render, ta cần định nghĩa một hàm mới và gán `starship_precmd_user_func` cho tên của hàm này. Ví dụ, để vẽ một tên lửa trước prompt
- To run a custom function right before the prompt is drawn, define a new function called `starship_preprompt_user_func`. This function receives the current prompt as a string that you can utilize. For example, to draw a rocket before the prompt, you would do
```lua
function starship_preprompt_user_func(prompt)
print("🚀")
end
load(io.popen('starship init cmd'):read("*a"))()
```
- To run a custom function right before a command is executed, define a new function called `starship_precmd_user_func`. This function receives the current commandline as a string that you can utilize. For example, to print the command that's about to be executed, you would do
```lua
function starship_precmd_user_func(line)
print("Executing: "..line)
end
load(io.popen('starship init cmd'):read("*a"))()
```
## Custom pre-prompt and pre-execution Commands in Bash
Bash does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `bash`. Tuy nhiên, Starship cho phép bạn viết các hàm riêng của bạn để tùy biến việc render prompt:
- To run a custom function right before the prompt is drawn, define a new function and then assign its name to `starship_precmd_user_func`. For example, to draw a rocket before the prompt, you would do
```bash
function blastoff(){
@ -21,13 +45,13 @@ function blastoff(){
starship_precmd_user_func="blastoff"
```
- Để thực thi một hàm custom trước khi một câu lệnh Linux chạy, ta có thể sử dụng cơ chế bẫy tín hiệu [`DEBUG`](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). Tuy nhiên, bạn **phải** đặt bẫy tín hiệu DEBUG *trước* khởi tạo Starship! Starship có thể giữ giá trị của DEBUG trap, nhưng nếu trap bị ghi đè sau khi starship khởi động, một vài chức năng sẽ không hoạt động.
- To run a custom function right before a command runs, you can use the [`DEBUG` trap mechanism](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). However, you **must** trap the DEBUG signal *before* initializing Starship! Starship can preserve the value of the DEBUG trap, but if the trap is overwritten after starship starts up, some functionality will break.
```bash
function blastoff(){
echo "🚀"
}
trap blastoff DEBUG # Bẫy DEBUG *trước khi* starship chạy
trap blastoff DEBUG # Trap DEBUG *before* running starship
eval $(starship init bash)
```
@ -43,11 +67,11 @@ function Invoke-Starship-PreCommand {
}
```
## Thay đổi tên gọi trên cửa sổ của chương trình terminal
## Change Window Title
Một vài shell có khả năng tự động thay đổi tên hiển thị (chẳng hạn như tên của thư mục hiện thời) trên cửa số của trình mô phỏng terminal. Fish shell mặc định thực hiện thay đổi này. Tuy không được set mặc định trên Starship, chức năng này có thể được tích hợp dễ dàng trên `bash` shell và `zsh` shell.
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash`, `zsh`, `cmd` or `powershell`.
Đầu tiên, ta cần định nghĩa một hàm thay đổi tiêu đề cửa sổ (dùng chung cho cả bash và zsh):
First, define a window title change function (identical in bash and zsh):
```bash
function set_win_title(){
@ -55,23 +79,23 @@ function set_win_title(){
}
```
Ta có thể sử dụng biến số để tuỳ chỉnh tên hiển thị này (`$USER`, `$HOSTNAME`, và `$PWD` là những biến số thường được dùng).
You can use variables to customize this title (`$USER`, `$HOSTNAME`, and `$PWD` are popular choices).
Với `bash` shell, set precmd của starship bằng tên của hàm này:
In `bash`, set this function to be the precmd starship function:
```bash
starship_precmd_user_func="set_win_title"
```
Với `zsh` shell, thêm hàm này vào mảng `precmd_functions`:
In `zsh`, add this to the `precmd_functions` array:
```bash
precmd_functions+=(set_win_title)
```
Nếu ta hài lòng với các tùy biến đã được thiết lập, thêm những dòng sau vào cấu hình shell (`~/.bashrc` hoặc `~/.zshrc`) để thực thi chúng mỗi khi ta khởi tạo một shell mới.
If you like the result, add these lines to your shell configuration file (`~/.bashrc` or `~/.zshrc`) to make it permanent.
Ví dụ, nếu ta muốn hiển thị đường dẫn thư mục hiện tại trong tiêu đề của một terminal tab, thêm đoạn code sau vào `~/.bashrc` hoặc `~/.zshrc`:
For example, if you want to display your current directory in your terminal tab title, add the following snippet to your `~/.bashrc` or `~/.zshrc`:
```bash
function set_win_title(){
@ -80,6 +104,16 @@ function set_win_title(){
starship_precmd_user_func="set_win_title"
```
For Cmd, you can change the window title using the `starship_preprompt_user_func` function.
```lua
function starship_preprompt_user_func(prompt)
console.settitle(os.getenv('USERNAME').."@"..os.getenv('COMPUTERNAME')..": "..os.getcwd())
end
load(io.popen('starship init cmd'):read("*a"))()
```
You can also set a similar output with PowerShell by creating a function named `Invoke-Starship-PreCommand`.
```powershell
@ -97,7 +131,7 @@ Some shells support a right prompt which renders on the same line as the input.
Note: The right prompt is a single line following the input location. To right align modules above the input line in a multi-line prompt, see the [fill module](/config/#fill).
`right_format` is currently supported for the following shells: elvish, fish, zsh.
`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd.
### Ví dụ
@ -117,29 +151,51 @@ Produces a prompt like the following:
▶ starship on  rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s
```
## Continuation Prompt
Some shells support a continuation prompt along with the normal prompt. This prompt is rendered instead of the normal prompt when the user has entered an incomplete statement (such as a single left parenthesis or quote).
Starship can set the continuation prompt using the `continuation_prompt` option. The default prompt is `"[∙](bright-black) "`.
Note: `continuation_prompt` should be set to a literal string without any variables.
Note: Continuation prompts are only available in the following shells:
- `bash`
- `zsh`
- `PowerShell`
### Ví dụ
```toml
# ~/.config/starship.toml
# A continuation prompt that displays two filled in arrows
continuation_prompt = "▶▶"
```
## Các chuỗi kiểu
Chuỗi kiểu là một danh sách các từ, được phân cách bởi khoảng trắng. Các từ là không phân biệt hoa thường (ví dụ. `bold``Bold` là hai chuỗi tương đương). Mỗi từ có thể là một trong các từ sau:
Style strings are a list of words, separated by whitespace. The words are not case sensitive (i.e. `bold` and `BoLd` are considered the same string). Each word can be one of the following:
- `bold`
- `nghiêng`
- `gạch dưới`
- `làm tối đi`
- `đảo ngược`
- `italic`
- `underline`
- `dimmed`
- `inverted`
- `bg:<color>`
- `fg:<color>`
- `<color>`
- `none`
`<color>` là một nơi quy định màu (được bàn luận ở phía dưới). `fg:<color>` and `<color>` currently do the same thing, though this may change in the future. `inverted` swaps the background and foreground colors. Thứ tự các từ trong chuỗi là không quan trọng.
where `<color>` is a color specifier (discussed below). `fg:<color>` and `<color>` currently do the same thing, though this may change in the future. `inverted` swaps the background and foreground colors. The order of words in the string does not matter.
Từ mã `none` ghi đè tất cả các từ mã khác trong chuỗi nếu nó không là một phần của `bg:` specifier, vậy nên `fg:red none fg:blue` sẽ vẫn tạo một chuỗi mà không có kiểu. `bg:none` sets the background to the default color so `fg:red bg:none` is equivalent to `red` or `fg:red` and `bg:green fg:red bg:none` is also equivalent to `fg:red` or `red`. Nó có thể trở thành một lỗi để sử dụng `none` trong việc kết hợp với các từ mã khác trong tương lai.
The `none` token overrides all other tokens in a string if it is not part of a `bg:` specifier, so that e.g. `fg:red none fg:blue` will still create a string with no styling. `bg:none` sets the background to the default color so `fg:red bg:none` is equivalent to `red` or `fg:red` and `bg:green fg:red bg:none` is also equivalent to `fg:red` or `red`. It may become an error to use `none` in conjunction with other tokens in the future.
Một quy định màu có thể là một trong các thứ sau:
A color specifier can be one of the following:
- Một tròn các màu chuẩn của terminal: `black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`. Bạn có thể tuỳ chọn những tiền tố này với `bright` để có được phiên bản sáng hơn (ví dụ: `bright-white`).
- Một `#` được theo sau bởi một số thập lục phân gồm sáu chữ số. Cái này quy định một [mã thập lục phân cho màu RGB](https://www.w3schools.com/colors/colors_hexadecimal.asp).
- Một số nằm giữa 0-255. Cái này quy định một [mã màu ANSI 8-bit](https://i.stack.imgur.com/KTSQa.png).
- One of the standard terminal colors: `black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`. You can optionally prefix these with `bright-` to get the bright version (e.g. `bright-white`).
- A `#` followed by a six-digit hexadecimal number. This specifies an [RGB color hex code](https://www.w3schools.com/colors/colors_hexadecimal.asp).
- A number between 0-255. This specifies an [8-bit ANSI Color Code](https://i.stack.imgur.com/KTSQa.png).
Nếu nhiều màu được quy định cho màu chữ/màu nền, cái cuối cùng trong chuỗi sẽ được ưu tiên.
If multiple colors are specified for foreground/background, the last one in the string will take priority.

View File

@ -24,18 +24,24 @@ disabled = true
Bạn thay đổi địa chỉ tệp tin cấu hình mặc định bằng biến môi trường `STARSHIP_CONFIG`:
```sh
export STARSHIP_CONFIG=~/.starship/config.toml
export STARSHIP_CONFIG=~/example/non/default/path/starship.toml
```
Tương đương trong PowerShell (Windows) sẽ được thêm dòng này vào `$PROFILE` của bạn:
```powershell
$ENV:STARSHIP_CONFIG = "$HOME\.starship\config.toml"
$ENV:STARSHIP_CONFIG = "$HOME\example\non\default\path\starship.toml"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CONFIG', 'C:\\Users\\user\\example\\non\\default\\path\\starship.toml')
```
### Logging
Mặc định, starship logs các cảnh báo và các lỗi trong một tập tin tên là `~/.cache/starship/session_${STARSHIP_SESSION_KEY}.log`, nơi đó khoá của phiên làm việc tương ứng với thực thể terminal của bạn. Cái này, tuy nhiên có thể được thay đổi bằng cách sử dụng biến môi trường `STARSHIP_CACHE`:
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
@ -47,23 +53,29 @@ Tương đương trong PowerShell (Windows) sẽ được thêm dòng này vào
$ENV:STARSHIP_CACHE = "$HOME\AppData\Local\Temp"
```
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
```lua
os.setenv('STARSHIP_CACHE', 'C:\\Users\\user\\AppData\\Local\\Temp')
```
### Thuật ngữ
**Module**: Một thành phần trong prompt, thông tin lấy được dựa trên thông tin ngữ cảnh từ hệ điều hành của bạn. For example, the "nodejs" module shows the version of Node.js that is currently installed on your computer, if your current directory is a Node.js project.
**Module**: A component in the prompt giving information based on contextual information from your OS. For example, the "nodejs" module shows the version of Node.js that is currently installed on your computer, if your current directory is a Node.js project.
**Variable**: Các thành phần con nhỏ hơn chứa thông tin cung cấp bởi module. For example, the "version" variable in the "nodejs" module contains the current version of Node.js.
**Variable**: Smaller sub-components that contain information provided by the module. For example, the "version" variable in the "nodejs" module contains the current version of Node.js.
Bằng việc quy ước, đa số các module có một tiền tố của terminal mặc định (ví dụ `via` trong "nodejs") và một khoảng trắng như là một hậu tố.
By convention, most modules have a prefix of default terminal color (e.g. `via` in "nodejs") and an empty space as a suffix.
### Định dạng các chuỗi
Định dạng các chuỗi là định dạng một module với việc in ra tất cả các biến của nó. Đa số các module có một cái bắt đầu gọi là `format`, cái đó cấu hình việc hiển thị định dạng của module. Bạn có thể sử dụng các văn bản, các biến và các nhóm văn bản trong một định dạng chuỗi.
Format strings are the format that a module prints all its variables with. Most modules have an entry called `format` that configures the display format of the module. You can use texts, variables and text groups in a format string.
#### Biến
Một biến chứa một kí hiệu `$` theo sau bởi tên biến. The name of a variable can only contain letters, numbers and `_`.
A variable contains a `$` symbol followed by the name of the variable. The name of a variable can only contain letters, numbers and `_`.
Ví dụ:
For example:
- `$version` là một đính dạng chuỗi với một biến đặt tên là `version`.
- `$git_branch$git_commit` là một định dạng chuỗi với hai biến named `git_branch``git_commit`.
@ -71,13 +83,13 @@ Ví dụ:
#### Nhóm văn bản
Một nhóm văn bản được tạo nên bởi hai phần khác nhau.
A text group is made up of two different parts.
Phần đầu tiên, cái được bao bọc trong một `[]`, là một [định dạng chuỗi](#format-strings). Bạn có thể thêm các văn bản, các biến, hoặc thậm chí các nhóm văn bản lồng nhau vào trong nó.
The first part, which is enclosed in a `[]`, is a [format string](#format-strings). You can add texts, variables, or even nested text groups in it.
Phần thứ hai, cái được bao bọc trong một `()`, là một [chuỗi kiểu](#style-strings). This can be used to style the first part.
In the second part, which is enclosed in a `()`, is a [style string](#style-strings). This can be used to style the first part.
Ví dụ:
For example:
- `[on](red bold)` sẽ in một chuỗi `on` với chữ đậm tô màu đỏ.
- `[⌘ $version](bold green)` sẽ in một biểu tượng `⌘` theo sau là nội dung của biến `version`, với chữ in đậm màu xanh lá cây.
@ -85,7 +97,7 @@ Ví dụ:
#### Các chuỗi kiểu
Đa số các module trong starship cho phép bạn cấu hình kiểu hiển thị của chúng. This is done with an entry (thường được gọi là `kiểu`) cái là một cuỗi cấu hình đặc biệt. Đây là vài ví dụ của các chuỗi kiểu cũng với những gì chúng làm. Cú pháp chi tiết đầy đủ, tham khảo [hướng dẫn cấu hình nâng cao](/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"` thiết lập chữ màu xanh lá cây trên nền màu xanh nước biển
- `"bg:blue fg:bright-green"` thiết lập chữ màu xanh lá cây sáng trên nền màu canh nước biển
@ -94,13 +106,13 @@ Ví dụ:
- `"bold italic fg:purple"` thiết lập chữa nghiêng đậm có màu tím
- `""` vô hiệu hoá tất cả các kiểu
Lưu ý rằng những style trông như thế nào sẽ được điều khiển bởi giả lập terminal của bạn. Ví dụ, một vài giả lập terminal sẽ làm sáng những màu thay vì làm đậm chữ, và một vài theme màu sử dụng cũng các giá trị cho các màu thường và màu sáng. Tương tự, để có được chữ nghiêng, terminal của bạn phải hỗ trợ các kiểu chữ nghiêng.
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.
#### Điều kiện định dạng chuỗi
Một điều kiện định dạng chuỗi bọc trong `(``)` sẽ không render nếu tất cả các biến bên trong là rỗng.
A conditional format string wrapped in `(` and `)` will not render if all variables inside are empty.
Ví dụ:
For example:
- `(@$region)` will show nothing if the variable `region` is `None` or empty string, otherwise `@` followed by the value of region.
- `(một vài văn bản)` sẽ không hiển thị thứ gì khi không có những biến bọc trong các dấu ngoặc.
@ -112,18 +124,18 @@ The following symbols have special usage in a format string and must be escaped:
Note that TOML has [both basic strings and literal strings](https://toml.io/en/v1.0.0#string). It is recommended to use a literal string (surrounded by single quotes) in your config. If you want to use a basic string (surrounded by double quotes), you must escape the backslash itself (i.e. use `\\`).
Ví dụ, khi bạn muốn in một kí hiệu `$` trên một dòng mới, các cấu hình sau cho `định dạng` tương đương:
For example, when you want to print a `$` symbol on a new line, the following configs for `format` are equivalent:
```toml
# với chuỗi cơ bản
# with basic string
format = "\n\\$"
# với chuỗi cơ bản trong nhiều dòng
# with multiline basic string
format = """
\\$"""
# với chuỗi đặc biệt
# with literal string
format = '''
\$'''
@ -131,7 +143,7 @@ format = '''
## Prompt
Cái này là danh sách các tuỳ chọn cho cấu hình prompt-wide.
This is the list of prompt-wide configuration options.
### Các tuỳ chọn
@ -149,22 +161,22 @@ Cái này là danh sách các tuỳ chọn cho cấu hình prompt-wide.
```toml
# ~/.config/starship.toml
# Sử dụng định dạng custom
# Use custom format
format = """
[┌───────────────────>](bold green)
[](bold green)$directory$rust$package
[└─>](bold green) """
# Chờ 10 milliseconds để starship kiểm tra các tập tin trong đường dẫn hiện tại.
# Wait 10 milliseconds for starship to check files under the current directory.
scan_timeout = 10
# Vô hiệu hóa dòng trắng tại ví trị bắt đầu của dấu nhắc lệnh
# Disable the blank line at the start of the prompt
add_newline = false
```
### Định dạng prompt mặc định
Mặc định `format` được sử dụng để định nghĩa định dạng của prompt, nếu rỗng hoặc không `format` được cung cấp. Mặc định như sau:
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 = "$all"
@ -248,7 +260,7 @@ format="$all$directory$character"
## AWS
`aws` module cho biết region và profile hiện tại của AWS. Cái này dựa trên các biến môi trường `AWS_REGION`, `AWS_DEFAULT_REGION`, và `AWS_PROFILE` với tập tin `~/.aws/config`. This module also shows an expiration timer when using temporary credentials.
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. This module also shows an expiration timer when using temporary credentials.
When using [aws-vault](https://github.com/99designs/aws-vault) the profile is read from the `AWS_VAULT` env var and the credentials expiration date is read from the `AWS_SESSION_EXPIRATION` env var.
@ -347,7 +359,7 @@ style = "blue bold"
## Battery
`battery` module cho biết cách sạc pin của thiết bị là gì và tình trạng sạc hiện tại của nó. Module chỉ được nhìn thấy khi pin của thiết bị dưới 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%.
### Các tuỳ chọn
@ -375,7 +387,7 @@ discharging_symbol = "💀 "
### Hiển thị pin
The `display` configuration option is used to define when the battery indicator should be shown (threshold), which symbol would be used (symbol), and what it would like (style). Nếu `display` không được cung cấp. Mặc định như sau:
The `display` configuration option is used to define when the battery indicator should be shown (threshold), which symbol would be used (symbol), and what it would like (style). If no `display` is provided. The default is as shown:
```toml
[[battery.display]]
@ -387,7 +399,7 @@ The default value for the `charging_symbol` and `discharging_symbol` option is r
#### Các tuỳ chọn
Tuỳ chọn `display` là một mảng của của bảng sau.
The `display` option is an array of the following table.
| Tuỳ chọn | Mặc định | Mô tả |
| -------------------- | ---------- | --------------------------------------------------------------------------------------------------------- |
@ -414,24 +426,24 @@ discharging_symbol = "💦"
## Character
Module `character` cho biết một kí tự (thường là một mũi tên) bên cạnh nơi văn bản được nhập trong terminal của bạn.
The `character` module shows a character (usually an arrow) beside where the text is entered in your terminal.
Kí tự sẽ nói cho bạn câu lệnh cuối liệu thành công hay thất bại. Nó có thể làm điều này bằng hai cách:
The character will tell you whether the last command was successful or not. It can do this in two ways:
- thay đổi màu(`đỏ`/`xanh lá`)
- thay đổi hình dạng (``/`✖`)
Mặc định, nó chỉ thay đổi màu. If you also want to change its shape take a look at [this example](#with-custom-error-shape).
By default it only changes color. If you also want to change its shape take a look at [this example](#with-custom-error-shape).
::: cảnh báo
`error_symbol` is not supported on elvish and nu shell.
`error_symbol` is not supported on nu shell.
:::
::: cảnh báo
`vicmd_symbol` is only supported in fish and zsh.
`vicmd_symbol` is only supported in cmd, fish and zsh.
:::
@ -484,7 +496,7 @@ vicmd_symbol = "[V](bold green) "
## CMake
The `cmake` module shows the currently installed version of [CMake](https://cmake.org/). Mặc định module sẽ được kích hoạt nếu thoả mãn bất kì điều kiện nào dưới đây:
The `cmake` module shows the currently installed version of [CMake](https://cmake.org/). By default the module will be activated if any of the following conditions are met:
- Đường dẫn hiện tại chứa một tập tin `CmakeLists.txt`
- Đường dẫn hiện tại chứa một tập tin `CMakeCache.txt`
@ -544,15 +556,15 @@ The `cobol` module shows the currently installed version of COBOL. By default, t
## Command Duration
Module `cmd_duration`. cho biết câu lệnh cuối cùng thực thi trong bao lâu. Module sẽ được hiện chỉ khi câu lệnh lấy nhiều hơn 2 giây, hoặc giá trị cấu hình `min_time`, nếu nó tồn tại.
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.
::: cảnh báo Không thể hook DEBUG trap trong Bash
::: warning Do not hook the DEBUG trap in Bash
Nếu bạn đang chạy Starship trong `bash`, không thể hook `DEBUG` trap sau khi chạy `eval $(starship init $0)`, hoặc module này **sẽ** ngắt.
If you are running Starship in `bash`, do not hook the `DEBUG` trap after running `eval $(starship init $0)`, or this module **will** break.
:::
Người dùng Bash, những người cần chức năng giống preexec có thể sử dụng [rcaloras's bash_preexec framework](https://github.com/rcaloras/bash-preexec). Đơn giản là định nghĩa các mảng `preexec_functions``precmd_functions` trước khi chạy `eval $(starship init $0)`, và sau đó thực thi như bình thường.
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.
### Các tuỳ chọn
@ -566,9 +578,9 @@ Người dùng Bash, những người cần chức năng giống preexec có th
| `show_notifications` | `false` | Hiện thông báo desktop khi câu lệnh hoàn thành. |
| `min_time_to_notify` | `45_000` | Khoảng thời gian ngắn nhất để thông báo (tính bằng milliseconds). |
::: thử thuật
::: tip
Hiện thông báo desktop yêu cầu starship được built với sự hỗ trợ của `rust-notify`. Bạn kiểm tra nếu starship hỗ trợ các thông báo bằng cách chạy `STARSHIP_LOG=debug starship module cmd_duration -d 60000` khi `show_notifications` được thiết lập là `true`.
Showing desktop notifications requires starship to be built with `notify-rust` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
:::
@ -595,9 +607,9 @@ format = "underwent [$duration](bold yellow)"
The `conda` module shows the current [Conda](https://docs.conda.io/en/latest/) environment, if `$CONDA_DEFAULT_ENV` is set.
::: thử thuật
::: tip
Cái này không loại bỏ conda's prompt mà nó sở hữu, bạn có thể muốn chạy `conda config --set changeps1 False`.
This does not suppress conda's own prompt modifier, you may want to run `conda config --set changeps1 False`.
:::
@ -713,20 +725,20 @@ format = "via [🔰 $version](bold red) "
## Deno
The `deno` module shows you your currently installed version of [Deno](https://deno.land/). Mặc định module sẽ được hiển thị nếu có bất kì điều kiện nào dưới đây thoả mãn:
- The current directory contains a `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
- The current directory contains a `deno.json`, `deno.jsonc`, `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
### Các tuỳ chọn
| Tuỳ chọn | Mặc định | Mô tả |
| ------------------- | -------------------------------------------- | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | Định dạng cho module. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Những tiện ích mở rộng nào sẽ kích hoạt mô-đun này. |
| `detect_files` | `["mod.ts", "mod.js", "deps.ts", "deps.js"]` | Những tên tệp nào sẽ kích hoạt mô-đun này. |
| `detect_folders` | `[]` | Những thư mục nào sẽ kích hoạt mô-đun này. |
| `style` | `"green bold"` | Kiểu cho module. |
| `disabled` | `false` | Disables the `deno` module. |
| Tuỳ chọn | Mặc định | Mô tả |
| ------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | Định dạng cho module. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Những tiện ích mở rộng nào sẽ kích hoạt mô-đun này. |
| `detect_files` | `["deno.json", "deno.jsonc", "mod.ts", "mod.js", "deps.ts", "deps.js"]` | Những tên tệp nào sẽ kích hoạt mô-đun này. |
| `detect_folders` | `[]` | Những thư mục nào sẽ kích hoạt mô-đun này. |
| `style` | `"green bold"` | Kiểu cho module. |
| `disabled` | `false` | Disables the `deno` module. |
### Các biến
@ -747,29 +759,30 @@ format = "via [🦕 $version](green bold) "
## Đường dẫn
`directory` module hiển thị đường dẫn thư mục hiện hành của bạn,, cắt ngắn ba thư mục cha. Đường dẫn của bạn cũng sẽ được cắt ngắn tới đường dẫn gốc của git repo hiện tại của bạn.
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.
Khi sử dụng fish style pwd option, thay vì ẩn đường dẫn được rút gọn, bạn sẽ thấy một tên ngắn cho mỗi thư mục dựa trên số bạn cho phép trng tùy chọn.
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.
Cho ví dụ, `~/Dev/Nix/nixpkgs/pkgs` nơi `nixpkgs` là gốc của repo, và tuỳ chọn thiết lập sang `1`. Bây giờ bạn sẽ thấy `~/D/N/nixpkgs/pkgs`, trong khi trước nó là `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`.
### Các tuỳ chọn
| Tuỳ chọn | Mặc định | Mô tả |
| ------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `truncation_length` | `3` | Số lượng thư mục cha của thư mục hiện tại nên được rút gọn. |
| `truncate_to_repo` | `true` | Có hoặc không rút gọn đường dẫn gốc của git repo hiện tại của bạn. |
| `format` | `"[$path]($style)[$read_only]($read_only_style) "` | Định dạng cho module. |
| `style` | `"bold cyan"` | Kiểu cho module. |
| `disabled` | `false` | Vô hiệu mô đun `directory`. |
| `read_only` | `"🔒"` | Biểu tượng để nhận biết thư mục hiện tại là chỉ đọc. |
| `read_only_style` | `"red"` | Style cho biểu tượng chỉ đọc. |
| `truncation_symbol` | `""` | Biểu tượng tiền tố cho các đường dẫn rút gọn. ví dụ: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | Biểu tượng nhận biết thư mục home. |
| Tuỳ chọn | Mặc định | Mô tả |
| ------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `truncation_length` | `3` | Số lượng thư mục cha của thư mục hiện tại nên được rút gọn. |
| `truncate_to_repo` | `true` | Có hoặc không rút gọn đường dẫn gốc của git repo hiện tại của bạn. |
| `format` | `"[$path]($style)[$read_only]($read_only_style) "` | Định dạng cho module. |
| `style` | `"bold cyan"` | Kiểu cho module. |
| `disabled` | `false` | Vô hiệu mô đun `directory`. |
| `read_only` | `"🔒"` | Biểu tượng để nhận biết thư mục hiện tại là chỉ đọc. |
| `read_only_style` | `"red"` | Style cho biểu tượng chỉ đọc. |
| `truncation_symbol` | `""` | Biểu tượng tiền tố cho các đường dẫn rút gọn. ví dụ: "…/" |
| `repo_root_style` | `None` | The style for the root of the git repo when `truncate_to_repo` option is set to false. |
| `home_symbol` | `"~"` | Biểu tượng nhận biết thư mục home. |
| `use_os_path_sep` | `true` | Use the OS specific path seperator instead of always using `/` (e.g. `\` on Windows) |
<details>
<summary>Mô đun này có một vài tùy chọn nâng cao để điều khiển cách thư mục được hiển thị.</summary>
<summary>This module has a few advanced configuration options that control how the directory is displayed.</summary>
| Tùy chọn nâng cao | Mặc định | Mô tả |
| --------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@ -846,9 +859,9 @@ format = "via [🐋 $context](blue bold)"
## Dotnet
The `dotnet` module shows the relevant version of the [.NET Core SDK](https://dotnet.microsoft.com/) for the current directory. Nếu SDK được ghim trong thư mục hiện tại, phiên bản ghim đó được hiển thị. Ngược lại, mô đun hiển thị phiên bản cuối cùng của SDK được cài đặt.
The `dotnet` module shows the relevant version of the [.NET Core SDK](https://dotnet.microsoft.com/) 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.
Mặc định, mô đun này sẽ chỉ được hiển thị trong dấu nhắc lệnh của bạn khi một hoặc nhiều tệp tin dưới đây xuất hiện trong thư mục hiện tại:
By default this module will only be shown in your prompt when one or more of the following files are present in the current directory:
- `global.json`
- `project.json`
@ -859,11 +872,11 @@ Mặc định, mô đun này sẽ chỉ được hiển thị trong dấu nhắc
- `*.fsproj`
- `*.xproj`
Bạn cũng sẽ cần cài đặt .NET Core SDK đúng cách để sử dụng một cách chính xác.
You'll also need the .NET Core SDK installed in order to use it correctly.
Mô đun này sử dụng cơ chế của bản thân để phát hiện phiên bản của chính nó. Thông thường, nó nhanh gấp đôi nếu chạy `dotnet --version`, nhưng nó có thể hiện sai phiên bản nếu dự án .NET của bạn có một cấu trúc thư mục bất thường. Nếu độ chính xác quan trọng hơn tốc độ, bạn có thể vô hiệu cơ chế bằng cài đặt `heuristic = false` trong các tùy chọn mô đun.
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.
Mô đun cũng sẽ hiện Target Framework Moniker (<https://docs.microsoft.com/en-us/dotnet/standard/frameworks#supported-target-framework-versions>) khi có một tệp tin csproj trong thư mục hiện tại.
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.
### Các tuỳ chọn
@ -984,7 +997,7 @@ format = "via [ $version](cyan bold) "
## Biến môi trường
The `env_var` module displays the current value of a selected environment variables. Mô đun sẽ được hiển thị chỉ khi bất kì điều kiện nào sau đây thỏa mãn:
The `env_var` module displays the current value of a selected environment variables. The module will be shown only if any of the following conditions are met:
- Tùy chọn `variable` khớp với mootjj biến môi trường tồn tại
- Tùy chọn `variable` không được định nghĩa, nhưng tùy chọn `default`
@ -1113,7 +1126,7 @@ AA -------------------------------------------- BB -----------------------------
## Google Cloud (`gcloud`)
Mô đun `gcloud` hiển thị cấu hình hiện tại của [`gcloud`](https://cloud.google.com/sdk/gcloud) CLI. Cái này dựa trên tập tin `~/.config/gcloud/active_config`, `~/.config/gcloud/configurations/config_{CONFIG NAME}` và biến môi trường `CLOUDSDK_CONFIG`.
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.
### Các tuỳ chọn
@ -1174,7 +1187,7 @@ asia-northeast1 = "an1"
## Git Branch
Mô đun `git_branch` hiển thị nhánh hiệu lực của repo trong thư mục hiện tại của bạn.
The `git_branch` module shows the active branch of the repo in your current directory.
### Các tuỳ chọn
@ -1214,7 +1227,7 @@ truncation_symbol = ""
## Git Commit
Mô đun `git_commit` hiển thị hash commit hiện tại và tag (nếu có) của repo trong thư mục hiện tại của bạn.
The `git_commit` module shows the current commit hash and also the tag (if any) of the repo in your current directory.
### Các tuỳ chọn
@ -1249,7 +1262,7 @@ tag_symbol = "🔖 "
## Git State
Mô đun `git_state` sẽ hiển hiển thị trong các thư mục là một phần của gt repository và những nơi tồn tại một hoạt động trong tiến trình như _REBASING_, _BISECTING_. Nếu có thông tin tiến trình (ví dụ, REBASING 3/10), thông tin đó cũng sẽ được hiển thị.
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.
### Các tuỳ chọn
@ -1291,9 +1304,9 @@ cherry_pick = "[🍒 PICKING](bold red)"
The `git_metrics` module will show the number of added and deleted lines in the current git repository.
::: thử thuật
::: tip
Mặc định, mô đun này được vô hiệu. Để kích hoạt nó, thiết lập `disabled` sang `false` trong tập tin cấu hình của bạn.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -1330,30 +1343,31 @@ format = '[+$added]($added_style)/[-$deleted]($deleted_style) '
## Git Status
Mô đun `git_status` hiển thị các biểu tượng đại diện cho trạng thái của repo trong thư mục hiện tại của bạn.
The `git_status` module shows symbols representing the state of the repo in your current directory.
### Các tuỳ chọn
| Tuỳ chọn | Mặc định | Mô tả |
| ------------ | ----------------------------------------------- | ----------------------------------- |
| `format` | `'([\[$all_status$ahead_behind\]]($style) )'` | Định dạng mặc định cho `git_status` |
| `conflicted` | `"="` | Nhánh này có nhiều merge conflicts. |
| `ahead` | `"⇡"` | Định dạng của `ahead` |
| `behind` | `"⇣"` | Định dạng của `behind` |
| `diverged` | `"⇕"` | Định dạng của `diverged` |
| `up_to_date` | `""` | The format of `up_to_date` |
| `untracked` | `"?"` | Định dạng của `untracked` |
| `stashed` | `"$"` | Định dạng của `stashed` |
| `modified` | `"!"` | Định dạng của `modified` |
| `staged` | `"+"` | Định dạng của `modified` |
| `renamed` | `"»"` | Định dạng của `renamed` |
| `deleted` | `"✘"` | Định dạng của `deleted` |
| `style` | `"bold red"` | Kiểu cho module. |
| `disabled` | `false` | Vô hiệu `git_status` module. |
| Tuỳ chọn | Mặc định | Mô tả |
| ------------------- | ----------------------------------------------- | ----------------------------------- |
| `format` | `'([\[$all_status$ahead_behind\]]($style) )'` | Định dạng mặc định cho `git_status` |
| `conflicted` | `"="` | Nhánh này có nhiều merge conflicts. |
| `ahead` | `"⇡"` | Định dạng của `ahead` |
| `behind` | `"⇣"` | Định dạng của `behind` |
| `diverged` | `"⇕"` | Định dạng của `diverged` |
| `up_to_date` | `""` | The format of `up_to_date` |
| `untracked` | `"?"` | Định dạng của `untracked` |
| `stashed` | `"$"` | Định dạng của `stashed` |
| `modified` | `"!"` | Định dạng của `modified` |
| `staged` | `"+"` | Định dạng của `modified` |
| `renamed` | `"»"` | Định dạng của `renamed` |
| `deleted` | `"✘"` | Định dạng của `deleted` |
| `style` | `"bold red"` | Kiểu cho module. |
| `ignore_submodules` | `false` | Ignore changes to submodules. |
| `disabled` | `false` | Disables the `git_status` module. |
### Các biến
Các biến dưới đây có thể được sử dụng trong `format`:
The following variables can be used in `format`:
| Biến | Mô tả |
| -------------- | ------------------------------------------------------------------------------------------------------------- |
@ -1370,14 +1384,14 @@ Các biến dưới đây có thể được sử dụng trong `format`:
\*: Biến này có thể chỉ được sử dụng như một phần của style string
Các biến sau có thể được sử dụng trong `diverged`:
The following variables can be used in `diverged`:
| Biến | Mô tả |
| -------------- | --------------------------------------------- |
| `ahead_count` | Số lượng commit phía trước của nhánh tracking |
| `behind_count` | Số lượng commit phía sau nhánh tracking |
Các biến sau có thể được sử dụng trong `conflicted`, `ahead`, `behind`, `untracked`, `stashed`, `modified`, `staged`, `renamed` and `deleted`:
The following variables can be used in `conflicted`, `ahead`, `behind`, `untracked`, `stashed`, `modified`, `staged`, `renamed` and `deleted`:
| Biến | Mô tả |
| ------- | ----------------------------- |
@ -1402,7 +1416,7 @@ renamed = "👅"
deleted = "🗑"
```
Hiển thị tổng số nhánh phía trước/phía sau của nhánh được track
Show ahead/behind count of the branch being tracked
```toml
# ~/.config/starship.toml
@ -1499,7 +1513,7 @@ format = "via [⎈ $version](bold white) "
## Hostname
Mô đun `hostname` hiển thị hostnam hệ thống.
The `hostname` module shows the system hostname.
### Các tuỳ chọn
@ -1513,10 +1527,10 @@ Mô đun `hostname` hiển thị hostnam hệ thống.
### Các biến
| Biến | Ví dụ | Mô tả |
| --------- | ----- | -------------------------------- |
| symbol | | Giá trị ghi đè tuỳ chọn `symbol` |
| style\* | | Giá trị ghi đè của `style` |
| Biến | Ví dụ | Mô tả |
| --------- | ---------- | ---------------------------- |
| hostname | `computer` | The hostname of the computer |
| style\* | | Giá trị ghi đè của `style` |
\*: Biến này có thể chỉ được sử dụng như một phần của style string
@ -1573,7 +1587,7 @@ symbol = "🌟 "
## Jobs
`jobs` module cho biết số lượng các jobs đang chạy. Mô đun sẽ được hiển thị chỉ khi có background jobs đang chạy. 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 `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.
The default functionality is:
@ -1712,17 +1726,17 @@ symbol = "🅺 "
# ~/.config/starship.toml
[kotlin]
# Sử dụng Kitlin Compiler nhị phân để lấy phiên bản được cài đặt
# Uses the Kotlin Compiler binary to get the installed version
kotlin_binary = "kotlinc"
```
## Kubernetes
Displays the current [Kubernetes context](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#context) name and, if set, the namespace from the kubeconfig file. Namespace cần được thiết lập trong tệp tin kubeconfig, cài này có thể được thực thi thông qua `kubectl config set-context starship-cluster --namespace astronaut`. Nếu biến môi trường `$KUBECONFIG` được thiết lập, mô đun sẽ sử dụng cái đó nếu nó không sử dụng `~/.kube/config`.
Displays the current [Kubernetes context](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#context) name and, if set, the namespace from the kubeconfig file. The namespace needs to be set in the kubeconfig file, this can be done via `kubectl config set-context starship-cluster --namespace astronaut`. If the `$KUBECONFIG` env var is set the module will use that if not it will use the `~/.kube/config`.
::: thử thuật
::: tip
Mặc định, mô đun này được vô hiệu. Để kích hoạt nó, thiết lập `disabled` sang `false` trong tập tin cấu hình của bạn.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -1848,9 +1862,9 @@ The `memory_usage` module shows current system memory and swap usage.
By default the swap usage is displayed if the total system swap is non-zero.
::: thử thuật
::: tip
Mặc định, mô đun này được vô hiệu. Để kích hoạt nó, thiết lập `disabled` sang `false` trong tập tin cấu hình của bạn.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -2133,7 +2147,7 @@ symbol = "☁️ "
## 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`, `composer`, `gradle`, `julia`, `mix`, `helm` and `shards` packages.
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`, `composer`, `gradle`, `julia`, `mix`, `helm`, `shards` 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
@ -2150,6 +2164,7 @@ The `package` module is shown when the current directory is the repository for a
- [**Shards**](https://crystal-lang.org/reference/the_shards_command/index.html) - The `shards` package version is extracted from the `shard.yml` present
- [**V**](https://vlang.io) - The `vlang` package version is extracted from the `v.mod` present
- [**SBT**](https://scala-sbt.org) - The `sbt` package version is extracted from the `build.sbt` present in the current directory
- [**Dart**](https://pub.dev/) - The `dart` package version is extracted from the `pubspec.yaml` present in the current directory
> ⚠️ The version being shown is that of the package whose source code is in your current directory, not your package manager.
@ -2267,7 +2282,7 @@ format = "via [🔹 $version](147 bold) "
The `pulumi` module shows the currently selected [Pulumi Stack](https://www.pulumi.com/docs/intro/concepts/stack/) and version.
::: thử thuật
::: tip
By default the Pulumi version is not shown, since it takes an order of magnitude longer to load then most plugins (~70ms). If you still want to enable it, [follow the example shown below](#with-pulumi-version).
@ -2393,7 +2408,7 @@ Mặc định module sẽ được hiển thị nếu có bất kì điều ki
| `detect_folders` | `[]` | Thư mục nào sẽ kích hoạt mô-đun này |
| `disabled` | `false` | Disables the `python` module. |
::: thử thuật
::: tip
The `python_binary` variable accepts either a string or a list of strings. Starship will try executing each binary until it gets a result. Note you can only change the binary that Starship executes to get the version of Python not the arguments that are used.
@ -2655,9 +2670,9 @@ symbol = "🌟 "
The `shell` module shows an indicator for currently used shell.
::: thử thuật
::: tip
Mặc định, mô đun này được vô hiệu. Để kích hoạt nó, thiết lập `disabled` sang `false` trong tập tin cấu hình của bạn.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -2673,6 +2688,8 @@ Mặc định, mô đun này được vô hiệu. Để kích hoạt nó, thiế
| `elvish_indicator` | `esh` | A format string used to represent elvish. |
| `tcsh_indicator` | `tsh` | A format string used to represent tcsh. |
| `xonsh_indicator` | `xsh` | A format string used to represent xonsh. |
| `cmd_indicator` | `cmd` | A format string used to represent cmd. |
| `nu_indicator` | `nu` | A format string used to represent nu. |
| `unknown_indicator` | | The default value to be displayed when the shell is unknown. |
| `format` | `"[$indicator]($style) "` | Định dạng cho module. |
| `style` | `"white bold"` | Kiểu cho module. |
@ -2772,13 +2789,13 @@ format = '[📦 \[$env\]]($style) '
The `status` module displays the exit code of the previous command. The module will be shown only if the exit code is not `0`.
::: thử thuật
::: tip
Mặc định, mô đun này được vô hiệu. Để kích hoạt nó, thiết lập `disabled` sang `false` trong tập tin cấu hình của bạn.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
::: warning This module is not supported on elvish and nu shell. :::
::: warning This module is not supported on nu shell. :::
### Các tuỳ chọn
@ -2804,6 +2821,7 @@ Mặc định, mô đun này được vô hiệu. Để kích hoạt nó, thiế
| Biến | Ví dụ | Mô tả |
| -------------- | ------- | ------------------------------------------------------------------------------------------- |
| status | `127` | The exit code of the last command |
| hex_status | `0x7F` | The exit code of the last command in hex |
| int | `127` | The exit code of the last command |
| common_meaning | `ERROR` | Meaning of the code if not a signal |
| signal_number | `9` | Signal number corresponding to the exit code, only if signalled |
@ -2834,9 +2852,9 @@ disabled = false
The `sudo` module displays if sudo credentials are currently cached. The module will only be shown if credentials are cached.
::: thử thuật
::: tip
Mặc định, mô đun này được vô hiệu. Để kích hoạt nó, thiết lập `disabled` sang `false` trong tập tin cấu hình của bạn.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -2923,7 +2941,7 @@ format = "via [🏎 $version](red bold)"
The `terraform` module shows the currently selected [Terraform workspace](https://www.terraform.io/docs/language/state/workspaces.html) and version.
::: thử thuật
::: tip
By default the Terraform version is not shown, since this is slow for current versions of Terraform when a lot of plugins are in use. If you still want to enable it, [follow the example shown below](#with-terraform-version).
@ -2982,9 +3000,9 @@ format = "[🏎💨 $workspace]($style) "
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.
::: thử thuật
::: tip
Mặc định, mô đun này được vô hiệu. Để kích hoạt nó, thiết lập `disabled` sang `false` trong tập tin cấu hình của bạn.
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -3033,7 +3051,7 @@ The `username` module shows active user's username. Module cho sẽ được hi
- The user is currently connected as an SSH session
- The variable `show_always` is set to true
::: thử thuật
::: tip
SSH connection is detected by checking environment variables `SSH_CONNECTION`, `SSH_CLIENT`, and `SSH_TTY`. If your SSH host does not set up these variables, one workaround is to set one of them with a dummy value.
@ -3224,19 +3242,19 @@ These modules will be shown if any of the following conditions are met:
- The `when` command returns 0
- The current Operating System (std::env::consts::OS) matchs with `os` field if defined.
::: thử thuật
::: tip
Multiple custom modules can be defined by using a `.`.
:::
::: thử thuật
::: tip
The order in which custom modules are shown can be individually set by including `${custom.foo}` in the top level `format` (as it includes a dot, you need to use `${...}`). By default, the `custom` module will simply show all custom modules in the order they were defined.
:::
::: thử thuật
::: tip
[Issue #1252](https://github.com/starship/starship/discussions/1252) contains examples of custom modules. If you have an interesting example not covered there, feel free to share it there!

View File

@ -69,13 +69,13 @@ Nếu bạn thấy các biểu tượng bạn không biết, bạn có thể s
You can enable the debug logs by using the `STARSHIP_LOG` env var. These logs can be very verbose so it is often useful to use the `module` command if you are trying to debug a particular module, for example, if you are trying to debug the `rust` module you could run the following command to get the trace logs and output from the module.
```sh
env STARHIP_LOG=trace starship module rust
env STARSHIP_LOG=trace starship module rust
```
If starship is being slow you can try using the `timings` command to see if there is a particular module or command that to blame.
```sh
env STARHIP_LOG=trace starship timings
env STARSHIP_LOG=trace starship timings
```
This will output the trace log and a breakdown of all modules that either took more than 1ms to execute or produced some output.
@ -118,5 +118,5 @@ If Starship was installed using the install script, the following command will d
```sh
# Locate and delete the starship binary
sh -c 'rm "$(which starship)"'
sh -c 'rm "$(command -v 'starship')"'
```

View File

@ -72,6 +72,22 @@
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-fr.png"
alt="Thiếng Pháp"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/id-ID/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-id.png"
alt="Bahasa Indonesia"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/it-IT/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-it.png"
alt="Italiano"
/></a>
&nbsp;
<a
@ -79,7 +95,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-jp.png"
alt="Tiếng Nhật"
alt="日本語"
/></a>
&nbsp;
<a
@ -95,7 +111,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-ru.png"
alt="Tiếng Nga"
alt="Русский"
/></a>
&nbsp;
<a
@ -111,7 +127,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-cn.png"
alt="Tiếng Trung giản thể"
alt="简体中文"
/></a>
&nbsp;
<a
@ -119,7 +135,7 @@
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-tw.png"
alt="Tiếng Trung hiện đại"
alt="繁體中文"
/></a>
</p>
@ -252,7 +268,7 @@
#### Elvish
**Cảnh báo** Chỉ elvish v0.15 hoặc cao hơn được hỗ trợ. Thêm đoạn sau vào cuối tệp tin `~/.elvish/rc.elv`:
**Warning** Only elvish v0.17 or higher is supported. Thêm đoạn sau vào cuối tệp tin `~/.elvish/rc.elv`:
```sh
# ~/.elvish/rc.elv
@ -283,9 +299,20 @@
```
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```
#### Nushell
**Cảnh báo ** Cái này có thể bị thay đổi trong tương lai. Chỉ có nu phiên bản v. 033 hoặc cao hơn được hỗ trợ. Thêm dòng sau vào file cấu hình nu. Bạn có thể kiểm tra vị trí của cái file này bằng cách chạy `đường dẫn cấu hình` trong nu.
**Warning** This will change in the future. Chỉ có nu phiên bản v. 033 hoặc cao hơn được hỗ trợ. Add the following to your nu config file. Bạn có thể kiểm tra vị trí của cái file này bằng cách chạy `đường dẫn cấu hình` trong nu.
```toml
startup = [

View File

@ -224,7 +224,7 @@ format = '\[[$symbol($version)]($style)\]'
format = '\[[$symbol($version)]($style)\]'
[sudo]
format = '\[[as $symbol]\]
format = '\[[as $symbol]\]'
[swift]
format = '\[[$symbol($version)]($style)\]'

View File

@ -18,7 +18,7 @@ features:
footer: ISC Licensed | Copyright © 2019-present Starship Contributors
#Used for the description meta tag, for SEO
metaTitle: "Starship可用于各种 Shell 的提示符"
description: Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the information you need, while staying sleek and minimal. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, and PowerShell.
description: Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the information you need, while staying sleek and minimal. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and PowerShell.
---
<div class="center">
@ -44,7 +44,7 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
```sh
sh -c "$(curl -fsSL https://starship.rs/install.sh)"
```
To update the Starship itself, rerun the above script. It will replace the current version without touching Starship's configuration.
自更新 Starship ,运行下面脚本 将会在不改动 Starship 配置文件的情况下升级版本
#### 通过软件包管理器安装
@ -119,9 +119,9 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
#### Elvish
::: warning Only elvish v0.15 or higher is supported. :::
::: warning Only elvish v0.17 or higher is supported. :::
Add the following to the end of `~/.elvish/rc.elv`:
`~/.config/fish/rc.elv` 的最后,添加以下内容:
```sh
# ~/.elvish/rc.elv
@ -132,7 +132,7 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
#### Tcsh
Add the following to the end of `~/.tcshrc`:
`~/.bashhrc` 的最后,添加以下内容:
```sh
# ~/.tcshrc
@ -164,3 +164,14 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
execx($(starship init xonsh))
```
#### Cmd
您需要使用 [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) 与 Cmd. 将以下文件添加到文件 `starship.lua` 中,并将此文件放置在 Clink脚本目录中
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```

View File

@ -8,11 +8,35 @@
:::
## 在 Bash 中自定义预提示和预执行命令
## Custom pre-prompt and pre-execution Commands in Cmd
Bash 并没有类似大多数其它 shell 的正式预执行/预命令框架。 因此,很难在 `bash` 中提供完全可自定义的 hook 机制。 然而Starship 确实能使您有限地在提示符渲染过程中插入自己的函数执行:
Clink provides extremely flexible APIs to run pre-prompt and pre-exec commands in Cmd shell. It is fairly simple to use with Starship. Make the following changes to your `starship.lua` file as per your requirements:
- 若要在提示符显示之前运行自定义函数,需要定义此函数,然后将函数名赋值给 `starship_reserved_user_func`。 例如,要在提示符之前绘制一枚火箭,您应该写
- To run a custom function right before the prompt is drawn, define a new function called `starship_preprompt_user_func`. This function receives the current prompt as a string that you can utilize. For example, to draw a rocket before the prompt, you would do
```lua
function starship_preprompt_user_func(prompt)
print("🚀")
end
load(io.popen('starship init cmd'):read("*a"))()
```
- To run a custom function right before a command is executed, define a new function called `starship_precmd_user_func`. This function receives the current commandline as a string that you can utilize. For example, to print the command that's about to be executed, you would do
```lua
function starship_precmd_user_func(line)
print("Executing: "..line)
end
load(io.popen('starship init cmd'):read("*a"))()
```
## Custom pre-prompt and pre-execution Commands in Bash
Bash does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `bash`. 然而Starship 确实能使您有限地在提示符渲染过程中插入自己的函数执行:
- To run a custom function right before the prompt is drawn, define a new function and then assign its name to `starship_precmd_user_func`. For example, to draw a rocket before the prompt, you would do
```bash
function blastoff(){
@ -21,13 +45,13 @@ function blastoff(){
starship_precmd_user_func="blastoff"
```
- 要在一个命令运行前运行自定义函数,您可以使用 [`DEBUG` trap 机制](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/)。 然而,您**必须**在捕捉 DEBUG 信号*之前*启动 Starship Starship 可以保留 DEBUG trap 的值,但如果该 trap 在 starship 启动后被覆盖,一些功能将会被破坏。
- To run a custom function right before a command runs, you can use the [`DEBUG` trap mechanism](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). However, you **must** trap the DEBUG signal *before* initializing Starship! Starship can preserve the value of the DEBUG trap, but if the trap is overwritten after starship starts up, some functionality will break.
```bash
function blastoff(){
echo "🚀"
}
trap blastoff DEBUG # 启动 starship *之前* 设置 DEBUG trap
trap blastoff DEBUG # Trap DEBUG *before* running starship
eval $(starship init bash)
```
@ -43,11 +67,11 @@ function Invoke-Starship-PreCommand {
}
```
## 更改窗口标题
## Change Window Title
一些 shell 会自动更改您的窗口标题(比如改成您的工作目录)。 Fish 甚至默认会执行此功能。 Starship 没有实现此功能,但将这个功能添加到 `bash``zsh` 是相当简单的。
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash`, `zsh`, `cmd` or `powershell`.
首先,定义窗口标题更改函数(在 bash 和 zsh 中相同):
First, define a window title change function (identical in bash and zsh):
```bash
function set_win_title(){
@ -55,23 +79,23 @@ function set_win_title(){
}
```
您可以使用变量来定制标题(常用的有 `$USER``$HOSTNAME` 和 `$PWD`)。
You can use variables to customize this title (`$USER`, `$HOSTNAME`, and `$PWD` are popular choices).
`bash` 中,设置此函数为 starship 预执行函数:
In `bash`, set this function to be the precmd starship function:
```bash
starship_precmd_user_func="set_win_title"
```
`zsh`中,将此函数添加到 `reservmd_functions` 列表:
In `zsh`, add this to the `precmd_functions` array:
```bash
precmd_functions+=(set_win_title)
```
如果您对产生的效果感到满意,请将以上代码添加到您的 shell 配置文件(`~/.bashrc` 或 `~/zsrhc`)中以使其永久化。
If you like the result, add these lines to your shell configuration file (`~/.bashrc` or `~/.zshrc`) to make it permanent.
例如,如果您想要在终端标签标题中显示当前目录, 将以下代码添加到您的 `~/.ashrc` `~/.zshrc`:
For example, if you want to display your current directory in your terminal tab title, add the following snippet to your `~/.bashrc` or `~/.zshrc`:
```bash
function set_win_title(){
@ -80,6 +104,16 @@ function set_win_title(){
starship_precmd_user_func="set_win_title"
```
For Cmd, you can change the window title using the `starship_preprompt_user_func` function.
```lua
function starship_preprompt_user_func(prompt)
console.settitle(os.getenv('USERNAME').."@"..os.getenv('COMPUTERNAME')..": "..os.getcwd())
end
load(io.popen('starship init cmd'):read("*a"))()
```
You can also set a similar output with PowerShell by creating a function named `Invoke-Starship-PreCommand`.
```powershell
@ -91,13 +125,13 @@ function Invoke-Starship-PreCommand {
Invoke-Expression (&starship init powershell)
```
## 启用右侧提示
## Enable Right Prompt
一些 Shell 支持右侧提示, 它与输入区渲染在同一行。 Starship 可以设置右侧提示的内容,使用 `right_format` 选项。 Any module that can be used in `format` is also supported in `right_format`. The `$all` variable will only contain modules not explicitly used in either `format` or `right_format`.
Some shells support a right prompt which renders on the same line as the input. Starship can set the content of the right prompt using the `right_format` option. Any module that can be used in `format` is also supported in `right_format`. The `$all` variable will only contain modules not explicitly used in either `format` or `right_format`.
Note: The right prompt is a single line following the input location. To right align modules above the input line in a multi-line prompt, see the [fill module](/config/#fill).
`right_format` is currently supported for the following shells: elvish, fish, zsh.
`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd.
### 示例
@ -117,10 +151,32 @@ Produces a prompt like the following:
▶ starship on  rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s
```
## Continuation Prompt
Some shells support a continuation prompt along with the normal prompt. This prompt is rendered instead of the normal prompt when the user has entered an incomplete statement (such as a single left parenthesis or quote).
Starship can set the continuation prompt using the `continuation_prompt` option. The default prompt is `"[∙](bright-black) "`.
Note: `continuation_prompt` should be set to a literal string without any variables.
Note: Continuation prompts are only available in the following shells:
- `bash`
- `zsh`
- `PowerShell`
### 示例
```toml
# ~/.config/starship.toml
# A continuation prompt that displays two filled in arrows
continuation_prompt = "▶▶"
```
## 样式设定
样式字符串是用空格分隔的单词列表。 其中单词不是大小写敏感的(例如 `bold``BoLd` 被视为同一字符串)。 每个单词可以是以下之一:
Style strings are a list of words, separated by whitespace. The words are not case sensitive (i.e. `bold` and `BoLd` are considered the same string). Each word can be one of the following:
- `bold`
- `italic`
@ -132,14 +188,14 @@ Produces a prompt like the following:
- `<color>`
- `none`
`<color>` 是颜色说明符(下面解释)。 `fg:<color>` and `<color>` currently do the same thing, though this may change in the future. `inverted` swaps the background and foreground colors. 字符串中的单词顺序不影响显示结果。
where `<color>` is a color specifier (discussed below). `fg:<color>` and `<color>` currently do the same thing, though this may change in the future. `inverted` swaps the background and foreground colors. The order of words in the string does not matter.
The `none` token overrides all other tokens in a string if it is not part of a `bg:` specifier, so that e.g. `fg:red none fg:blue` will still create a string with no styling. `bg:none` sets the background to the default color so `fg:red bg:none` is equivalent to `red` or `fg:red` and `bg:green fg:red bg:none` is also equivalent to `fg:red` or `red`. 未来可能会将 `none` 与其它标识符一起使用视为一种错误。
The `none` token overrides all other tokens in a string if it is not part of a `bg:` specifier, so that e.g. `fg:red none fg:blue` will still create a string with no styling. `bg:none` sets the background to the default color so `fg:red bg:none` is equivalent to `red` or `fg:red` and `bg:green fg:red bg:none` is also equivalent to `fg:red` or `red`. It may become an error to use `none` in conjunction with other tokens in the future.
颜色说明符可以是以下内容之一:
A color specifier can be one of the following:
- 标准终端颜色之一:`black``red``green``blue``yellow``purple``cyan``white`。 您可以使用可选前缀 `bright-` 来获取明亮版本的颜色(例如,`bright-white`)。
- 一个 `#` 后跟一个六位十六进制数。 这将指定一个 [十六进制 RGB 颜色代码](https://www.w3schools.com/colors/colors_hexadecimal.asp)。
- 0-255 之间的数字。 这将指定一个 [8 位 ANSI 颜色码](https://i.stack.imgur.com/KTSQa.png)。
- One of the standard terminal colors: `black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`. You can optionally prefix these with `bright-` to get the bright version (e.g. `bright-white`).
- A `#` followed by a six-digit hexadecimal number. This specifies an [RGB color hex code](https://www.w3schools.com/colors/colors_hexadecimal.asp).
- A number between 0-255. This specifies an [8-bit ANSI Color Code](https://i.stack.imgur.com/KTSQa.png).
如果为文本/背景指定了多个颜色,字符串中最后指定的颜色将具有最高优先级。
If multiple colors are specified for foreground/background, the last one in the string will take priority.

Some files were not shown because too many files have changed in this diff Show More