summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSérgio Almeida <mephx.x@gmail.com>2009-07-28 05:52:42 +0100
committerSérgio Almeida <mephx.x@gmail.com>2009-07-28 05:52:42 +0100
commitae61b3e7ed94036f045091a79a4eecffe651547e (patch)
tree241049dcce74052f0d0580ddb3c8cee6dd839499 /uprofile.py
parentRevert "Added output to profile actions" (diff)
downloaduselect-ae61b3e7ed94036f045091a79a4eecffe651547e.tar.gz
uselect-ae61b3e7ed94036f045091a79a4eecffe651547e.tar.bz2
uselect-ae61b3e7ed94036f045091a79a4eecffe651547e.zip
ProfileAction structure and Argv parsing done
Diffstat (limited to 'uprofile.py')
-rwxr-xr-xuprofile.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/uprofile.py b/uprofile.py
index 3945ebf..cd613f2 100755
--- a/uprofile.py
+++ b/uprofile.py
@@ -20,13 +20,14 @@ from uio import printsystem
verbose = False
printsystem.set_type('profile')
-class Profile:
+class Profile(Module):
def __init__(self, name):
self.name = name
self.author = 'unnamed'
self.version = '0.1'
self.description = 'Empty'
+
self.actions = []
self.actions.append(Action(name = 'set', \
description = 'Set this profile for this folder.', \
@@ -34,8 +35,10 @@ class Profile:
self.actions.append(Action(name = 'default', \
description = 'Set this profile the default profile.', \
type = 'profile'))
- return
+ self.parameters = []
+ self.output = []
+
class UniversalProfileTool:
def __init__(self):
@@ -56,6 +59,7 @@ class UniversalProfileTool:
global verbose, version
profile = None
profiles = None
+ action = None
printsystem.use_colors(True)
for arg in args:
if arg == '-v':
@@ -65,18 +69,23 @@ class UniversalProfileTool:
elif arg == '-nc':
printsystem.use_colors(False)
args = args[1:]
-
+
if len(args) < 1:
self.get_profiles()
profiles = self.profiles
elif len(args) == 1:
profile = self.get_profile(args[0])
+ elif len(args) == 2:
+ profile = self.get_profile(args[0])
+ action = profile.get_action(args[1])
+ action.build()
+ action.do_action(args[1:])
if len(args) == 2:
args = None
else:
args = args[2:]
- return [profile, profiles, args]
+ return [profile, profiles, args, action]
def main():
@@ -85,7 +94,7 @@ def main():
list = uprofile.parse_argv(sys.argv[1:])
printsystem.print_ui(profile = list[0], \
- profiles = list[1], args = list[2])
+ profiles = list[1], action = list[3], args = list[2])
except UserWarning, warning:
printsystem.print_exception(warning, True)