def directions(ctx, features, profile, alternatives, 
               geometries, overview, steps, continue_straight, 
               waypoint_snapping, annotations, language, output):
    """The Mapbox Directions API will show you how to get
       where you're going.

       mapbox directions "[0, 0]" "[1, 1]"

       An access token is required.  See "mapbox --help".
    """

    access_token = (ctx.obj and ctx.obj.get("access_token")) or None

    service = mapbox.Directions(access_token=access_token)

    # The Directions SDK expects False to be
    # a bool, not a str.

    if overview == "False":
        overview = False

    # When using waypoint snapping, the 
    # Directions SDK expects features to be 
    # a list, not a generator.

    if waypoint_snapping is not None:
        features = list(features)

    if annotations:
        annotations = annotations.split(",")

    stdout = click.open_file(output, "w")

    try:
        res = service.directions(
            features,
            profile=profile,
            alternatives=alternatives,
            geometries=geometries,
            overview=overview,
            steps=steps,
            continue_straight=continue_straight,
            waypoint_snapping=waypoint_snapping,
            annotations=annotations,
            language=language
        )
    except mapbox.errors.ValidationError as exc:
        raise click.BadParameter(str(exc))

    if res.status_code == 200:
        if geometries == "geojson":
            click.echo(json.dumps(res.geojson()), file=stdout)
        else:
            click.echo(res.text, file=stdout)
    else:
        raise MapboxCLIException(res.text.strip())
def directions ( ctx , features , profile , alternatives , geometries , overview , steps , continue_straight , waypoint_snapping , annotations , language , output ) : access_token = ( ctx . obj and ctx . obj . get ( "access_token" ) ) or None service = mapbox . Directions ( access_token = access_token ) if overview == "False" : overview = False if waypoint_snapping is not None : features = list ( features ) if annotations : annotations = annotations . split ( "," ) stdout = click . open_file ( output , "w" ) try : res = service . directions ( features , profile = profile , alternatives = alternatives , geometries = geometries , overview = overview , steps = steps , continue_straight = continue_straight , waypoint_snapping = waypoint_snapping , annotations = annotations , language = language ) except mapbox . errors . ValidationError as exc : raise click . BadParameter ( str ( exc ) ) if res . status_code == 200 : if geometries == "geojson" : click . echo ( json . dumps ( res . geojson ( ) ) , file = stdout ) else : click . echo ( res . text , file = stdout ) else : raise MapboxCLIException ( res . text . strip ( ) )
The Mapbox Directions API will show you how to get
       where you're going.

       mapbox directions "[0, 0]" "[1, 1]"

       An access token is required.  See "mapbox --help".