This project is intended to be a hands-on learning process of building a full-scale software application that consists of:
All the components above are built in stages. The first stage is to build a small prototype of the main system - a basic command line interpreter that is able to manipulate objects that are stored in a JSON file storage system. This would mainly be implemented in Python. Next, a static webpage would be built in HTML and CSS before functionality is added with Javascript. After that, a proper Database management system would be set up using MySQL. Finally, a server would be setup using tools like Puppet among others.
The command interpreter provides a shell-like environment that allows the developer to manipulate data objects and dynamically test the application without too much abstraction in between. It is built in Python.Through the interpreter, you should be able to:
- Create a new object
- Retrieve an object from a file, a database etc…
- Do operations on objects (count, compute stats, etc…)
- Update attributes of an object
- Destroy an object
- The console can be run in both interactive and non-interactive mode.
- It prints a prompt (hbnb) and waits for the user for input.
$ ./console.py
(hbnb) help
Documented commands (type help <topic>):
========================================
EOF help quit
(hbnb)
(hbnb)
(hbnb) quit
$
$ echo "help" | ./console.py
(hbnb)
Documented commands (type help <topic>):
========================================
EOF help quit
(hbnb)
$
$ cat test_help
help
$
$ cat test_help | ./console.py
(hbnb)
Documented commands (type help <topic>):
========================================
EOF help quit
(hbnb)
$
Command | Description |
---|---|
quit |
Exits the program |
EOF |
Exits the program |
create <class> |
Creates an instance of a class |
show <class> <id> |
Prints the string representation of an instance of a class based on class name and id |
destroy <class> <id> |
Deletes instance of a class based on class name and id |
all |
Prints all string representations of all instances |
all <class> |
Prints all string representations of all instances based on class name |
update <class> <id> <attribute name> "<attribute value>" |
Updates an attribute of an instance based on class name and id |
-
First clone this repository.
-
Once the repository is cloned locate the "console.py" file and run it as follows:
/AirBnB_clone$ ./console.py
- When this command is run the following prompt should appear:
(hbnb)
- This prompt designates you are in the "HBnB" console. There are a variety of commands available within the console program as described in the table above.
Usage: create <class_name>
(hbnb) create BaseModel
(hbnb) create BaseModel
3aa5babc-efb6-4041-bfe9-3cc9727588f8
(hbnb)
Usage: show <class_name> <_id>
(hbnb) show BaseModel 3aa5babc-efb6-4041-bfe9-3cc9727588f8
[BaseModel] (3aa5babc-efb6-4041-bfe9-3cc9727588f8) {'id': '3aa5babc-efb6-4041-bfe9-3cc9727588f8', 'created_at': datetime.datetime(2020, 2, 18, 14, 21, 12, 96959), 'updated_at': datetime.datetime(2020, 2, 18, 14, 21, 12, 96971)}
(hbnb)
Usage: destroy <class_name> <_id>
(hbnb) destroy BaseModel 3aa5babc-efb6-4041-bfe9-3cc9727588f8
(hbnb) show BaseModel 3aa5babc-efb6-4041-bfe9-3cc9727588f8
** no instance found **
(hbnb)
Usage: update <class_name> <_id>
(hbnb) update BaseModel b405fc64-9724-498f-b405-e4071c3d857f first_name "person"
(hbnb) show BaseModel b405fc64-9724-498f-b405-e4071c3d857f
[BaseModel] (b405fc64-9724-498f-b405-e4071c3d857f) {'id': 'b405fc64-9724-498f-b405-e4071c3d857f', 'created_at': datetime.datetime(2020, 2, 18, 14, 33, 45, 729889),
'updated_at': datetime.datetime(2020, 2, 18, 14, 33, 45, 729907), 'first_name': 'person'}
(hbnb)
This project is not in its final form and will continue to be updated and improved over time