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
Merged

Conversation

penrods
Copy link
Contributor

@penrods penrods 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.

@devs-mycroft devs-mycroft added the CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors) label Sep 6, 2019
@penrods penrods mentioned this pull request Sep 6, 2019
@JarbasAl
Copy link
Contributor

JarbasAl 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
Collaborator

@forslund forslund 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 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 September 10, 2019 12:11
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
Copy link
Collaborator

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
@penrods penrods deleted the feature/config-tool branch September 10, 2019 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants