Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

Add 'msm remove', improve error handling and parsing #1093

Merged
merged 3 commits into from
Sep 18, 2017
Merged

Conversation

penrods
Copy link
Contributor

@penrods penrods commented Sep 17, 2017

Semi-major rework of the Mycroft Skill Manager (MSM), including:

  • Add parse skill name strings support for quoted strings, e.g.:
    msm install "daily meditation"
    Previously it would search for "daily" and also search for
    "meditation", but both independently.
  • All commands return distinct error codes. Commands with
    that perform multiple things, such as 'msm default' will
    continue on a failure of one skill and return the highest
    error code ultimately.
  • Add 'msm remove', essentially the inverse of 'msm install'
  • Changed the example install URL to a penrods repo since the
    ethanward repo no longer exists.
  • Reworked skill list caching to behave properly with $( )
    subprocess operations.
  • Output for "install" and "remove" is now between hyphen
    lines, making them easier to parse.
  • Revamped many informational and error messages
  • Published under Apache 2.0 license

A corresponding update to the skill-installer will take
advantage of these changes.

Semi-major rework of the Mycroft Skill Manager (MSM), including:
* Add parse skill name strings support for quoted strings, e.g.:
    msm install "daily meditation"
  Previously it would search for "daily" and also search for
  "meditation", but both independently.
* All commands return distinct error codes.  Commands with
  that perform multiple things, such as 'msm default' will
  continue on a failure of one skill and return the highest
  error code ultimately.
* Add 'msm remove', essentially the inverse of 'msm install'
* Changed the example install URL to a penrods repo since the
  ethanward repo no longer exists.
* Reworked skill list caching to behave properly with $( )
  subprocess operations.
* Output for "install" and "remove" is now between hyphen
  lines, making them easier to parse.
* Revamped many informational and error messages
* Published under Apache 2.0 license

A corresponding update to the skill-installer will take
advantage of these changes.
@penrods penrods added CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors) Status: Work in progress PR being actively worked on, not yet ready for review. labels Sep 17, 2017
@penrods penrods added tagged for review and potential merge and removed Status: Work in progress PR being actively worked on, not yet ready for review. labels Sep 17, 2017
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.

Only major found is the use of the old picroft variable instead of picroft_mk1

msm/msm Outdated
echo "Installing requirements..."
if [[ "${picroft}" == 'false' ]]; then
echo " Installing requirements..."
if [[ "${picroft}" == "false" ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

Something is weird here. On my desktop system the script entered the else branch of this if-statement and installed requirements using sudo

Debug output:

+ echo '  Installing requirements...'
  Installing requirements...
+ [[ '' == \f\a\l\s\e ]]
+ sudo pip install -r requirements.txt

Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess it's that the picroft variable has been renamed picroft_mk1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

msm/msm Outdated
# due to ambiguity.
#
echo "Multiple matches for '${str}', be more specific."
echo "----------------------------------------------------------------------"
Copy link
Collaborator

Choose a reason for hiding this comment

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

More than 80 characters

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

msm/msm Outdated
deactivate mycroft
return 121
fi
else
echo "ERROR: Unable to activate mycroft virtualenv!"
echo "ERROR: Unable to activate Mycroft virtualenv, requirements not installed."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be small letters since the Mycroft virtualenv name is actually mycroft

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

exit_code=$?
if [[ ${exit_code} -gt 0 ]] ; then
echo "${script}: error ${exit_code}"
exit ${exit_code}
Copy link
Collaborator

Choose a reason for hiding this comment

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

These error printout/exit could be moved to a separate function since they're duplicated for each msm command

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not clear on what you mean here

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nothing really important but one could create a function wrapping the above lines since they exist a couple of times in the script.

function exit_error() {
       echo "$1: error $2"
       exit $2
}

Steve Penrod and others added 2 commits September 18, 2017 00:40
Cleaning up several small problems found wiht new MSM during review:
* Message formatting
* Incorrect spelling on a env var used
@forslund forslund merged commit a14be98 into dev Sep 18, 2017
@forslund forslund deleted the feature/msm_rework branch September 18, 2017 09:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.

2 participants