Skip to content
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

Add --config-override feature #1169

Merged
merged 131 commits into from
Mar 3, 2021
Merged

Add --config-override feature #1169

merged 131 commits into from
Mar 3, 2021

Conversation

sriniv27
Copy link
Contributor

@sriniv27 sriniv27 commented Jan 29, 2021

  • What is this new code intended to do?
    • This submission is intended to provide a mechanism to override the stored configuration for the lifetime of the current invocation of jrnl by way of a delimited list of key-value pairs. The keys can be provided in dot-notation form e.g. colors.body
  • Are there any related issues?
    Override (select) configuration values during invocation  #1157
  • What is the motivation for this change?
    I would like to run jrnl with different configurations for some specific workflows but still maintain my current configuration for "normal" writing workflows.
    For example:
    • My default writing configuration is set so that I use code -w as my editor. For rapid logging, I want to be able open a terminal and be dropped into the stdin prompt, record my thought, and Ctrl+D out.
    • In tmux have a separate, narrow, vertical pane that has the contents of my day's log, for which I might want a smaller linewrap value than the default
    • See discussion in Override (select) configuration values during invocation  #1157 for other examples/ideas
  • What is an example of usage, or changes to config files? (if applicable)
    See motivating comment
    jrnl -on today --config-override editor '' --config-override journals.log "~/logfile.txt"
    jrnl -on today --config-override linewrap 30 --config-override highlight false --config-override display_format fancy

Checklist

  • I have read the contributing doc.
  • I have included a link to the relevant issue number.
  • I have tested this code locally.
  • I have checked to ensure there aren't other open pull requests
    for the same issue.
  • I have written new tests for these changes, as needed.
  • All tests pass.

@wren
Copy link
Member

wren commented Feb 20, 2021

@sriniv27 Hi! I see that you requested review, but there are still commits happening, and activity in the related issue. Is this ready for review?

It's fine either way, I just didn't want to comment on things if you're still working on them.

@sriniv27
Copy link
Contributor Author

I've only been making commits here to directly address review comments and smaller housekeeping things. I'd call this ready for review.

@micahellison micahellison mentioned this pull request Feb 27, 2021
6 tasks
Copy link
Member

@micahellison micahellison left a comment

Choose a reason for hiding this comment

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

Looks really close to finished! Thanks again for your work on this.

When we run jrnl with -1 --config-override colors.body blue
Then the runtime config should have colors.body set to blue

@skip_win
Copy link
Member

Choose a reason for hiding this comment

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

I created #1200 to troubleshoot, but it looks like all these passed in the CI this time. Could you try removing them and confirming?

tests/test_override.py Outdated Show resolved Hide resolved
tests/test_override.py Outdated Show resolved Hide resolved
tests/test_override.py Outdated Show resolved Hide resolved
Copy link
Member

@wren wren left a comment

Choose a reason for hiding this comment

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

This is looking really close to ready!

Please add me to "reqeust review" when it's ready again. Thanks again for all the hard work.

features/overrides.feature Show resolved Hide resolved
features/overrides.feature Outdated Show resolved Hide resolved
jrnl/args.py Outdated Show resolved Hide resolved
jrnl/args.py Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
tests/test_override.py Outdated Show resolved Hide resolved
tests/test_override.py Outdated Show resolved Hide resolved
tests/test_override.py Show resolved Hide resolved
yield -> return

remove needless copy

adjust spacing

re-inline args return

reset packaging info to e6c0a16

revert package version for this PR
store cli overrides without unpacking just yet

move deserialize_config_args to config module

delete custom Action class for config operations

apply [k,v] -> {k, v} for each override

update test data

update import
Copy link
Contributor Author

@sriniv27 sriniv27 left a comment

Choose a reason for hiding this comment

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

I think that's all the comments addressed

@sriniv27 sriniv27 requested a review from wren March 1, 2021 13:58
@wren
Copy link
Member

wren commented Mar 2, 2021

Awesome! I'll take a look again tonight.

Copy link
Member

@micahellison micahellison left a comment

Choose a reason for hiding this comment

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

💯

Copy link
Member

@wren wren left a comment

Choose a reason for hiding this comment

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

Looks great! Thank you! 🚀

@wren wren merged commit 4f79803 into jrnl-org:develop Mar 3, 2021
@wren wren added the enhancement New feature or request label Mar 3, 2021
@wren wren changed the title Allow runtime configuration overrides from the commandline Add --config-override feature Mar 3, 2021
@micahellison micahellison linked an issue Mar 13, 2021 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Override (select) configuration values during invocation
3 participants