-
Notifications
You must be signed in to change notification settings - Fork 104
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
Allow overriding preferences in CLI arguments. #251
base: main
Are you sure you want to change the base?
Commits on Sep 28, 2021
-
replace load_default_document with a static value
There's no reason we'd want multiple copies of the default settings, so the defaults can be easily extracted into a static variable to clean everything up a bit.
Configuration menu - View commit details
-
Copy full SHA for fc42df5 - Browse repository at this point
Copy the full SHA fc42df5View commit details
Commits on Sep 29, 2021
-
don't wrap the preferences tree in an Option
Instead, this patch uses Yaml::Null to indicate an empty options set. Doing things this way cuts down on around 50 lines of code by keeping most of the searching logic in `yaml-rust`'s domain.
Configuration menu - View commit details
-
Copy full SHA for a557a6b - Browse repository at this point
Copy the full SHA a557a6bView commit details -
extract precedence logic to private
value
functionThe `value` function computes the value associated with a given key for a given filename and extension. This was function was liberally to reduce the repeated logic in the code, and *slightly modifies behavior*, though in a backwards-compatible way. Some settings were only customizeable when declared at a global level in the config file, which may now be specified at the extension/filename level. This does not (yet) apply to some of the more complicated settings like `line_length_guide`: see the diff for mor details.
Configuration menu - View commit details
-
Copy full SHA for 2095083 - Browse repository at this point
Copy the full SHA 2095083View commit details -
Configuration menu - View commit details
-
Copy full SHA for 11e2c92 - Browse repository at this point
Copy the full SHA 11e2c92View commit details -
move the in-memory theme value into the Yaml structure
Rather than keeping the theme in a one-off structure entry, index it with the rest of the preferences values in a Yaml tree. This relies on a fork of `yaml-rust` which provides mutable acccess.
Configuration menu - View commit details
-
Copy full SHA for ee52f8e - Browse repository at this point
Copy the full SHA ee52f8eView commit details
Commits on Sep 30, 2021
-
Configuration menu - View commit details
-
Copy full SHA for ac5d2f2 - Browse repository at this point
Copy the full SHA ac5d2f2View commit details -
Configuration menu - View commit details
-
Copy full SHA for a4926ee - Browse repository at this point
Copy the full SHA a4926eeView commit details
Commits on Oct 2, 2021
-
Utilise `borrowed_or` in my yaml-rust fork to shorten the logic.
Configuration menu - View commit details
-
Copy full SHA for 4318601 - Browse repository at this point
Copy the full SHA 4318601View commit details -
Applies to getters: + line_comment_prefix + syntax_definition_name
Configuration menu - View commit details
-
Copy full SHA for ec0004e - Browse repository at this point
Copy the full SHA ec0004eView commit details
Commits on Oct 23, 2021
-
find line length guide with buffer's path
This allows for the configuration to specify a line length guide depending on the file type, for instance, 80 characters everywhere, but 72 in .git/COMMIT_EDITMSG. Note that this changes the Preferences public API, so there are a fair few modifications, including to unit tests.
Configuration menu - View commit details
-
Copy full SHA for 05b84d8 - Browse repository at this point
Copy the full SHA 05b84d8View commit details
Commits on Jan 18, 2022
-
add --help message with more complex argument parsing
This implements a simple argument parser that isolates 'direct' arguments (paths, etc) from `--key value` options, and treats the argument --help specially to display a usage message. For instance, the invocation `amp --key value src` would launch amp in the directory src with the option key set to value. Options are not currently used. This commit makes it impossible to pass a file beginning with `--` as a CLI argument: it will be assumed to be an option.
Configuration menu - View commit details
-
Copy full SHA for bdd9667 - Browse repository at this point
Copy the full SHA bdd9667View commit details -
allow overriding preferences in CLI arguments
This allows specifying, for instance, `amp <file> --line_length_guide 72` to override any value given in settings. This is done through a change in Application's constructor, allowing the provision of overrides. Because of this change, roughly 80-ish tests had to be modified to pass in empty overrides (thus the long diff).
Configuration menu - View commit details
-
Copy full SHA for 73c4909 - Browse repository at this point
Copy the full SHA 73c4909View commit details -
Merge remote-tracking branch 'upstream/main' into cli-conf
Cargo.lock had some merge conflicts. This manual merge used cargo to regenerate Cargo.lock (`rm Cargo.lock && cargo build`).
Configuration menu - View commit details
-
Copy full SHA for d86e303 - Browse repository at this point
Copy the full SHA d86e303View commit details