1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-06 11:22:58 +00:00

adding action to dotfiles

This commit is contained in:
deadc0de6
2017-09-08 15:24:25 +02:00
parent cc9c0792ed
commit cd77fecee3
6 changed files with 90 additions and 6 deletions

26
dotdrop/action.py Normal file
View File

@@ -0,0 +1,26 @@
"""
author: deadc0de6 (https://github.com/deadc0de6)
Copyright (c) 2017, deadc0de6
Represent an action in dotdrop
"""
import subprocess
from logger import Logger
class Action:
def __init__(self, key, action):
self.key = key
self.action = action
self.log = Logger()
def execute(self):
self.log.sub('executing \"%s\"' % (self.action))
try:
subprocess.run(self.action, shell=True)
except KeyboardInterrupt:
self.log.warn('action interrupted')
def __str__(self):
return 'key:%s -> \"%s\"' % (self.key, self.action)