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.
What this does
This enables settings to be loaded from
~/.config/powerline-go/config.json
in addition to the usual arguments.How it works
This refactors everything configuration related into a
Config
struct. This struct is initialized with default values, loaded fromconfig.json
, then anyargs
provided override their config counterparts. This should provide a seamless transition, as existing usage is preserved.Each setting uses the equivalent arg name, with the exception of error and duration (which can only be set via args, as setting them in config would make no sense).
There are a few special settings:
modes
,themes
, andshells
do not completely override the defaults, only add values to their respective maps.modes
andthemes
work exactly like loading them from an external file (i.e. they are preloaded with defaults so you don't have to specify the whole thing).path-aliases
specified via args are added to ones specified via config.Example
Here is my
config.json
: (ignore the unicode shenanigans)Prompt:
PS1="$(powerline-go -error $?)"
Other thoughts
ignore-repos
with config ones (likepath-aliases
). This can easily be done if you'd like.Let me know if you have any questions.