cs445 - Fall 2013Project - Command Line InterfaceExamples 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$ h21 search [--city] [--start_date] [--end_date] [--beds] Example
$ h21 search --city "Berlin" --start_date 20140701 --end_date 20140704
Here's another example.
$ h21 search --city "Berlin" --start_date 20140701 --end_date 20140702 --beds 1
Now you can book the cheapest bed by issuing the following command:
$ h21 book add --search_id 1234 --user_id 678
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
Time do some more searches.
$ h21 search --city "Berlin" --start_date 20140701 --end_date 20140703 --beds 3
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
Now you can book by issuing the following command:
$ h21 book add --search_id 1237 --user_id 679
Let's check again hostel availability in Berlin
$ h21 search --city "Berlin" --start_date 20140701 --end_date 20140704
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 commandsadd$ 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 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 $ |