-
Notifications
You must be signed in to change notification settings - Fork 0
/
console.py
executable file
·50 lines (38 loc) · 1.02 KB
/
console.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
"""
This module contains the HBNBCommand class, which is a command line interpreter
for the AirBnB clone project. It uses the cmd module for the command line interface.
"""
import cmd
class HBNBCommand(cmd.Cmd):
"""
HBNBCommand class that contains the logic for the command line interpreter.
Attributes:
prompt (str): The command line prompt string.
"""
prompt = '(hbnb) '
def do_quit(self, arg):
"""
Handles the 'quit' command, which exits the program.
Args:
arg: The arguments passed to the 'quit' command. Not used.
Returns:
True to signal the program to exit.
"""
return True
def do_EOF(self, arg):
"""
Handles the 'EOF' command, which also exits the program.
Args:
arg: The arguments passed to the 'EOF' command. Not used.
Returns:
True to signal the program to exit.
"""
return True
def emptyline(self):
"""
Handles the case where an empty line is entered in response to the prompt.
Does nothing.
"""
pass
if __name__ == '__main__':
HBNBCommand().cmdloop()