Commit Graph

333 Commits

Author SHA1 Message Date
Kutsuzawa Ryo 7a98ec1d8e feat: Add configuration for the `git_status` prefix and suffix (#367) 2019-09-15 16:44:53 -04:00
Thomas O'Donnell 653def05f0 Enable the python module for tox files (#369)
Enable the python module if the current directory contains a `tox.ini`
file.
2019-09-15 12:21:40 -04:00
Nick Young 7e891f17c1 perf: Lazy load files from directory (#335)
Changes context to use `once_cell` to lazily evaluate directory listing on first use.
2019-09-14 09:23:53 -05:00
Matan Kushner 3e23a9a73c chore: Rename integration_test to acceptance_test (#356) 2019-09-12 18:01:13 -05:00
Rob Warner 373493be85 feat: Add support for italic styles (#354) (#358) 2019-09-12 16:10:42 -05:00
谢祯晖 a6c64e8457 feat: Implement threshold based styling for battery module (#318) 2019-09-12 14:06:59 -04:00
谢祯晖 37b5168bfe fix: Fixups for #138 (#343)
- Fix unused imports in unit tests
- Add accidently remove module "battery"
2019-09-11 08:43:40 -04:00
Kevin Song 54793c7d5a refactor: Separate shell initialization into files (#338)
Shell inits are now in a separate directory in the source code, with each shell getting its own script. Also adds a little DRY + commenting in init/mod.rs.
2019-09-10 20:31:08 -04:00
Daniel Illi-Zuberbühler ee20d6b2ac fix: Prepend to PROMPT_COMMAND in Bash init (#336)
Bash init: do not overwrite PROMPT_COMMAND but prepend to it.
2019-09-10 15:12:29 -04:00
John Letey f9a4514045 feat: Implement the prompt module for time (#138)
Add a module which displays the current time in a format requested by
the user. Disabled by default.
2019-09-10 12:54:40 -05:00
Neil Kistner 9f70ffb7a7 fix: Lazy load git repo and only run module if not disabled (#306)
A couple of optimizations are done in this PR. One, we now will check config ahead of time to see if a module is disabled before running any module code. Also, we won't try to discover a git repository unless the module requests access to it.
2019-09-09 19:14:38 -04:00
Kevin Song 9721666d33
feat: Add the ability to configure per-module color styles (#285)
Add parsing logic, config support, docs, and integration with other modules 
for custom styling of each module.
2019-09-07 19:33:06 -05:00
Gabriel de Perthuis 69ebab46a4 fix: Don't trigger an extension match on hidden files (#299)
Addresses #52, closes #280.
2019-09-07 11:05:25 -04:00
Nick Young eb724279da feat: Adds Git State module for showing "REBASING 2/3", etc. (#276)
- Adds the git_state module.
- Adds git_state to the default prompt order
- Updates the documentation to describe the git_state module
2019-09-05 12:45:04 -04:00
Thomas O'Donnell 4f17bae315 fix: Add missing module to list of modules (#294)
Have added the missing hostname module to the list of all modules.
2019-09-05 11:33:24 -04:00
Neil Kistner 1c66869117 feat: Add config for ahead/behind count of tracked branch (#281)
Add a configuration option (show_sync_count) to the git_status module that will show/hide the counts ahead/behind of the tracked branch. Currently have this default to false, and would opt-in to show this information.
2019-09-05 00:09:51 -04:00
Matan Kushner e66d7bae1c
ci: Migrate CI from Azure Pipelines to GitHub Actions (#233)
Migrated CI from Azure Pipelines to GitHub Actions.
Until the release process is figured out in Actions, we'll stick to using Azure pipelines for releases.
2019-09-04 19:13:53 -04:00
Andrew Houts 84688e4981 feat: add hostname module (#286)
Add a hostname module as requested by @chipbuster.
Displays the system hostname as provided by gethostname.
2019-09-04 13:03:31 -04:00
Nick Young 5a0f269d85 fix: Be more restrictive with bash init fallback (#278)
This should improve compatibility with "Git Bash" with Git for Windows by
using psub+source init for all bash shells v4.1 and newer.
2019-09-04 09:23:31 -05:00
Kevin Song 6db0e20585 Change ZSH init to use jobstates for num jobs (#252) 2019-09-03 23:44:44 -04:00
Francisco Lopes 722a0652fd feat: Respect status.showUntrackedFiles 2019-09-02 20:27:04 -04:00
Titouan Vervack 59e8b1fc92 feat: added truncation_length/symbol to git_branch (#268)
Git branches can become very long (e.g. gitlab auto-generated branch
names), thus it would be nice to be able to truncate them to keep your
prompt lenght in line.

This patch adds two new options to the git_branch module:
* truncation_length: The amount of graphemes to of a gitbranch to
truncate to
* truncation_symbol: The symbol that should be used to indicate that a
branch name was trunctated

To be able to correctly work with UTF-8 graphemes, unicode-segmentation
was added as a dependency.
2019-09-02 15:56:59 -04:00
Quinn Strahl 3dd035056d Support vicmd_symbol in fish-shell (#254) 2019-08-31 00:59:18 -07:00
Nick Young 4eb7beca48 fix: Adds `nix_shell` to `module::ALL_MODULES` (#264)
So that it can be configured in the user's prompt
2019-08-30 09:39:21 -04:00
Harry Mills c2a1803681 Fix typo in comment (#260) 2019-08-29 12:40:25 -04:00
Neil Kistner 9853743eda feat: Add commit count for ahead/behind symbols (#247)
Add logic for the git status module to display the number of commits the index is ahead or behind next to the symbol.
2019-08-27 20:11:42 -07:00
Bruno Bigras fa2d1c05a6 fix: use procsub in bash since termux has no stdin (#241) 2019-08-27 00:02:52 -07:00
Neil Kistner e034253a5e feat: Add ability to use an alternate directory truncation style (#239)
* Add ability to use an alternate directory truncation style
2019-08-26 21:52:45 -04:00
Ivan Tham cdea401589 refactor: just match enum (#236)
Remove forced unwrap since match is already exhausted
2019-08-26 14:47:34 -04:00
Bruno Bigras 0fa862a2e9 make the battery module optional for now (#234)
The 'battery' crate doesn't support Termux, so we are temporarily making the battery module optional.
2019-08-26 14:09:39 -04:00
TsubasaKawajiri 08aef016cd fix: battery percentage character on Zsh. #226 (#237)
on Zsh, battery percentage character would print %
this PR fixes print %{ -> %
2019-08-25 21:52:44 -04:00
Bruno Bigras feb737190e Add nix-shell support (#173) 2019-08-25 11:41:20 -04:00
Matan Kushner 57e807fec6
style: Fix clippy warnings 2019-08-23 13:13:04 -04:00
Bruno Bigras 68cbcb91b7 Use full path to starship in all phases of init (#224) 2019-08-22 12:57:32 -07:00
Thomas O'Donnell 1478f8c2e9 Add support for detecting Python from Pipenv files (#221)
Added the ability to enable the Python module based on the existence of the a `Pipfile`.
2019-08-21 15:54:22 -07:00
Kevin Song 360ea988e5
Add ruby to default module ordering (#217) 2019-08-21 12:41:01 -07:00
Kevin Song f06247d5d3 fix: Correct ZSH init on older ZSH versions (#213) 2019-08-20 23:49:07 -04:00
Saurav Sharma 075a76897c fix: Change panicking on unknown module to error print and support module listing flag (#197) 2019-08-20 00:42:25 -04:00
Kevin Song 0e82c19f37
feat: Implement a two-phase init which allows us to write normal init 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-19 18:44:53 -07:00
Saurav Sharma f54322f2ab feat: Add configuration for reordering the prompt module and disabling default order (#171)
Adds functionality for reordering the prompt module through the use of the prompt_order configuration option in starship.toml
2019-08-18 21:35:11 -07:00
Saurav Sharma 664df257bf fix: Solve bash & zsh cursor location confusion issue (#183)
Solves the issue of cursor location confusion on bash and zsh (#110) . Solution: modify ANSIString and wrap non-printing characters with correct escape sequences.
2019-08-18 20:33:12 -07:00
Kevin Song 85ac0a6801 fix: Set default prompt character to ❯ (#177) 2019-08-18 11:34:45 -04:00
Kevin Song 572a07c72d fix: Correct broken zsh init in absence of precmd_functions (#180) 2019-08-18 07:07:38 -04:00
Saghm Rossi dfe2ae643a fix a few typos (#178) 2019-08-17 20:50:42 -07:00
Kevin Song 8782e300fc
feat: Allow bash users to specify a precmd function (#166)
Allows bash users to run a function before the shell is drawn, by defining a function and setting its name equal to starship_precmd_user_func.
2019-08-17 16:53:59 -07:00
Shu Kutsuzawa d90c43b8b1 feat: Display Vi mode as PROMPT (#169)
Add Vi-mode indicator for zsh
2019-08-17 12:33:19 -07:00
Saghm Rossi 84c394e7b0 feat: Add option to control git directory truncation (#165) 2019-08-16 20:29:22 -07:00
Saghm Rossi 5ad07bf2d9 docs: Fix typo in directory module description (#163) 2019-08-16 14:16:29 -04:00
Kevin Lane e262187f4c feat: Display Python package version from poetry (#153) 2019-08-15 16:41:06 -04:00
Kevin Song 22c8c3459f feat: implement `cmd_duration` for bash (#144) 2019-08-13 22:49:47 -04:00
André Zanellato b06249d61c feat: implement the ruby module (#131) 2019-08-13 18:43:29 -04:00
Matan Kushner d296432908
fix: Fix exception caused by the golang module
Fixes #148
2019-08-13 15:06:10 -04:00
Matan Kushner 7424e9674c
fix: Fix issues with nodejs and golang configuration (#146)
* fix: Give all modules a single name
* test: Add missing config tests for nodejs and golang
* test: Rename dir to directory
2019-08-13 12:30:59 -04:00
Kevin Song a87c0750cc fix: Fix issue with jobs and extra whitespace on MacOS with BSD… (#145)
MacOS wc has a habit of leaving nasty spaces in the output, which was
messing up our argparser.

To fix, quote the output from the jobs command, then have Rust trim out
whitespace in the jobs module before parsing.
2019-08-12 23:41:59 -04:00
MaT1g3R 160a79fa06 feat: Implement configuration to display pyenv version name (#140)
This behavior can be enabled via setting `use_pyenv` to true.
The "pyenv" prefix before the version name can be configured using `pyenv_prefix`.
2019-08-12 21:12:55 -04:00
John Letey 82cf484ced feat: Implement the prompt module for jobs (#85) 2019-08-12 13:42:33 -04:00
Matan Kushner 4c2e9c3304 fix: Move the battery to the newline before character (#139) 2019-08-11 21:46:12 -07:00
MaT1g3R 3669e389b6 feat: Implement Python virtual environment display (#137) 2019-08-11 17:51:13 -04:00
Kevin Song 39598ec691 feat: Add configuration to change the character for non-zero sta… (#133)
Prompt can now switch characters in addition to switching character color. Add configuration options in so that users can do either, both, or neither.
2019-08-10 17:30:30 -04:00
Kevin Song 994a865d4d fix: Add test attribute to cmd_duration tests (#134) 2019-08-10 15:47:34 -04:00
Kevin Song 3daf3ddf26 feat: implement timer module (#118)
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-08-08 13:25:30 -04:00
Matan Kushner f40f73dc8e fix: Address longstanding linter errors 2019-08-05 11:05:08 -04:00
Matan Kushner 616b50b4e3 ci: Publish crate to Crates.io with CI 2019-08-05 11:05:08 -04:00
Andrew Dassonville 5dbf4381ac feat: Allow directory truncation length to be configured (#120)
This allows the directory truncation length to be configured. Previously, it was hard-coded to truncate to 3 parent directories.
2019-07-28 21:05:13 -04:00
Andrew Dassonville 75e74e0d74 feat: Use Unix-style slash on Windows (#119)
Prior to this change, starship would use inconsistent slashes when displaying the working directory. With this change, starship uses Unix-style slashes on all platforms. This is consistent with the Git Bash and Cygwin prompts on Windows.
2019-07-28 20:15:40 -04:00
Matan Kushner 0bc28c521d
feat: Add configuration for add_newline (#116)
- Replace TableExt with a Config trait that extends toml::value::Table
Add configuration for add_newline
- add_newline is a root-level configuration value. When set to false, the initial newline before the prompt is removed.
2019-07-27 18:25:13 -04:00
Matan Kushner 0fe00ecd82
fix: prompt now updates on bash and zsh (#109)
Making use of PROMPT_COMMAND in bash and precmd in zsh, the prompt is no longer being expanded and rendered when the variable is initially set.
2019-07-23 11:49:14 -04:00
Kevin Song aceda0052f fix: handle path to shell in starship init (#106)
Add support for paths to init function

This adds support for qualified paths (e.g. using
`/usr/local/bin/zsh` instead of `zsh`) to init.rs.

The function now converts the shell name into an
OsStr, then to a Path, then gets the file stem,
and unwraps back into a str. While this process can
fail (yielding a None), it's highly unlikely to unless
the user has messed with their shells or there's an
issue in Starship--therefore, the failure message in
this case simply asks the user to file a bug report.
2019-07-20 13:45:41 -04:00
Matan Kushner f7eedaf775 refactor: Improve logging where lacking 2019-07-19 18:45:38 -04:00
Matan Kushner feb6d8aec7 refactor: Better document context contents 2019-07-19 18:45:38 -04:00
Tiffany Le-Nguyen 08cf33522a docs: Add vuepress with initial docs (#99)
Co-authored-by: Tiffany Le-Nguyen <tlenguyen@expedia.com>
Co-authored-by: Matan Kushner <hello@matchai.me>
2019-07-19 16:18:52 -04:00
Matan Kushner 0703a74048
ci: Add GitHub releases to CI (#95) 2019-07-14 17:54:45 -04:00
Matan Kushner 77ba97df19
chore: Refactor getting string values from config (#94) 2019-07-14 11:15:47 -04:00
Matan Kushner d7754f38e7
feat: Implement simplified prompt setup process (#90)
• 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-03 08:03:02 -04:00
Matan Kushner 463ec26024
feat: Add a `disabled` configuration option for modules (#86)
• 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-07-02 16:12:53 -04:00
Matan Kushner 097f1b05f1
Add support for prompt configuration (#62)
- 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-10 15:56:17 +01:00
Matan Kushner 8239fbd12b
Refactor integration tests (#71)
- 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-06-06 13:18:00 +01:00
John Letey 4cd98d862d fix: Check both stderr and stdout for Python version (#66)
* fix python version not showing for version < 3.4

* make review changes
2019-05-27 02:28:14 -04:00
Matan Kushner 5b989fcb9c
feat: Add battery module(#63) 2019-05-22 12:29:39 -04:00
Tim Mulqueen 4d034351e8 fix: Don't check extensions of directories (#64)
* now checks for type of path when doing scan
* added unit test to cover failure case
2019-05-22 12:04:51 -04:00
Youssef Habri 08b238114e feat: Implement the prompt module for username (#56) 2019-05-19 22:26:12 -04:00
Matan Kushner 876e7d36b1
fix: handle package version panic (#57) 2019-05-16 10:06:34 -06:00
Matan Kushner 2cf69a82b7
ci: Fix CI to work with changes to Azure Pipelines build agent (#55) 2019-05-16 09:40:30 -06:00
Matan Kushner 90d6e6cf0b
Implement the git status module (#45) 2019-05-13 22:43:11 -06:00
Tim Mulqueen 5fd715e7c3 Implement directory scanner (#34) 2019-05-12 13:37:23 -04:00
John Letey d3ce00c516 Add Go version module (#44) 2019-05-11 23:58:45 -04:00
Matan Kushner 8b5055d510
Parallelize prompt modules (#46) 2019-05-09 23:51:50 -04:00
Matan Kushner c6ee5c6ac1
Refactor segments into modules (#40) 2019-05-01 16:34:24 -04:00
John Letey 0b9334f438 Add the package version segment (#35) 2019-05-01 10:45:56 -04:00
Matan Kushner 9a352c0acc
Add the Git branch segment (#32)
Added
- Repository to Context for reuse in directory and git_branch
- git_branch to prompt

Changed
- Made segments bold to match spaceship
2019-04-26 22:07:07 -04:00
John Letey ca12d22ace Add Python version segment (#23) 2019-04-25 11:06:18 -04:00
Matan Kushner bb2bcd604b
Share dir_files between segments through Context (#16) 2019-04-23 14:51:08 -04:00
Tim Mulqueen 643256e877 feat: Add Rust version segment (#15) 2019-04-21 19:37:34 -04:00
Matan Kushner 022e0002e4
Use "context" to contain run details (#14)
* Create "context" to contain run details

* Use context in tests and benchmarks
2019-04-19 16:57:14 -04:00
Matan Kushner 794ae7b2ad
Add integration tests (#6)
### Changed
- Added current_dir param to segments to make them more testable
- Moved all existing integration tests to a `tests/` dir

### Added
- A whole bunch of new integration tests
2019-04-15 20:54:52 -04:00
Matan Kushner ab5490bea6
Add README.md badges (#5) 2019-04-15 14:38:45 -04:00
Matan Kushner d2cda32c87
Better test and document the dir segment 2019-04-15 12:04:53 -04:00
Matan Kushner bca4a7079f
Fix bug in path truncation
Paths with 3 components would truncate to 2 despite the truncation length begin set to 3.
2019-04-15 11:40:40 -04:00
Matan Kushner 4ce4899f81
Add fish_prompt 2019-04-13 00:34:56 -04:00
Matan Kushner 240fb6a02c
Add some documentation for segment 2019-04-12 23:11:00 -04:00
Matan Kushner 9d4492c313
Make segments optionals 2019-04-12 23:06:48 -04:00
Matan Kushner d62bb107f2
Remove unnecessary lifetimes 2019-04-12 19:18:47 -04:00
Matan Kushner a0e4172602
Use copy to return segment 2019-04-12 19:11:40 -04:00
Matan Kushner fec5c4db4e
Use builder pattern in char section 2019-04-12 18:12:29 -04:00
Matan Kushner d82ebc4457
Add builder pattern for segment 2019-04-12 17:49:20 -04:00
Matan Kushner 7356faaec2
Cleanup around newline 2019-04-12 13:17:20 -04:00
Matan Kushner ab9ba27231
Revert "Parallelize nodejs file checks"
This reverts commit 99bdf27eca.
2019-04-12 13:10:31 -04:00
Matan Kushner 99bdf27eca
Parallelize nodejs file checks 2019-04-12 13:07:41 -04:00
Matan Kushner 7ffadd37bc
Remove duplicate tests 2019-04-11 20:04:04 -04:00
Matan Kushner c1f5a733c9
More progress in Node section 2019-04-11 19:31:30 -04:00
Matan Kushner d5493d236d
Begin writing Node section 2019-04-10 09:22:11 -04:00
Matan Kushner 67ab2121c5
Add note and test regarding paths being physical 2019-04-09 00:04:50 -04:00
Matan Kushner 969840a157
Tidy up dir section 2019-04-08 23:35:14 -04:00
Matan Kushner d58ea0659b
Add a new line before the prompt 2019-04-08 17:35:38 -04:00
Matan Kushner 0e0bed0837
Use truncate_path to simplify dir 2019-04-08 15:33:06 -04:00
Matan Kushner 5086ba2f50
A bit of tidying up 2019-04-07 23:28:38 -04:00
Matan Kushner 168a6fd7b1
Add proper git project root truncation 2019-04-07 23:23:37 -04:00
Matan Kushner 3c07e284fe
Add some clarifying documentation 2019-04-07 17:17:40 -04:00
Matan Kushner fdacd1cf28
Readd home dir truncation 2019-04-07 17:12:22 -04:00
Matan Kushner ff94c9f25f
Use git project root for truncation 2019-04-07 16:43:11 -04:00
Matan Kushner c79cbe63b1
Add stringify_segment rustdoc 2019-04-04 21:35:24 -04:00
Matan Kushner 472b66894d
Rename segements 2019-04-04 20:35:35 -04:00
Matan Kushner 168d568d54
Add line_sep section 2019-04-04 20:33:36 -04:00
Matan Kushner 52a529c627
Add basic benchmarks 2019-04-04 16:59:03 -04:00
Matan Kushner 7136059dcd
Add tests to dir home truncation 2019-04-04 14:32:22 -04:00
Matan Kushner 7683f33bc8
Add dir section with home truncation 2019-04-04 14:18:15 -04:00
Matan Kushner a81eabd690
Move Segment struct to modules 2019-04-04 12:18:05 -04:00
Matan Kushner e519c3f4a6
Set status with arg rather than env 2019-04-03 22:58:13 -04:00
Matan Kushner e2ba7a1354
Add segment structure and logic 2019-04-03 20:14:26 -04:00
Matan Kushner 41ee54933b
Start working on char color for status 2019-04-02 00:45:49 -04:00
Matan Kushner 4e1ae06622
Run rustfmt 2019-04-01 23:30:53 -04:00
Matan Kushner 106bcb73bc
Add authors to help message 2019-04-01 23:28:29 -04:00
Matan Kushner ca3f439012
Initial commit 2019-04-01 23:23:03 -04:00