-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add 'msm remove', improve error handling and parsing #1093
Conversation
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.
There was a problem hiding this 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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 "----------------------------------------------------------------------" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More than 80 characters
There was a problem hiding this comment.
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." |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
}
Cleaning up several small problems found wiht new MSM during review: * Message formatting * Incorrect spelling on a env var used
Semi-major rework of the Mycroft Skill Manager (MSM), including:
msm install "daily meditation"
Previously it would search for "daily" and also search for
"meditation", but both independently.
that perform multiple things, such as 'msm default' will
continue on a failure of one skill and return the highest
error code ultimately.
ethanward repo no longer exists.
subprocess operations.
lines, making them easier to parse.
A corresponding update to the skill-installer will take
advantage of these changes.