Commit Graph

69 Commits

Author SHA1 Message Date
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