Skip to content

refactor: Allow starship to be better used programmatically#509

Merged
matchai merged 1 commit intostarship:masterfrom
Southclaws:prompt-api
Oct 9, 2019
Merged

refactor: Allow starship to be better used programmatically#509
matchai merged 1 commit intostarship:masterfrom
Southclaws:prompt-api

Conversation

@Southclaws
Copy link
Copy Markdown
Contributor

Description

This makes it easier to embed Starship into other Rust programs such as shells written in Rust. It also decouples the arguments from the context for more programmatic initialisation of the context.

Motivation and Context

Partially this issue: nushell/nushell#356 and also just making it easier to use Starship as a Rust library for those building shells in Rust.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

Kind of N/A I suppose since the change is internal and tiny.

  • I have tested using MacOS
  • I have tested using Linux
  • I have tested using Windows

Checklist:

  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.

…stead of writing directly to stdout.

This makes it easier to embed Starship into other Rust programs such as shells written in Rust. It also decouples the arguments from the context for more programmatic initialisation of the context.
@sophiajt
Copy link
Copy Markdown

sophiajt commented Oct 8, 2019

Speaking from the nushell side, we're definitely interested in making these work together so that nushell users can use starship as their prompt.

Copy link
Copy Markdown
Member

@matchai matchai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! 👍
Feel free to drop us a line if we could do anything to simplify integration with nushell in the future. 😄

@matchai matchai changed the title refactor: structure the prompt as a function that returns a string instead of writing directly to stdout. refactor: Allow starship to be better used programmatically Oct 9, 2019
@matchai matchai merged commit 9f365f8 into starship:master Oct 9, 2019
@matchai
Copy link
Copy Markdown
Member

matchai commented Oct 9, 2019

@all-contributors Please add @Southclaws for code.

@allcontributors
Copy link
Copy Markdown
Contributor

@matchai

I've put up a pull request to add @Southclaws! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants