summaryrefslogtreecommitdiffstats
path: root/src/main.rs
AgeCommit message (Collapse)Author
2021-07-04feat: add support for nu shell (#2847)David Knaack
2021-03-31feat(config): allow printing default and computed config (#2521)David Knaack
* feat: allow printing default and computed config * fix custom modules * actually fix custom modules
2021-02-27feat: add support for tcsh (#2288)Vivek Malneedi
* feat: add support for tcsh * add tcsh to install.sh install message * list tcsh in bug_report.rs and main.rs * quote starship path Co-authored-by: David Knaack <davidkna@users.noreply.github.com> * fix job count * add tcsh support to shell module * fix STARSHIP_START_TIME undefined error * preserve existing user precmd and postcmd, remove jobs support * remove unnecessary parentheses * minor script improvement * removes parens from install script message * Update docs/config/README.md Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com> Co-authored-by: David Knaack <davidkna@users.noreply.github.com> Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2021-02-08refactor(directory): Introduce `logical-path` argument which allows a shell ↵Benjamin Fox
to explicitly specify both a logical and physical filesystem path (#2104) * refactor(directory): Introduce `logical-path` argument which allows a shell to explicitly specify both a logical and physical filesystem path Fix `directory::module` to consume both path and logical-path (if provided). The "logical" path is preferred when rendering the "display path", while the "physical" path is used to resolve the "read only" flag. Repo- and home-directory contraction behavior is maintained, based on the logical path if it is set, or the physical path if it is not. The custom "get_current_dir" logic has been removed entirely, and the `directory` module now relies on `context.current_dir` / `context.logical_dir` entirely. Changes have been made to `init/starship.ps1` to work with this new flag: - Calculate and pass "physical" and "logical" paths explicitly (as other shells do not pass `--logical-path` that they fall back to rendering the physical path) - Moved the "powershell provider prefix" cleanup code to the PowerShell script - this code _should_ now support any kind of powershell path prefix. * fix(powershell): Fix an issue with trailing backslashes on file paths causing command line parsing issues. This is a bit of a footgun! The work-around chosen is to append a trailing space when a path string ends with a backslash, and then trim any extra whitespace away in the Context constructor. Other alternatives considered and rejected: 1. Always trim trailing backslashes as the filesystem generally doesn't need them. 2. Escape trailing backslashes with another backslash. This proved complex as PS only quotes string args when the string includes some whitespace, and other backslashes within the string apparently don't need to be escaped. * fix(powershell): Use Invoke-Native pattern for safely invoking native executables with strings which may contain characters which need to be escaped carefully. * fix(context): Remove superfluous argument trims These were in place to clean up extra whitespace sometimes injected by starship.ps1::prompt, and are no longer required with the new Invoke-Native helper in place. * refactor(directory): Clean up the semantics of `logical_dir` defaulting it to `current_dir` but overridable by the `--logical-dir` flag. - Restore `use_logical_path` config flag. - Always attempt to contract repo paths from the `current_dir`. * fix(directory) :Use logical_dir for contracting the home directory This keeps the two calls to contract_path in sync. * fix(directory): Remove test script * refactor(directory): Convert current_dir to canonical filesystem path when use_logical_path = false - This requires some clean-up to remove the extended-path prefix on Windows - The configured logical_dir is ignored entirely in this mode - we calculate a new logical_dir by cleaning up the physical_dir path for display. - Test coverage * fix(directory): Use AsRef style for passing Path arguments * fix(directory): Strip the windows extended-path prefix from the display string later in the render process * fix(docs): Update docs/config/README.md for use_logical_path * refactor(context): Populate `current_dir` from `--path` or `std::env::current_dir`, populate `logical_dir` from `--logical-path` or the `PWD` env var - `current_dir` is always canonicalized - On Windows, `current_dir` will have an extended-path prefix - `logical_dir` is now always set - `directory::module` now just selects between `current_dir` and `logical_dir` when picking which path to render - Test coverage * fix(directory): Fix path comparison operations in directory to ignore differences between path prefixes - Added PathExt extension trait which adds `normalised_equals`, `normalised_starts_with` and `without_prefix` * fix(path): Add test coverage for PathExt on *nix * fix(directory): Test coverage for `contract_repo_path`, `contract_path` with variations of verbatim and non-verbatim paths * fix(directory): Update path-slash to latest This fixes the issue with the trailing character of some Windows paths being truncated, e.g. `\\server\share` and `C:` * fix(powershell): Improve UTF8 output handling, argument encoding - Use `ProcessStartInfo` to launch native executable, replacing manual UTF8 output encoding handling - If we detect we're on PWSH6+ use the new `System.Diagnostics.ProcessStartInfo.ArgumentList` parameter, otherwise manually escape the argument string - Move `Get-Cwd` and `Invoke-Native` into the prompt function scope so that they don't leak into the user's shell scope * fix(path): Make PathExt methods no-ops on *nix * fix(path): Cargo fmt * fix(powershell): Remove typo ';'. Fix variable assignment lint.
2021-02-02feat: add support for elvish shell (#1725)David Knaack
* feat: add support for elvish shell * improve doc * elvish 0.15 is out * fix example init * update systax for 0.15 stable * udpate second init example too * remove warning from swift module * add warning to status module docs * prefix elvish version with v
2021-01-22build: Add additional build information to version and bug report (#2124)Rust大闸蟹
* fix https://github.com/starship/starship/issues * cargo fmt * upgrade shadow-rs 0.5.6 * upgrade shadow-rs * update * complet bug_report infomation * cargo fmt * upgrade shadow-rs 0.5.11 * upgrade shadow-rs 0.5.14 * fixed:https://github.com/starship/starship/pull/2124#discussion_r559076634 fixed:https://github.com/starship/starship/pull/2124#discussion_r559076918 * add long_version * upgrade shadow-rs 0.5.19; adaptate clap version() use by shadow-rs clap_version() * fix unit test error * fix test error * upgrade shadow-rs 0.5.22 * upgrade shadow-rs 0.5.23
2021-01-07feat(command): add 'toggle' command (#1917)Furkan Türkal
Closes #894 Signed-off-by: Dentrax <furkan.turkal@hotmail.com>
2020-12-25build(deps): bump rand from 0.7.3 to 0.8.0 (#2016)dependabot-preview[bot]
2020-11-11fix(windows): configure console to enable ANSI support (#1646)David Knaack
2020-10-17chore: fix the double compiling of lib and bin (#1616)jRimbault
* fix: rust modules are compiled twice The modules being declared both in the _library_ crate and the _binary_ crate made cargo compile everything twice: 1. for the library 2. for the binary What happened was: 1. The library "starship" was compiled. 2. The binary "starship" (and all its modules) were compiled. * fix: stop compiling every rust module twice restrict visibility * Run cargo fmt * Add bug_report module Co-authored-by: Matan Kushner <hello@matchai.dev> Co-authored-by: Kevin Song <chips@ksong.dev>
2020-09-28feat: add error messaging (#1576)Tilmann Meyer
This creates a custom logger for the log crate which logs everything to a file (/tmp/starship/session_$STARSHIP_SESSION_KEY.log) and it logs everything above Warn to stderr, but only if the log file does not contain the line that should be logged resulting in an error or warning to be only logged at the first starship invocation after opening the shell.
2020-09-21feat: Add timings subcommand (#1629)Jan Katins
* feat: Add computational duration to all computed modules This also means that in case we do some computations and these end up empty, we submit an empty module * feat: Add timings subcommand This outputs the timings of all computed modules, sorted by the duration it took to compute the module. Useful for debugging why the prompt takes so long. * feat: Add timings to explain output * fix: Ensure that even empty custom modules get timings * format main.rs * feat: Only show interesting timings * fix(tests): Change tests to look for empty string instead of None * Use proper wording in timings help * Revert "fix(tests): Change tests to look for empty string instead of None" This reverts commit aca5bd1b03c48e1dee1b7ca91d66e2bda2d5a97c. * fix(tests): Returning None in case the module produced an empty string * fix: Ensure that linebreaks (and space) make a module not-empty * Make cargo clippy happy * Make Module.duration a proper Duration * Only return a module if we would report it * Change to cleaner way to return None for empty modules * Avoid unnecessary module creation * Simplify a string comparison * Add timings to trace Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com> Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2020-08-07test: introduce env variable mocking (#1490)Tilmann Meyer
2020-06-14fix: replacing default RUST_LOG environement variable with starship specific ↵anouar kappitou
one, to prevent interlacing (#1280) Co-authored-by: Kappitou Anouar <anourkappitou@gmail.com>
2020-06-03feat: add shell completion generation command (`starship completions`) (#881)Nathan West
2020-04-26feat: Modify config keys from shell (#1095)John Letey
* feat: Modify config keys from shell * chore: Fix clippy * refactor: Add `configure` as alias * chore: Remove redundant code * fix: Soft error if user doesn't pass in valid key * feat: Support integers and booleans * chore: Fix clippy * refactor: Use exit instead of abort Co-Authored-By: Thomas O'Donnell <andytom@users.noreply.github.com> Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2020-04-06improvement: add parser for format strings (#1021)Zhenhui Xie
This PR implements the parser of format strings described in #624.
2020-01-01feat: Add the `starship explain` command (#699)Jon Grythe Stødle
This adds the explain argument to Starship, which explains what the printed modules in the prompt are.
2019-12-19feat: cmd_duration module optionally reports milliseconds (#696)Luca Rinaldi
2019-12-18feat: Implement `starship configure` command (#751)Dominik Braun
2019-12-14feat: Add `bug-report` sub-command (#725)Jon Grythe Stødle
This adds a sub command to generate the link. Information, such as operating system and it's version; the current shell's config; and current starship conf, is gathered from the environment and is included in the pre-filled text. The command will also try to open the link in the default browser. Should that fail it will print the link instead and ask the user to copy it.
2019-12-11feat: Add support for the ion shell (#704)BuggStream
2019-10-16feat: Implement PowerShell support (#470)David Knaack
2019-10-04refactor: Go from Rust workspaces to a package with nested packages (#480)Matan Kushner
2019-09-30refactor: Refactoring config (#383)Zhenhui Xie
This PR refactors config and puts configuration files for all modules in `configs/`.
2019-08-31Support vicmd_symbol in fish-shell (#254)Quinn Strahl
2019-08-22Use full path to starship in all phases of init (#224)Bruno Bigras
2019-08-20fix: Change panicking on unknown module to error print and support module ↵Saurav Sharma
listing flag (#197)
2019-08-19feat: Implement a two-phase init which allows us to write normal init ↵Kevin Song
scripts (#168) Implement a two-phase init procedure in starship. The first phase causes the shell to source a subshell, while the second phase (in the subshell) prints the main init script. This allows us to have nice init scripts with good styling, comments, and no pile of semicolons. Even better, it works as a drop-in replacement, so we don't need to update the docs.
2019-08-17feat: Display Vi mode as PROMPT (#169)Shu Kutsuzawa
Add Vi-mode indicator for zsh
2019-08-12feat: Implement the prompt module for jobs (#85)John Letey
2019-08-08feat: implement timer module (#118)Kevin Song
Implement a timer module that takes a commandline argument, the number of seconds the last job took to complete, and displays it if appropriate. Alters shell initialization files to compute this number using date +%s where needed. Adds a config section to configure minimum amount of time before timer is shown (default is 2s)
2019-07-03feat: Implement simplified prompt setup process (#90)Matan Kushner
• Add starship init which prints the shell function used to execute starship • Document the new setup process using starship init • Remove benchmarks for now (WIP replacement benchmarks in "benchmarking" branch )
2019-07-02feat: Add a `disabled` configuration option for modules (#86)Matan Kushner
• Add support for the disabled configuration option This will allow you to selectively disable modules that you don't want or need. 😄 • Overwrite starship configuration file path with STARSHIP_CONFIG environment variable • Write tests for the two configuration options that are available
2019-06-10Add support for prompt configuration (#62)Matan Kushner
- Create `Config` struct that is added to `Context` when initialized - Read `~/.confg/starship.toml` during initialization (can be updated later to also look at `$XDG_CONFIG_HOME`) - `Context` now has a method for creating modules. This allows us to provide modules with a reference to the configuration specific to that module
2019-06-06Refactor integration tests (#71)Matan Kushner
- Create subcommands to be able to print modules independently - `starship prompt` will print the full prompt - `starship module <MODULE_NAME>` will print a specific module e.g. `starship module python` - Added `--path` flag to print the prompt or modules without being in a specific directory - Added `--status` flag to provide the status of the last command, instead of requiring it as an argument - Refactored integration tests to be end-to-end tests, since there was no way in integration tests to set the environment variables for a specific command, which was required for the `username` module - Moved e2e tests to `tests/testsuite` to allow for a single binary to be built - Tests will build/run faster - No more false positives for unused functions - Added tests for `username` - Removed codecov + tarpaulin 😢
2019-05-22feat: Add battery module(#63)Matan Kushner
2019-05-13Implement the git status module (#45)Matan Kushner
2019-05-01Refactor segments into modules (#40)Matan Kushner
2019-04-19Use "context" to contain run details (#14)Matan Kushner
* Create "context" to contain run details * Use context in tests and benchmarks
2019-04-13Add fish_promptMatan Kushner
2019-04-12Add builder pattern for segmentMatan Kushner
2019-04-12Revert "Parallelize nodejs file checks"Matan Kushner
This reverts commit 99bdf27ecac655b54b03d7389b1b24970a1ec9ec.
2019-04-12Parallelize nodejs file checksMatan Kushner
2019-04-08Tidy up dir sectionMatan Kushner
2019-04-07Use git project root for truncationMatan Kushner
2019-04-04Rename segementsMatan Kushner
2019-04-04Add line_sep sectionMatan Kushner
2019-04-04Add basic benchmarksMatan Kushner
2019-04-04Move Segment struct to modulesMatan Kushner