cs445 - Fall 2013

Project - Command Line Interface


Examples below will refer to a single hostel, named "Hostel #1" in Berlin. Hostel configuration and pricing are described in the image below. Initially all beds are available.


The general format of a command is:

$ h21 command [ command_options [ arguments ] ]

where h21 is short for Hostel 21, command is one the several things the software can do, command_options are options for the various commands available, and arguments are the various values that go with the command options.

Examples

$ h21 search

will show all the properties in the system, and all the beds and associated detail, past and present.

$ h21 search --city "Berlin" --start_date 20140701 --end_date 20140703

will show only the bed availablity in all Hostel 21 properties in Berlin, if any, between 7/1/2014 and 7/3/2014.

Here's an even more complicated example:

$ h21 book cancel --booking_id 123

In this latest example book is the command, cancel is the command option, and id is the argumet argument for cancel, introduced by double dashes (the long form of arguments)

Commands

  • search
  • book add, cancel, view
  • user add, change, view
  • admin load, revenue, occupancy

search

$ h21 search [--city] [--start_date] [--end_date] [--beds]

Example

$ h21 search --city "Berlin" --start_date 20140701 --end_date 20140704

Hostel #1, Berlin
7/1/13 to 7/2/13: 3 beds available between $10 and $20
7/2/13 to 7/3/13: 3 beds available between $10 and $25
7/3/13 to 7/4/13: 3 beds available between $10 and $30

$

Here's another example.

$ h21 search --city "Berlin" --start_date 20140701 --end_date 20140702 --beds 1

Hostel #1, Berlin
search_id:1234, $10, room #1
search_id:1235, $12, room #1
search_id:1236, $20, room #2

$

Now you can book the cheapest bed by issuing the following command:

$ h21 book add --search_id 1234 --user_id 678

Booking successful! Here's the detail of your booking:
Hostel #1, Berlin
Check-in date: 7/1/2014
Check-out date: 7/2/2014
Beds: 1
Booking ID: 910
Name: John Smith
Price: $10

$

Let's check availability on 7/1/14, we should see less for the same hostel.

$ h21 search --city "Berlin" --start_date 20140701 --end_date 20140704

Hostel #1, Berlin
7/1/13 to 7/2/13: 2 beds available between $12 and $20
7/2/13 to 7/3/13: 3 beds available between $10 and $25
7/3/13 to 7/4/13: 3 beds available between $10 and $30

$

Time do some more searches.

$ h21 search --city "Berlin" --start_date 20140701 --end_date 20140703 --beds 3

Hostel #1, Berlin
Sorry, not enough beds available on 7/1/14

$

Ok, let's try finding fewer beds between 7/1/14 and 7/3/14.

$ h21 search --city "Berlin" --start_date 20140701 --end_date 20140703 --beds 2

Hostel #1, Berlin
search_id:1237, $69, rooms #1 and #2

$

Now you can book by issuing the following command:

$ h21 book add --search_id 1237 --user_id 679

Booking successful! Here's the detail of your booking:
Hostel #1, Berlin
Check-in date: 7/1/2014
Check-out date: 7/3/2014
Beds: 2
Booking ID: 911
Name: Jane Smith
Price: $69

$

Let's check again hostel availability in Berlin

$ h21 search --city "Berlin" --start_date 20140701 --end_date 20140704

Hostel #1, Berlin
7/1/13 to 7/2/13: no beds available
7/2/13 to 7/3/13: 1 bed available at $10
7/3/13 to 7/4/13: 3 beds available between $10 and $30

$

NOTE: the "search" will return that cheapest combination of beds in a hostel that avoids moving guests from bed to bed during their stay.


user commands

add

$ h21 user add --first_name --last_name --email [ --cc_number --expiration_date --security_code --phone ]

The command will create a new user and return the user detail, including the user_id. If a user with the same email address exists, then the command will return an error and detail about the existing user.

Example

$ h21 user add --first_name John --last_name Doe --email john.doe@example.com

user_id: 680
Name: John Doe
Email: john.doe@example.com
Date created: 11/9/2013 - 17:18

$

change

$ h21 user change --user_id [ --first_name --last_name --email [ --cc_number --expiration_date --security_code --phone ]]



$Id: command-line.html,v 1.2 2013/11/05 00:06:47 virgil Exp $