Пример #1
0
def get_select_request_parser() -> ShellArgumentParser:
    """Argparser for the :class:`.shell.MiniProjectShell`
    ``select_request`` command"""
    parser = ShellArgumentParser(
        prog="select_request",
        description="Select a ride request and perform actions with it")

    parser.add_argument("rid", type=int, help="The ID of the ride request")

    return parser
Пример #2
0
def get_search_requests_city_parser() -> ShellArgumentParser:
    """Argparser for the :class:`.shell.MiniProjectShell`
    ``search_requests_city`` command"""
    parser = ShellArgumentParser(
        prog="search_requests_city",
        description="Search ride requests by city name")

    parser.add_argument("city", help="The name of the city to search by")

    return parser
Пример #3
0
def get_search_requests_lcode_parser() -> ShellArgumentParser:
    """Argparser for the :class:`.shell.MiniProjectShell`
    ``search_requests_lcode`` command"""
    parser = ShellArgumentParser(
        prog="search_requests_lcode",
        description="Search ride requests by location code")

    parser.add_argument("lcode", help="The location code to search by")

    return parser
Пример #4
0
def get_cancel_booking_parser() -> ShellArgumentParser:
    """Get a :class:`ShellArgumentParser` for use in parsing the arguments
    for a ``cancel_booking`` command"""
    parser = ShellArgumentParser(
        prog="cancel_booking",
        description="Cancel a booking")

    parser.add_argument("bno", type=int,
                        help="The booking identification number")
    return parser
Пример #5
0
def get_delete_request_parser() -> ShellArgumentParser:
    """Argparser for the :class:`.shell.MiniProjectShell`
    ``delete_request`` command"""
    parser = ShellArgumentParser(
        prog="delete_request",
        description="Delete a ride request by rid")

    parser.add_argument("rid", type=int,
                        help="The ID of the ride request to delete")

    return parser
Пример #6
0
def get_list_ride_requests_parser() -> ShellArgumentParser:
    """Argparser for the :class:`.shell.MiniProjectShell`
    ``list_requests`` command"""
    parser = ShellArgumentParser(
        prog="list_requests",
        description="List all the ride requests that you offer")

    return parser
Пример #7
0
def get_show_inbox_parser() -> ShellArgumentParser:
    """Argparser for the :class:`.shell.MiniProjectShell`
    ``show_inbox`` command"""
    parser = ShellArgumentParser(
        prog="show_inbox",
        description="List all the unseen messages in your inbox")

    return parser
Пример #8
0
def get_post_request_parser() -> ShellArgumentParser:
    """Argparser for the :class:`.shell.MiniProjectShell`
    ``post_request`` command"""
    parser = ShellArgumentParser(prog="post_request",
                                 description="Post a ride request")

    parser.add_argument(
        "date",
        type=date,
        help="Date the ride should start on (eg: 1975-05-21T22:00:00)")
    parser.add_argument("pickup",
                        help="The location code for the pickup location of "
                        "the ride")
    parser.add_argument("dropoff",
                        help="The location code for the dropoff location of "
                        "the ride")
    parser.add_argument("price",
                        type=price,
                        help="The maximum amount you are willing to pay per "
                        "seat for the ride")
    return parser
Пример #9
0
def get_search_for_ride_parser() -> ShellArgumentParser:
    """Argparser for the :class:`.shell.MiniProjectShell`
    ``search_rides`` command"""
    parser = ShellArgumentParser(
        prog="search_rides",
        description="Search for a ride and if one is selected sent a message "
        "of intent to join")

    parser.add_argument("term1",
                        help="Location search term to use to look rides")
    parser.add_argument("term2",
                        nargs='?',
                        default=None,
                        help="Location search term to use to look rides")
    parser.add_argument("term3",
                        nargs='?',
                        default=None,
                        help="Location search term to use to look rides")
    return parser
Пример #10
0
def get_book_member_parser() -> ShellArgumentParser:
    """Argparser for the :class:`.shell.MiniProjectShell`
    ``book_member`` command"""
    parser = ShellArgumentParser(prog="book_member",
                                 description="Book a member on a ride")

    parser.add_argument("email",
                        help="Email of the member who will be booked on "
                        "the ride")
    parser.add_argument("seats",
                        type=greater_than_zero_number,
                        help="The number of seats booked")
    parser.add_argument("price",
                        type=price,
                        help="The cost per seat for the ride")
    parser.add_argument("pickup",
                        help="Keyword for the pickup location of the ride")
    parser.add_argument("dropoff",
                        help="Keyword for the dropoff location of the ride")
    return parser
Пример #11
0
def get_offer_ride_parser() -> ShellArgumentParser:
    """Argparser for the :class:`.shell.MiniProjectShell`
    ``offer_ride`` command"""
    parser = ShellArgumentParser(
        prog="offer_ride",
        description="Offer a ride")

    # date, seats, price, luggage, source, destination, cno, enroute
    parser.add_argument("date", type=date,
                        help="Date the ride should start on (eg: 1975-05-21T22:00:00)")
    parser.add_argument("seats", type=greater_than_zero_number,
                        help="The number of seats offered")
    parser.add_argument("price", type=price,
                        help="The amount you want per seat for the ride")
    parser.add_argument("luggage",
                        help="Description of car luggage")
    parser.add_argument("src",
                        help="Keyword for the start location of the ride")
    parser.add_argument("dst",
                        help="Keyword for the end location of the ride")
    parser.add_argument("--cno", nargs='?', default=None,
                        help="Your car number to use")
    parser.add_argument("--enroute", nargs='+', default=set(),
                        help="Enroute locations to go to")
    return parser