Welcome to the AirBnB clone project! This project aims to build an AirBnB web application by implementing a command interpreter. This initial step is crucial, as it establishes the foundation for subsequent tasks such as HTML/CSS templating, database storage, API development, and front-end integration.
- Implement a parent class (BaseModel) responsible for the initialization, serialization, and deserialization of future instances.
- Create a simple flow of serialization/deserialization: Instance <-> Dictionary <-> JSON string <-> File.
- Define classes for essential AirBnB objects (User, State, City, Place, etc.) that inherit from BaseModel.
- Develop the first abstracted storage engine for the project: File storage.
- Create comprehensive unit tests to validate all classes and the storage engine.
The command interpreter is similar to a shell but tailored for a specific use case. In this project, it allows the management of AirBnB objects, including:
- Creating a new object (e.g., User, Place).
- Retrieving an object from a file, database, etc.
- Performing operations on objects (e.g., counting, computing stats).
- Updating attributes of an object.
- Destroying an object.
$ ./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)
$
- Clone the repository.
https://github.com/wandilemawelela/AirBnB_clone.git
cd AirBnB-clone
- Run the command interpreter in interactive mode.
Copy code
./console.py
- Explore the documented commands and start managing your AirBnB objects!
Console Commands The AirBnB console supports the following commands: *create Usage: create
Creates a new instance of BaseModel, saves it (to the JSON file) and prints the id *show Usage: show or .show()
(hbnb) create User
(hbnb)
(hbnb) show User uid
(hbnb)
(hbnb) User.show(uid)
(hbnb)
*destroy: Usage: destroy <class> <id>
Deletes an instance based on the class name and id (save the change into the JSON file)
*all
Usage: all or all <class>
Prints all string representation of all instances based or not on the class name
```$ ./console.py
(hbnb) create BaseModel
(hbnb) create BaseModel
(hbnb) create User
(hbnb) create User
(hbnb)
(hbnb) all BaseModel
*update
Usage: update ```<class> <id>
Updates an instance based on the class name and id by adding or updating attribute
$ ./console.py (hbnb) create User (hbnb) (hbnb) update User id first_name "name" (hbnb) show User uid (hbnb) (hbnb) User.update(uid), address, "address") (hbnb) User.show(uid) (hbnb) (hbnb) User.update(uid, {'email': 'email', 'last_name': 'last_name'}
[Test]
Unittests for the Airbnb_clone project are defined in the tests folder. To run the entire test suite simultaneously, execute the following command: