Rexpass / AirBnB_clone

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AirBnB Clone - The Console


Description

This project is the first step towards building a full web application of the AirBnB clone. In this first step we are building a console, a custom command interpreter that will be used in subsequent AirBnB projects to manage objects of our classes.

This console will allow us to do the following:

  • 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

Usage

  • The console can be run in both interactive and non-interactive mode.
  • It prints a prompt (hbnb) and waits for the user for input.

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

Commands

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
<class>.all() Retrieves all instances of a class
<class>.count() Retrieves the number of instances of a class
<class>.show(<id>) Retrieves an instance based on its id
<class>.destroy(<id>) Destroys an instance based on its id

Authors

  • Robel Effa - Github: Rexpass
  • Eden Demo

About


Languages

Language:Python 69.9%Language:HTML 19.5%Language:CSS 10.4%Language:Shell 0.3%