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 mycroft-config tool to manage config files #2290

Merged
merged 3 commits into from Sep 10, 2019

Conversation

@penrods
Copy link
Member

commented Sep 6, 2019

The new mycroft-config utility simplifies management of the the
various configuration files that control Mycroft. Commands include:
edit, show, get, set, reload.

  • mycroft-config edit (default|remote|system|user)
    Open the requested file in an editor (nano by default), performing
    JSON validation warnings to minimize accidental edit errors.

  • mycroft-config show (default|remote|system|user)
    Dump the selected file with nice highlighting using jq

  • mycroft-config get <var>
    Load the mycroft.conf stack, outputting the effective value(s). The
    is specified using jq-style specifiers. For example:
    mycroft-config get enclosure.platform
    mycroft-config get location
    mycroft-config get

  • mycroft-config set <var> <value>
    Set the given variable in the "user" configuration file. Examples:
    mycroft-config set lang "es-es"
    mycroft-config set tts.mimic.voice "ap"

  • mycroft-config reload
    Sends a signal on the messagebus to tell services to reload configs.
    This automatically occurs after a 'set' or 'edit' command.

@penrods penrods referenced this pull request Sep 6, 2019
@JarbasAl

This comment has been minimized.

Copy link
Contributor

commented Sep 6, 2019

this should reduce support requests by 70%!

most of the time "mycroft is broken" it's a bad comma messing json, probably in core config file....

Copy link
Member

left a comment

I think the switch to underscores in functions should be made to ensure it's portable between bash implementations / variants.

bin/mycroft-config Show resolved Hide resolved
bin/mycroft-config Outdated Show resolved Hide resolved
penrods and others added 3 commits Sep 6, 2019
The new mycroft-config utility simplifies management of the the
various configuration files that control Mycroft.  Commands include:
edit, show, get, set, reload.

* mycroft-config edit (default|remote|system|user)
Open the requested file in an editor (nano by default), performing
JSON validation warnings to minimize accidental edit errors.

* mycroft-config show (default|remote|system|user)
Dump the selected file with nice highlighting using jq

* mycroft-config get <var>
Load the mycroft.conf stack, outputting the effective value(s).  The
<var> is specified using jq-style specifiers.  For example:
   mycroft-config get enclosure.platform
   mycroft-config get location
   mycroft-config get

* mycroft-config set <var> <value>
Set the given variable in the "user" configuration file.  Examples:
   mycroft-config set lang "es-es"
   mycroft-config set tts.mimic.voice "ap"

* mycroft-config reload
Sends a signal on the messagebus to tell services to reload configs.
This automatically occurs after a 'set' or 'edit' command.
Many versions of Linux (most Debian-based versions) support a mechanimsm
based on a link called "sensible-editor", which is configured to invoke
the user's preferred editing tool.

To get colorization help, the temp file is now named with a ".json"
extension.  Most editors can colorize appropriately based on that.
@forslund forslund force-pushed the feature/config-tool branch from 909a4dc to fea3133 Sep 10, 2019
@forslund

This comment has been minimized.

Copy link
Member

commented Sep 10, 2019

Rebased and added a warning for when opening in view mode instead of the expected edit mode. Merging now.

@forslund forslund merged commit 8fb27e6 into dev Sep 10, 2019
3 checks passed
3 checks passed
:-) Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 53.246%
Details
@penrods penrods deleted the feature/config-tool branch Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.