Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kazimovzaman2/holbertonschool-airbnb_clone
First Part of AirBnB_clone project. The groupwork of Saleh Shahverdiyev and Zaman Kazimov.
https://github.com/kazimovzaman2/holbertonschool-airbnb_clone
python
Last synced: about 2 months ago
JSON representation
First Part of AirBnB_clone project. The groupwork of Saleh Shahverdiyev and Zaman Kazimov.
- Host: GitHub
- URL: https://github.com/kazimovzaman2/holbertonschool-airbnb_clone
- Owner: kazimovzaman2
- License: gpl-3.0
- Created: 2024-02-26T04:40:46.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-03-11T11:32:41.000Z (10 months ago)
- Last Synced: 2024-03-12T11:33:26.930Z (10 months ago)
- Topics: python
- Language: HTML
- Homepage:
- Size: 168 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Authors: AUTHORS
Awesome Lists containing this project
README
![Image](./assets/hbnb_logo.png)
AirBnB Clone Command Interpreter
This project is a command-line interpreter (CLI) for managing AirBnB objects. It serves as the first step towards building a full web application clone of AirBnB. The CLI allows users to interact with various objects such as users, states, cities, places, amenities, reviews, etc., through a series of commands.
AirBnB Clone Command Interpreter
To start the AirBnB Clone Command Interpreter, follow these steps:
1. Clone the repository from GitHub:
```
git clone https://github.com/kazimovzaman2/holbertonschool-AirBnB_clone.git
```
2. Navigate to the project directory:
```
cd holbertonschool-AirBnB_clone
```
3. Run the command interpreter:
```
./console.py
```Storage
The command interpreter uses a storage engine to manage AirBnB objects. The storage engine is implemented using a JSON file to store and retrieve objects. The storage engine is defined in the [file_storage.py](./models/engine/file_storage.py) module. The storage engine supports the following methods:
- `all`: Retrieve all objects from the storage.
- `new`: Add a new object to the storage.
- `save`: Save changes to the storage.
- `reload`: Reload objects from the storage.The storage engine is used by the command interpreter to manage AirBnB objects. The storage engine is also used by the web framework to manage AirBnB objects.
How to Use the Command Interpreter
The command interpreter supports the following commands:
- `EOF`: Exit the command interpreter.
- `all`: Retrieve all objects from the storage.
- `create`: Create a new object.
- `destroy`: Delete an object.
- `help`: Display help information.
- `quit`: Exit the command interpreter.
- `show`: Display information about an object.
- `update`: Update an object.The command interpreter supports the following objects:
- `Amenity`
- `BaseModel`
- `City`
- `Place`
- `Review`
- `State`
- `User`Using the Console
To get help on a specific command, type `help ` in the command interpreter. For example:
```
(hbnb) help create
Create a new instance of a class.
Usage: create
```To create a new object, type `create ` in the command interpreter. For example:
```
(hbnb) create User
4628b005-1a65-4402-ace3-4fff871e31aa
```To display all objects, type `all` in the command interpreter. For example:
```
(hbnb) all
["[User] (4628b005-1a65-4402-ace3-4fff871e31aa) {'id': '4628b005-1a65-4402-ace3-4fff871e31aa', 'created_at': datetime.datetime(2024, 2, 28, 17, 31, 12, 823645), 'updated_at': datetime.datetime(2024, 2, 28, 17, 31, 12, 823908)}"]
```To display all objects of a specific type, type `all ` in the command interpreter. For example:
```
(hbnb) all User
["[User] (4628b005-1a65-4402-ace3-4fff871e31aa) {'id': '4628b005-1a65-4402-ace3-4fff871e31aa', 'created_at': datetime.datetime(2024, 2, 28, 17, 31, 12, 823645), 'updated_at': datetime.datetime(2024, 2, 28, 17, 31, 12, 823908)}"]
```To display information about an object, type `show ` in the command interpreter. For example:
```
(hbnb) show User 4628b005-1a65-4402-ace3-4fff871e31aa
[User] (4628b005-1a65-4402-ace3-4fff871e31aa) {'id': '4628b005-1a65-4402-ace3-4fff871e31aa', 'created_at': datetime.datetime(2024, 2, 28, 17, 31, 12, 823645), 'updated_at': datetime.datetime(2024, 2, 28, 17, 31, 12, 823908)}
```To update an object, type `update ` in the command interpreter. For example:
```
(hbnb) update User 4628b005-1a65-4402-ace3-4fff871e31aa first_name "Betty"
```To delete an object, type `destroy ` in the command interpreter. For example:
```
(hbnb) destroy User 4628b005-1a65-4402-ace3-4fff871e31aa
```To exit the command interpreter, type `quit` or `EOF` in the command interpreter. For example:
```
(hbnb) quit
```To run the command interpreter in non-interactive mode, echo the command and pipe it into the command interpreter. For example:
```
echo "help" | ./console.py
```Testing
Unit tests for the command interpreter are located in the [tests](./tests/) directory. To run the tests, navigate to the project directory and run the following command:
```
python3 -m unittest discover tests
```Authors
- [Zaman Kazimov](https://github.com/kazimovzaman2)
- [Saleh Shahverdiyev](https://github.com/salehshahverdiyev)License
This project is licensed under the GNU GENERAL PUBLIC LICENSE - see the [LICENSE](./LICENSE) file for details.