Skip to content

Commit

Permalink
Merge pull request #19 from OpenVoiceOS/release-0.2.4a1
Browse files Browse the repository at this point in the history
Release 0.2.4a1
  • Loading branch information
JarbasAl authored Nov 17, 2024
2 parents 6f1b8a7 + d0e1015 commit 8620f51
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 19 deletions.
11 changes: 3 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
# Changelog

## [0.2.2a3](https://github.com/OpenVoiceOS/ovos-skill-cmd/tree/0.2.2a3) (2024-11-17)
## [0.2.4a1](https://github.com/OpenVoiceOS/ovos-skill-cmd/tree/0.2.4a1) (2024-11-17)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-skill-cmd/compare/V0.2.2a2...0.2.2a3)
[Full Changelog](https://github.com/OpenVoiceOS/ovos-skill-cmd/compare/0.2.4...0.2.4a1)

**Merged pull requests:**

- skill.json [\#15](https://github.com/OpenVoiceOS/ovos-skill-cmd/pull/15) ([JarbasAl](https://github.com/JarbasAl))
- fixed italian translation [\#10](https://github.com/OpenVoiceOS/ovos-skill-cmd/pull/10) ([gitlocalize-app[bot]](https://github.com/apps/gitlocalize-app))

## [V0.2.2a2](https://github.com/OpenVoiceOS/ovos-skill-cmd/tree/V0.2.2a2) (2024-11-15)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-skill-cmd/compare/0.2.2...V0.2.2a2)
- fix: alias overwrite ... [\#18](https://github.com/OpenVoiceOS/ovos-skill-cmd/pull/18) ([JarbasAl](https://github.com/JarbasAl))



Expand Down
19 changes: 11 additions & 8 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from pwd import getpwnam
import os
import shlex
import subprocess
from pwd import getpwnam

from ovos_utils.log import LOG
from ovos_workshop.skills import OVOSSkill
from ovos_workshop.intents import IntentBuilder

from ovos_workshop.decorators import intent_handler
from ovos_workshop.intents import IntentBuilder
from ovos_workshop.skills import OVOSSkill


def set_user(uid, gid):
Expand All @@ -31,10 +33,10 @@ def set_user(uid, gid):
class CmdSkill(OVOSSkill):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.uid = None
self.gid = None
self.alias = {}
super().__init__(*args, **kwargs)

def initialize(self):
user = self.settings.get('user')
Expand All @@ -52,11 +54,12 @@ def initialize(self):
@intent_handler(IntentBuilder('RunScriptCommandIntent')
.require('Script').require('Run'))
def run(self, message):
self.acknowledge()
script = message.data.get('Script')
script = self.alias.get(script, script)
alias = message.data.get('Script')
self.speak_dialog("running", {"alias": alias})
script = self.alias[alias]
LOG.info(f"alias: {alias} | command: {script}")
shell = self.settings.get('shell', True)
args = script.split(' ') if shell else script
args = script if shell else shlex.split(script)
try:
LOG.info(f'Running {args}')
if self.uid and self.gid:
Expand Down
1 change: 1 addition & 0 deletions locale/en-us/running.dialog
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
running {alias} (command|script)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def get_requirements(requirements_filename: str = "requirements.txt"):

# Function to find resource files
def find_resource_files():
resource_base_dirs = ("locale")
resource_base_dirs = ["locale"]
base_dir = abspath(dirname(__file__))
package_data = ["*.json"]
for res in resource_base_dirs:
Expand Down
5 changes: 5 additions & 0 deletions translations/en-us/dialogs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"running.dialog": [
"running {alias} (command|script)"
]
}
4 changes: 2 additions & 2 deletions version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# START_VERSION_BLOCK
VERSION_MAJOR = 0
VERSION_MINOR = 2
VERSION_BUILD = 4
VERSION_ALPHA = 0
VERSION_BUILD = 5
VERSION_ALPHA = 1
# END_VERSION_BLOCK

0 comments on commit 8620f51

Please sign in to comment.