| 1 | 8 | ▶ | use 5.10.0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 8 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 8 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | package Map::Metro::Cmd; | ||
| 6 | |||
| 7 | # ABSTRACT: The command line interface | ||
| 8 | 8 | our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY | |
| 9 | 8 | our $VERSION = '0.2404'; | |
| 10 | |||
| 11 | 8 | ▶ | use MooseX::App qw/Config Color/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 8 | ▶ | use MooseX::AttributeShortcuts; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | 8 | ▶ | use Map::Metro; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 8 | ▶ | use Map::Metro::Shim; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | 8 | app_description 'Command line interface to Map::Metro'; | |
| 18 | |||
| 19 | 8 | app_usage qq{map_metro.pl <command> [ <city> ] [ <arguments> ]}; | |
| 20 | |||
| 21 | 8 | __PACKAGE__->meta->make_immutable; | |
| 22 | |||
| 23 | 8 | 1; | |
| 24 | |||
| 25 | __END__ | ||
| 26 | |||
| 27 | =pod | ||
| 28 | |||
| 29 | =encoding UTF-8 | ||
| 30 | |||
| 31 | =head1 NAME | ||
| 32 | |||
| 33 | Map::Metro::Cmd - The command line interface | ||
| 34 | |||
| 35 | =head1 VERSION | ||
| 36 | |||
| 37 | Version 0.2404, released 2016-04-30. | ||
| 38 | |||
| 39 | =head1 SYNOPSIS | ||
| 40 | |||
| 41 | #* General form | ||
| 42 | $ map-metro.pl <command> [ <city> ] [ <arguments> ] | ||
| 43 | |||
| 44 | #* Prints the route using the PrettyPrinter hook plugin | ||
| 45 | $ map-metro.pl route Stockholm 'Sundbybergs centrum' T-Centralen | ||
| 46 | |||
| 47 | =head1 DESCRIPTION | ||
| 48 | |||
| 49 | This collection of commands exposes several parts of the L<Map::Metro> api. | ||
| 50 | |||
| 51 | =head1 COMMANDS | ||
| 52 | |||
| 53 | If a command takes C<$city>, it is mandatory. Normally it should be a module name in the C<Map::Metro::Plugin::Map> namespace (but only the significant part is necessary). If, however, it contains | ||
| 54 | att least one dot it is assumed to be a file path to a map file. The map file is parsed via L<Map::Metro::Shim>. | ||
| 55 | |||
| 56 | =head2 map-metro.pl all_routes $city | ||
| 57 | |||
| 58 | Does B<route> for all stations in the C<Map::Metro::Plugin::Map::$city> map. This gets exponentially slower with bigger maps. | ||
| 59 | |||
| 60 | =head2 map-metro.pl available | ||
| 61 | |||
| 62 | Lists all installed maps on the system. | ||
| 63 | |||
| 64 | =head2 map-metro.pl graphviz $city --into=$file | ||
| 65 | |||
| 66 | Creates a png via L<GraphViz2>. | ||
| 67 | |||
| 68 | If I<into=$file> is given the png is saved with that filename, otherwise a timestamped file will be saved in the current directory. | ||
| 69 | |||
| 70 | =head2 map-metro.pl lines $city | ||
| 71 | |||
| 72 | Lists all lines in the C<Map::Metro::Plugin::Map::$city> map. | ||
| 73 | |||
| 74 | =head2 map-metro.pl metro_to_tube $city | ||
| 75 | |||
| 76 | Converts C<Map::Metro::Plugin::Map::$city> into a L<Map::Tube> ready xml-file. The file is saved in the current working directory with a timestamped filename. | ||
| 77 | |||
| 78 | =head2 map-metro.pl route $city $from $to | ||
| 79 | |||
| 80 | B<C<$from>> | ||
| 81 | |||
| 82 | Mandatory. The starting station, can be either a station id (integer), or a station name (string). Must be of the same type as B<C<$to>>. Use quotes if the name contains spaces. | ||
| 83 | |||
| 84 | B<C<$to>> | ||
| 85 | |||
| 86 | Mandatory. The finishing station, can be either a station id (integer), or a station name (string). Must be of the same type as B<C<$from>>. Use quotes if the name contains spaces. | ||
| 87 | |||
| 88 | Searches for routes in the C<Map::Metro::Plugin::Map::$city> between C<$from> and C<$to>. | ||
| 89 | |||
| 90 | =head2 map-metro.pl stations $city | ||
| 91 | |||
| 92 | Lists all stations in the C<Map::Metro::Plugin::Map::$city> map. This displays station ids for easy search with B<route>. | ||
| 93 | |||
| 94 | =head2 map-metro.pl help | ||
| 95 | |||
| 96 | It's there if you need it... | ||
| 97 | |||
| 98 | =head1 SOURCE | ||
| 99 | |||
| 100 | L<https://github.com/Csson/p5-Map-Metro> | ||
| 101 | |||
| 102 | =head1 HOMEPAGE | ||
| 103 | |||
| 104 | L<https://metacpan.org/release/Map-Metro> | ||
| 105 | |||
| 106 | =head1 AUTHOR | ||
| 107 | |||
| 108 | Erik Carlsson <info@code301.com> | ||
| 109 | |||
| 110 | =head1 COPYRIGHT AND LICENSE | ||
| 111 | |||
| 112 | This software is copyright (c) 2016 by Erik Carlsson. | ||
| 113 | |||
| 114 | This is free software; you can redistribute it and/or modify it under | ||
| 115 | the same terms as the Perl 5 programming language system itself. | ||
| 116 | |||
| 117 | =cut | ||