forslund / cmd_skill

A simple mycroft skill for launching shell scripts and system commands
GNU General Public License v3.0
12 stars 7 forks source link

self.config is deprecated #2

Closed forslund closed 3 years ago

forslund commented 5 years ago

self.config is deprecated, the skill should offer usage through skill settings.

forslund commented 5 years ago

Hmm... I was thinking something along the lines of

in the initialize having something like:


user = self.settings.get('user') or self.config.get('user')
if user:
    pwnam = getpwnam(user)
    self.uid = pwnam.pw_uid
    self.gid = pwnam.pw_gid
self.alias = self.settings.get('alias') or self.config.get('alias') or {}

Which should work well for a transition period. Reading the settings.json for the skill if they exist otherwise falling back to the old config.

What do you think

AlphaPy commented 5 years ago

I apologize for deleting my comment. My understanding of Python at the moment is very basic as I have been trying to pick it up in my spare time. I made some errors in the code and deleted them. I managed to change the deprecated code without errors but it no longer functions. I'm still tinkering with it but I like your idea. Thanks again for this awesome skill! Edit: I think I understand now what I did wrong but I'm too tired to press on tonight. I'll take another shot at it tomorrow if I have time.

forslund commented 5 years ago

Thank you for using it. It's one of my earliest skills so it's not really top of the line but it seem to still be working decently :)

Good luck with your efforts!

AlphaPy commented 5 years ago

I've managed to get the .py file to write to settings.json but can't figure out how to structure the configuration for the alias in it and call it from settings.json. Do you have any suggestions? Thanks!