Files
iconograph/client/alert.py

44 lines
609 B
Python
Raw Normal View History

2016-04-02 11:16:27 -07:00
#!/usr/bin/python3
import argparse
import sys
import time
parser = argparse.ArgumentParser(description='iconograph wait_for_service')
parser.add_argument(
'--type',
dest='type',
action='store',
choices={'happy', 'angry'},
required=True)
FLAGS = parser.parse_args()
def Happy():
yield '\a'
time.sleep(3.0)
def Angry():
yield '\a'
time.sleep(0.2)
_TYPES = {
'happy': Happy,
'angry': Angry,
}
def main():
handler = _TYPES[FLAGS.type]
while True:
for item in handler():
sys.stdout.write(item)
sys.stdout.flush()
if __name__ == '__main__':
main()