1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-06-10 20:32:21 +00:00
starship/src/init/starship.nu

40 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

feat: update the nushell init file and make it valid module and overlay (#5188) * break long commands into multiple lines for readability * fix the format of closures We generally write `{|| ...}` instead of `{ || ...}`. * remove the `$"--opt=(val)"` structure when possible `starship` does not require to use `--opt=val` and so we do not need to do that with Nushell :) the only place where this is required is with `--status` because `$env.LAST_EXIT_CODE` can be negative and `starship` does not appear to *like* values of the form `-2`... so i left this line as it was. on the other hand, `$env.CMD_DURATION_MS` and `(term size).columns` should be fine :relieved: * simplify the `config` mutation with new `?` syntax This is a new very handy feature of Nushell which gives a much simpler command combined with `default` and `merge`. * put all `let-env`s inside an `export-env` with `load-env` This commit has two reasons of existing: - i think it makes it a bit easier to read with less `let-env`s - it transforms the *script* into both a valid module and a valid overlay * bump the version to `0.78` in to docs * add a note about the init file being also a module to all docs * tweak the documentation * update the Nushell part of the install script * format the vuepress config file as previous commit 117580136d3da5e00a4ccb7ada508c8510a2e50e was not successful, let's try to make the CI happy manually :relieved: * remove code quotes in the `config_cmd` of Nushell * format the style in the Nushell `warning` section
2023-06-12 09:02:46 +00:00
# this file is both a valid
# - overlay which can be loaded with `overlay use starship.nu`
# - module which can be used with `use starship.nu`
# - script which can be used with `source starship.nu`
export-env { load-env {
STARSHIP_SHELL: "nu"
STARSHIP_SESSION_KEY: (random chars -l 16)
PROMPT_MULTILINE_INDICATOR: (
^::STARSHIP:: prompt --continuation
)
2021-07-04 19:32:58 +00:00
feat: update the nushell init file and make it valid module and overlay (#5188) * break long commands into multiple lines for readability * fix the format of closures We generally write `{|| ...}` instead of `{ || ...}`. * remove the `$"--opt=(val)"` structure when possible `starship` does not require to use `--opt=val` and so we do not need to do that with Nushell :) the only place where this is required is with `--status` because `$env.LAST_EXIT_CODE` can be negative and `starship` does not appear to *like* values of the form `-2`... so i left this line as it was. on the other hand, `$env.CMD_DURATION_MS` and `(term size).columns` should be fine :relieved: * simplify the `config` mutation with new `?` syntax This is a new very handy feature of Nushell which gives a much simpler command combined with `default` and `merge`. * put all `let-env`s inside an `export-env` with `load-env` This commit has two reasons of existing: - i think it makes it a bit easier to read with less `let-env`s - it transforms the *script* into both a valid module and a valid overlay * bump the version to `0.78` in to docs * add a note about the init file being also a module to all docs * tweak the documentation * update the Nushell part of the install script * format the vuepress config file as previous commit 117580136d3da5e00a4ccb7ada508c8510a2e50e was not successful, let's try to make the CI happy manually :relieved: * remove code quotes in the `config_cmd` of Nushell * format the style in the Nushell `warning` section
2023-06-12 09:02:46 +00:00
# Does not play well with default character module.
# TODO: Also Use starship vi mode indicators?
PROMPT_INDICATOR: ""
feat: update the nushell init file and make it valid module and overlay (#5188) * break long commands into multiple lines for readability * fix the format of closures We generally write `{|| ...}` instead of `{ || ...}`. * remove the `$"--opt=(val)"` structure when possible `starship` does not require to use `--opt=val` and so we do not need to do that with Nushell :) the only place where this is required is with `--status` because `$env.LAST_EXIT_CODE` can be negative and `starship` does not appear to *like* values of the form `-2`... so i left this line as it was. on the other hand, `$env.CMD_DURATION_MS` and `(term size).columns` should be fine :relieved: * simplify the `config` mutation with new `?` syntax This is a new very handy feature of Nushell which gives a much simpler command combined with `default` and `merge`. * put all `let-env`s inside an `export-env` with `load-env` This commit has two reasons of existing: - i think it makes it a bit easier to read with less `let-env`s - it transforms the *script* into both a valid module and a valid overlay * bump the version to `0.78` in to docs * add a note about the init file being also a module to all docs * tweak the documentation * update the Nushell part of the install script * format the vuepress config file as previous commit 117580136d3da5e00a4ccb7ada508c8510a2e50e was not successful, let's try to make the CI happy manually :relieved: * remove code quotes in the `config_cmd` of Nushell * format the style in the Nushell `warning` section
2023-06-12 09:02:46 +00:00
PROMPT_COMMAND: {||
# jobs are not supported
(
^::STARSHIP:: prompt
--cmd-duration $env.CMD_DURATION_MS
$"--status=($env.LAST_EXIT_CODE)"
--terminal-width (term size).columns
)
}
feat: update the nushell init file and make it valid module and overlay (#5188) * break long commands into multiple lines for readability * fix the format of closures We generally write `{|| ...}` instead of `{ || ...}`. * remove the `$"--opt=(val)"` structure when possible `starship` does not require to use `--opt=val` and so we do not need to do that with Nushell :) the only place where this is required is with `--status` because `$env.LAST_EXIT_CODE` can be negative and `starship` does not appear to *like* values of the form `-2`... so i left this line as it was. on the other hand, `$env.CMD_DURATION_MS` and `(term size).columns` should be fine :relieved: * simplify the `config` mutation with new `?` syntax This is a new very handy feature of Nushell which gives a much simpler command combined with `default` and `merge`. * put all `let-env`s inside an `export-env` with `load-env` This commit has two reasons of existing: - i think it makes it a bit easier to read with less `let-env`s - it transforms the *script* into both a valid module and a valid overlay * bump the version to `0.78` in to docs * add a note about the init file being also a module to all docs * tweak the documentation * update the Nushell part of the install script * format the vuepress config file as previous commit 117580136d3da5e00a4ccb7ada508c8510a2e50e was not successful, let's try to make the CI happy manually :relieved: * remove code quotes in the `config_cmd` of Nushell * format the style in the Nushell `warning` section
2023-06-12 09:02:46 +00:00
config: ($env.config? | default {} | merge {
render_right_prompt_on_last_line: true
})
feat: update the nushell init file and make it valid module and overlay (#5188) * break long commands into multiple lines for readability * fix the format of closures We generally write `{|| ...}` instead of `{ || ...}`. * remove the `$"--opt=(val)"` structure when possible `starship` does not require to use `--opt=val` and so we do not need to do that with Nushell :) the only place where this is required is with `--status` because `$env.LAST_EXIT_CODE` can be negative and `starship` does not appear to *like* values of the form `-2`... so i left this line as it was. on the other hand, `$env.CMD_DURATION_MS` and `(term size).columns` should be fine :relieved: * simplify the `config` mutation with new `?` syntax This is a new very handy feature of Nushell which gives a much simpler command combined with `default` and `merge`. * put all `let-env`s inside an `export-env` with `load-env` This commit has two reasons of existing: - i think it makes it a bit easier to read with less `let-env`s - it transforms the *script* into both a valid module and a valid overlay * bump the version to `0.78` in to docs * add a note about the init file being also a module to all docs * tweak the documentation * update the Nushell part of the install script * format the vuepress config file as previous commit 117580136d3da5e00a4ccb7ada508c8510a2e50e was not successful, let's try to make the CI happy manually :relieved: * remove code quotes in the `config_cmd` of Nushell * format the style in the Nushell `warning` section
2023-06-12 09:02:46 +00:00
PROMPT_COMMAND_RIGHT: {||
(
^::STARSHIP:: prompt
--right
--cmd-duration $env.CMD_DURATION_MS
$"--status=($env.LAST_EXIT_CODE)"
--terminal-width (term size).columns
)
}
}}