-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsample.py
executable file
·64 lines (45 loc) · 1.67 KB
/
sample.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =========================================================================== #
# pyreds - REDS Institute, HEIG-VD, Yverdon-les-Bains (CH) - 2017 #
# =========================================================================== #
""" Client main
Long description
"""
# =========================================================================== #
__author__ = "Jean-Pierre Miceli <[email protected]"
# =========================================================================== #
# == pyreds libs
import pyreds
class HelloWorld(pyreds.Command):
_brief = "Hello World command"
_description = "Hello World command"
def _function(self):
print "Hello World!"
class Add(pyreds.Command):
_brief = "Simple Addition"
_description = "return the sum of ValA + ValB"
_input = pyreds.Params(pyreds.Input('ValA', "Value A"),
pyreds.Input('ValB', "Value B"))
def _function(self, valA, valB):
return valA + valB
class Toto(pyreds.Command):
_brief = "Toto command"
_description = "This command is used to test the completer"
param1 = {'One' : 1,
'Two' : 2,
'Three' : 3}
param2 = {True : True,
False : False}
_input = pyreds.Params(pyreds.Input('param1', "param1", param1),
pyreds.Input('param2', "param2", param2))
def _function(self, param1, param2):
print param1
print param2
class Test(pyreds.Module):
helloWorld = HelloWorld()
add = Add()
toto = Toto()
cli = pyreds.console.InteractiveConsole()
cli.addModule(Test)
cli.start()