New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add pijul_channel module #4765
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4488f27
feat: Pijul VCS support
IslandUsurper 8930b65
Extra bits needed for new module.
IslandUsurper 29d61b0
Format Markdown table.
IslandUsurper 7956a43
Fix lint.
IslandUsurper c7737c9
Don't test Pijul module so thoroughly.
IslandUsurper 2e69fd6
Format!
IslandUsurper f0da988
Bad rebase, remove Pijul install from workflow.
IslandUsurper 9984a95
Mock Pijul commands for code coverage.
IslandUsurper eb04584
Make fake .pijul directory in fixture.
IslandUsurper bc95182
Truly mock `pijul` command.
IslandUsurper 0dc1b26
Rename module from `pijul` to `pijul_channel`.
IslandUsurper 9f9b7ac
Format!
IslandUsurper e28bfe8
Fix config-schema.json.
IslandUsurper e833a6a
Missed changing module name in docs/ folder.
IslandUsurper File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,6 +108,9 @@ Windows = " " | |
[package] | ||
symbol = " " | ||
|
||
[pijul_channel] | ||
symbol = "🪺 " | ||
|
||
[python] | ||
symbol = " " | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Clone, Deserialize, Serialize)] | ||
#[cfg_attr( | ||
feature = "config-schema", | ||
derive(schemars::JsonSchema), | ||
schemars(deny_unknown_fields) | ||
)] | ||
#[serde(default)] | ||
pub struct PijulConfig<'a> { | ||
pub symbol: &'a str, | ||
pub style: &'a str, | ||
pub format: &'a str, | ||
pub truncation_length: i64, | ||
pub truncation_symbol: &'a str, | ||
pub disabled: bool, | ||
} | ||
|
||
impl<'a> Default for PijulConfig<'a> { | ||
fn default() -> Self { | ||
PijulConfig { | ||
symbol: " ", | ||
style: "bold purple", | ||
format: "on [$symbol$channel]($style) ", | ||
truncation_length: std::i64::MAX, | ||
truncation_symbol: "…", | ||
disabled: true, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be more compatible with 32-bit systems:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both
git_branch
andhg_branch
takei64
fortruncation_length
. While I agree that this is an easy change for 32-bit compatibility, I think consistency is more important. All of the modules that use truncation need to be usingusize
instead ofi64
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either way, I feel like an unsigned integer type should be preferred and meson also uses
u32
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but let's do a follow-up change to handle all of the affected modules, instead of just polishing this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've avoided doing this, because it could be a breaking change. If for instance they are switched to
u32
the former default would be outside the accepted value range, and negative values would lead to errors instead of warnings.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the risk of causing XKCD 1172, I doubt anything would actually break. Defaults shouldn't be stored in any TOML files, and anyone who actually sets
truncation_length
for any module is most likely to set it less than 200. As for handling negative values, I wonder if there's a way to adjust the deserializer to emit warnings with defaults instead of hard errors. Possibly we could make the default0
instead ofINT_MAX
, as at these sizes, there's no practical difference.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think some people will have based their config-file on
starship print-config --default
, it was even recommended in the docs for a few weeks.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof. That does make a mess of things then.