-
Notifications
You must be signed in to change notification settings - Fork 0
/
hello.py
46 lines (41 loc) · 1.12 KB
/
hello.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
from envbuilder.command import Command
from envbuilder.sh import notify, sh
class hello(Command):
"""
Print hello world.
"""
name = 'hello'
def run(self, args, config):
notify('Hello, world!')
class hellosh(Command):
"""
Print hello world.
"""
name = 'hello'
def run(self, args, config):
sh("echo 'Hello, world!'")
class helloweb(Command):
"""
Run a webserver that prints hello world
"""
name='helloweb'
py_dependencies=['cherrypy']
def run(self, args, config):
import cherrypy
class HelloWorld(object):
def index(self):
return 'Hello, world!'
index.exposed=True
cherrypy.quickstart(HelloWorld())
class named_hello(Command):
"""
Prints hello to a specified user.
"""
name = 'named_hello'
def get_arg_parser(self):
parser = self.get_base_arg_parser()
parser.add_argument('--name', default='world',
help='Specify who we are greeting')
return parser
def run(self, args, config):
notify('Hello, %s!' % args.name)