cs445 - Spring 2013

Project - Command Line Interface


The general format of a command is:

$ lfss command [ command_options [ arguments ] ]

where lfs is short for Lion Fish Scuba Software, 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

$ lfss tour view

will show all the tours in the system, past and present.

$ lfss tour view --start_date 20130701 --end_date 20130731

will show only the tours in the system between 7/1/2013 and 7/31/2013. In this latest example tour is the command, view is the command option, and start_date and end_date are arguments for view, introduced by double dashes (the long form of arguments)

Commands

  • tour add, delete, cancel, view, load
  • user add, view
  • book add, cancel, view
  • admin

tour commands

add

$ lfss tour add --date --start_time --duration --price --seats --name --description

The command will return the tour detail, including the tour_id.

Example

$ lfss tour add --date 20130702 --start_time 10:00 --duration 90 --price 25.50 --seats 8 \
  --name "Intro to scuba" --description "Great for newcomers to scuba diving"

Tour id: 123
Date: 7/2/2013
Start time: 10:00
Duration: 90m
Price per seat: $25.50
Seats: 8
Tour name: Intro to scuba
Tour description: Great for newcomers to scuba diving

$

delete

$ lfss tour delete --tour_id

The command will delete the tour with the specified tour_id provided that no seat on this tour has been booked.

Example

$ lfss tour delete --tour_id 123

Tour id: 123 has been deleted

$

cancel

$ lfss tour cancel --tour_id

The command will cancel the tour with the specified tour_id: money will be refunded to all customer who have booked this tour and each of them will be notified of the cancellation.

Example

$ lfss tour cancel --tour_id 123

Tour id: 123 has been cancelled
User: John Smith notified. 1 seat. $25.50 refund initiated. User: Alice Rosen notified. 2 seats. $51.00 refund initiated.
$

view

$ lfss tour [ view ] [ --tour_id ] [ --start_date ] [ --end_date ]

This is the default command option for tour. Without any tour_id and with no dates all the tours in the system will be displayed, active or cancelled. If a date is provided only tours after or before the date will be displayed. If a tour_id is provided, then only information about that tour will be displayed.

Example

$ lfss tour

Tour id: 123. Date: 7/2/2013. Start: 10:00. Duration: 90m. Seats: 8. Price: $25.50. Booked: 3. Name: Intro to scuba.
Tour id: 124. Date: 7/2/2013. Start: 15:00. Duration: 120m. Seats: 4. Price: $50.00. Booked: 4. Name: Advanced scuba.


$

load

$ lfss tour load --file

This will load tour information from a file. The file can be XML or JSON. The command will print information about all the tours created.

Example

$ lfss tour load --file new_tours_20130409.xml

3 tours created
Tour id: 125. Date: 7/3/2013. Start: 10:00. Duration: 90m. Seats: 8. Price: $21.00. Booked: 0. Name: Intro to scuba.
Tour id: 126. Date: 7/3/2013. Start: 15:00. Duration: 120m. Seats: 5. Price: $50.00. Booked: 0. Name: Advanced scuba.
Tour id: 127. Date: 7/4/2013. Start: 10:00. Duration: 90m. Seats: 6. Price: $40.00. Booked: 0. Name: Advanced scuba 2.

$


user commands

add

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

$ lfss user add --first_name Bob --last_name Retter --email bob.retter@example.com

User id: 1234
Name: Bob Retter
Email: bob.retter@example.com
Date created: 4/9/2013 - 17:18

$

Additional detail coming soon.



$Id: command-line.html,v 1.1 2013/04/09 18:43:10 virgil Exp virgil $