|
4 | 4 |
|
5 | 5 |
|
6 | 6 | class Hello: |
| 7 | + '''Hello group of commands, there is a to and a everyone |
| 8 | + command |
| 9 | + ''' |
7 | 10 |
|
8 | 11 | def __init__(self, name): |
9 | 12 | self.name = name |
10 | 13 |
|
11 | | - def say(self): |
12 | | - return f'Hello {self.name}' |
| 14 | + def to(self, name=None): |
| 15 | + if name is None: |
| 16 | + if self.name is None: |
| 17 | + return 'No one to say hello to' |
| 18 | + else: |
| 19 | + return f'Hello to {self.name}' |
| 20 | + else: |
| 21 | + return f'Hello {name}' |
| 22 | + |
| 23 | + def everyone(self): |
| 24 | + return 'hello to everyone' |
| 25 | + |
13 | 26 |
|
14 | 27 | class Bye: |
| 28 | + '''Bye group of commands, there is a to and a no_one |
| 29 | + command |
| 30 | + ''' |
15 | 31 |
|
16 | 32 | def __init__(self, name): |
17 | 33 | self.name = name |
18 | 34 |
|
19 | | - def say(self): |
20 | | - return f'Bye {self.name}' |
| 35 | + def to(self, name=None): |
| 36 | + if name is None: |
| 37 | + if self.name is None: |
| 38 | + return 'No one to say bye to' |
| 39 | + else: |
| 40 | + return f'Bye to {self.name}' |
| 41 | + else: |
| 42 | + return f'Bye {name}' |
| 43 | + |
| 44 | + def no_one(self): |
| 45 | + return f'Bye to no one' |
21 | 46 |
|
22 | 47 |
|
23 | 48 | class Sayer: |
| 49 | + '''Class to make the hello and bye groups available, it |
| 50 | + also has its own to command, as well as the info command |
| 51 | + ''' |
24 | 52 |
|
25 | | - def __init__(self, hello_name, bye_name): |
| 53 | + def __init__(self, hello_name=None, bye_name=None): |
26 | 54 | self.hello = Hello(hello_name) |
27 | 55 | self.bye = Bye(bye_name) |
28 | 56 |
|
29 | | - def say(self): |
30 | | - return f'Bla, bla' |
| 57 | + def to(self): |
| 58 | + return 'Do you want to say hello or bye' |
| 59 | + |
| 60 | + def info(self): |
| 61 | + return 'This is version 0.1beta' |
| 62 | + |
31 | 63 |
|
32 | 64 | if __name__ == '__main__': |
33 | 65 | fire.Fire(Sayer) |
0 commit comments