mirror of
https://github.com/starship/starship.git
synced 2024-12-26 09:08:53 +01:00
feat: Add support for the ion shell (#704)
This commit is contained in:
parent
835ecc3ae6
commit
93701b26b3
10
README.md
10
README.md
@ -192,6 +192,16 @@ The prompt shows information you need while you're working, while staying sleek
|
||||
Invoke-Expression (&starship init powershell)
|
||||
```
|
||||
|
||||
#### Ion
|
||||
|
||||
Add the following to the end of `~/.config/ion/initrc`:
|
||||
|
||||
```sh
|
||||
# ~/.config/ion/initrc
|
||||
|
||||
eval $(starship init ion)
|
||||
```
|
||||
|
||||
## 🔧 Configuration
|
||||
|
||||
For details on how to configure Starship, check out our [documentation](https://starship.rs/config/).
|
||||
|
@ -19,15 +19,15 @@ module.exports = {
|
||||
// prettier-ignore
|
||||
head: [
|
||||
["link", { rel: "icon", href: "/icon.png" }],
|
||||
["meta", { name: "description", content: "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, and Powershell." }],
|
||||
["meta", { name: "description", content: "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, and Powershell." }],
|
||||
["meta", { property: "og:title", content: "Starship: Cross-Shell Prompt" }],
|
||||
["meta", { property: "og:description", content: "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, and Powershell."}],
|
||||
["meta", { property: "og:description", content: "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, and Powershell."}],
|
||||
["meta", { property: "og:type", content: "website" }],
|
||||
["meta", { property: "og:url", content: "https://starship.rs/" }],
|
||||
["meta", { property: "og:image", content: "https://starship.rs/icon.png" }],
|
||||
["meta", { name: "twitter:card", content: "summary"}],
|
||||
["meta", { name: "twitter:title", content: "Starship: Cross-Shell Prompt"}],
|
||||
["meta", { name: "twitter:description", content: "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, and Powershell.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, and Powershell."}],
|
||||
["meta", { name: "twitter:description", content: "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, and Powershell."}],
|
||||
["meta", { name: "twitter:image", content: "https://starship.rs/icon.png"}],
|
||||
["meta", { name: "twitter:alt", content: "Starship: Cross-Shell Prompt"}],
|
||||
],
|
||||
|
@ -261,4 +261,9 @@ info "Please follow the steps for your shell to complete the installation:
|
||||
|
||||
eval \"\$(starship init zsh)\"
|
||||
|
||||
${BOLD}${UNDERLINE}Ion${NO_COLOR}
|
||||
Add the following to the end of ${BOLD}~/.config/ion/initrc${NO_COLOR}:
|
||||
|
||||
eval $(starship init ion)
|
||||
|
||||
"
|
||||
|
@ -109,6 +109,10 @@ fi"#,
|
||||
);
|
||||
Some(script)
|
||||
}
|
||||
Some("ion") => {
|
||||
let script = format!("eval $({} init ion --print-full-init)", starship);
|
||||
Some(script)
|
||||
}
|
||||
None => {
|
||||
println!(
|
||||
"Invalid shell name provided: {}\\n\
|
||||
@ -122,7 +126,7 @@ fi"#,
|
||||
Some(shell_basename) => {
|
||||
println!(
|
||||
"printf \"\\n{0} is not yet supported by starship.\\n\
|
||||
For the time being, we support bash, zsh, and fish.\\n\
|
||||
For the time being, we support bash, zsh, fish, and ion.\\n\
|
||||
Please open an issue in the starship repo if you would like to \
|
||||
see support for {0}:\\nhttps://github.com/starship/starship/issues/new\"\\n\\n",
|
||||
shell_basename
|
||||
@ -146,6 +150,7 @@ pub fn init_main(shell_name: &str) -> io::Result<()> {
|
||||
"zsh" => Some(ZSH_INIT),
|
||||
"fish" => Some(FISH_INIT),
|
||||
"powershell" => Some(PWSH_INIT),
|
||||
"ion" => Some(ION_INIT),
|
||||
_ => {
|
||||
println!(
|
||||
"printf \"Shell name detection failed on phase two init.\\n\
|
||||
@ -186,3 +191,5 @@ const ZSH_INIT: &str = include_str!("starship.zsh");
|
||||
const FISH_INIT: &str = include_str!("starship.fish");
|
||||
|
||||
const PWSH_INIT: &str = include_str!("starship.ps1");
|
||||
|
||||
const ION_INIT: &str = include_str!("starship.ion");
|
||||
|
15
src/init/starship.ion
Normal file
15
src/init/starship.ion
Normal file
@ -0,0 +1,15 @@
|
||||
# The PROMPT function is called whenever a prompt needs to be drawn. Docs: https://doc.redox-os.org/ion-manual/html/misc/06-prompt_fn.html
|
||||
fn PROMPT
|
||||
# Save the status immediately, since the status is also updated after variable assignment, etc.
|
||||
let STARSHIP_ION_STATUS = $?
|
||||
# Save the ION_CMD_DURATION before running any other commands, but after the status since the
|
||||
# duration is not updated during variable assignment
|
||||
let STARSHIP_ION_CMD_DURATION = $ION_CMD_DURATION
|
||||
|
||||
# The STARSHIP between the colons will be replaced with the actual path to the starship executable.
|
||||
# The jobs command outputs to stderr, therefore we need to pipe stderr to `wc -l`.
|
||||
::STARSHIP:: prompt --status $STARSHIP_ION_STATUS --jobs $(jobs ^| wc -l) --cmd-duration $STARSHIP_ION_CMD_DURATION
|
||||
end
|
||||
|
||||
# Export the correct name of the shell
|
||||
export STARSHIP_SHELL="ion"
|
@ -34,7 +34,7 @@ fn main() {
|
||||
let shell_arg = Arg::with_name("shell")
|
||||
.value_name("SHELL")
|
||||
.help(
|
||||
"The name of the currently running shell\nCurrently supported options: bash, zsh, fish, powershell",
|
||||
"The name of the currently running shell\nCurrently supported options: bash, zsh, fish, powershell, ion",
|
||||
)
|
||||
.required(true);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user