Skip to content

this repo contains the first part of the AirBnB Clone, build by Alejo López and Jorge Chaux

Notifications You must be signed in to change notification settings

alejolo311/AirBnB_clone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

0x00. AirBnB clone - The console


This is the first part of a project for Holberton School: AirBnB clone - The console. First step: Write a command interpreter to manage the AirBnB objects.

The command interpreter

The command interpreter is currently capable of:

  • Create a new object (ex: a new User or a new Place)
  • 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

Installation

git clone https://github.com/alejolo311/AirBnB_clone
cd AirBnB_clone

Usage

Interactive Mode

$ ./console.py
(hbnb) help

Documented commands (type help <topic>):
========================================
EOF  help  quit

(hbnb)
(hbnb)
(hbnb) quit
$

Non-Interactive Mode

$ 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)
$

Usage

This interpreter has basic console commands such as help, quit, EOF, create, show, destroy, update, all and count.

Command Snytax and Usage:

Command Syntax Output
help help [option] Displays all available commands
quit quit Exit command interpreter
EOF EOF Exit command interpreter
create create [class_name] or [class_name].create() Creates an instance of class_name
update update [class_name] [object_id] [update_key] [update_value] or [class].update([object_id] [update_key] [update_value]() Updates the key:value of class_name.object_id instance
show show [class_name] [object_id] or [class_name].show([object_id])() Displays all attributes of class_name.object_id
all all [class_name], [class_name].all() Displays every instance of class_name, if used without option displays every instance saved to the file
destroy destroy [class_name] [object_id] or [class_name].destroy([object_id])() Deletes all attributes of class_name.object_id
count count [class_name] or [class_name].count() Counts all the instances with class name specified

Files

File Name Description
models/base_model.py Base Class with public instance attributes and methods
models/amenity.py An Amenity class that inherits from BaseModel
models/city.py A City class that inherits from BaseModel
models/place.py A Place class that inherits from BaseModel
models/review.py A Review class that inherits from BaseModel
models/state.py A State class that inherits from BaseModel
models/user.py A User class that inherits from BaseModel
models/engine/file_storage.py A class that serializes instances to a JSON file and deserializes JSON file to instances
tests/test_models/ Unittests for BaseModel, User, amenity, city, place, review, and state
tests/test_models/test_engine/ Unittest for file storage

Environment

Authors

About

this repo contains the first part of the AirBnB Clone, build by Alejo López and Jorge Chaux

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published