Commit Graph

34 Commits

Author SHA1 Message Date
Kevin Song c4ab66d7fe refactor: Move ANSI escaping into its own functions (#866) 2020-02-06 11:10:59 -05:00
Matan Kushner 66d5f34184 chore: give unused function a test annotation
Former-commit-id: 94acaa37c593f4952c349d663de71e3f1990926b
2020-02-05 23:03:26 -05:00
Matan Kushner 860accac55
chore: readd from_path function
Despite the function not being used directly, it was being used in tests.
Readding the function so tests will pass.
2020-02-03 17:13:59 -05:00
Matan Kushner f14aef4769
chore(bump): v0.34.1 2020-02-03 17:04:16 -05:00
Matan Kushner 0d1578bbe1
fix: move get_shell method into Context 2020-02-03 17:01:50 -05:00
Sam Rose 83337a1a03
perf: Optimize files, folder and extension lookups in Context (#880) 2020-02-03 16:57:48 -05:00
Luca Rinaldi 041c0427bb fix: escape "$" character to avoid bash interpreting (#884) 2020-01-28 13:55:16 -05:00
Matan Kushner 3365beae09 test(nodejs): Port nodejs module tests from E2E to integraton (#867)
Replaces the existing nodejs module end-to-end tests with integration tests that don't require preinstalled environmental dependencies.

- Moved the tests to the same file as the module they test
- Created a render_module utility function for rendering modules within tests
- Removed Node.js installation during CI setup
- Add Shell to Context to allow for tests to not run shell-specific code
2020-01-26 16:37:18 -06:00
Jon Grythe Stødle 8e5fa60fc8 feat: Add the `starship explain` command (#699)
This adds the explain argument to Starship, which explains what the printed modules in the prompt are.
2020-01-01 23:19:08 -05:00
Leonora Tindall 539f320a3f fix: Improve error message when current dir is not found (#773) 2019-12-21 23:26:57 -05:00
Zhenhui Xie fed1341e22 feat: Add an option to limit the duration of starship directory scanning (#589) 2019-10-28 22:41:16 +09:00
Zhenhui Xie aa260899d4 fix: Use logical path instead of physical path when available (#398)
* Get pathbuf from logical path. (fixes #204)

(also fixes #397)

* fix: Update directory module so that use_logical_path will work properly

* Remove test directory::use_logical_and_physical_paths

* Fix merge errors


Co-authored-by: Matan Kushner <hello@matchai.me>
2019-10-24 19:37:44 +09:00
Barnaby Keene 2c7e01cd62 refactor: improve as-a-library usage by removing ArgMatches depe… (#547)
This removes ArgMatches from the Context struct and replaces it with a simple HashMap. This work is towards getting Starship in a better place for use as a library in other shells written in Rust so they don't need to use a command-line interface to invoke and configure things.

Contributes to #521
2019-10-20 17:26:27 +09:00
Zhenhui Xie bc9e44f45c fix: Add disable configuration option to kubernetes module (#491) 2019-10-05 23:10:16 +09:00
Matan Kushner 05210b9510
refactor: Go from Rust workspaces to a package with nested packages (#480) 2019-10-04 22:30:46 +09:00
Zhenhui Xie dd0b1a1aa2 refactor: Refactoring config (#383)
This PR refactors config and puts configuration files for all modules in `configs/`.
2019-09-30 21:10:35 +09: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
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
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
Saghm Rossi dfe2ae643a fix a few typos (#178) 2019-08-17 20:50:42 -07:00
Matan Kushner f40f73dc8e fix: Address longstanding linter errors 2019-08-05 11:05:08 -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 feb6d8aec7 refactor: Better document context contents 2019-07-19 18:45:38 -04:00
Matan Kushner 0703a74048
ci: Add GitHub releases to CI (#95) 2019-07-14 17:54:45 -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
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
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
Matan Kushner 8b5055d510
Parallelize prompt modules (#46) 2019-05-09 23:51:50 -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
Matan Kushner bb2bcd604b
Share dir_files between segments through Context (#16) 2019-04-23 14:51:08 -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