NOAA Observations v0.1.8 NOAA.Observations.CLI
Handles the command line parsing and the dispatch to the various functions that end up generating a table of observations from the NOAA Weather Service.
Summary
Types
parsed()
parsed :: {String.t, integer, boolean, IO.ANSI.Table.Style.t, IO.ANSI.Table.Formatter.column_width} | :help
Functions
Parses the command line arguments
.
argv
can be -h
or --help
, which returns :help
. Otherwise it
is a US state/territory code (case-insensitive) and optionally the
number of observations to format (the first n ones). To format the
last n observations, specify switch --last
which will return a
negative count.
Returns either a tuple of
{state, count, bell, table_style, max_width}
or :help
if --help
was given.
Parameters
argv
- command line arguments (list)
Switches
-h
or--help
- for help-l
or--last
- to format the last n observations-b
or--bell
- to ring the bell-t
or--table-style
- to apply a specific table style-m
or--max-width
- to cap column widths
Table styles
light
- light colorslight-alt
- light colors, alternating row colorslight-mult
- light colors, 3 repeating row colorsmedium
- medium colorsmedium-alt
- medium colors, alternating row colorsmedium-mult
- medium colors, 3 repeating row colorsdark
- dark colorsdark-alt
- dark colors, alternating row colorsdark-mult
- dark colors, 3 repeating row colorspretty
- multicoloredpretty-alt
- multicolored, alternating row colorspretty-mult
- multicolored, 3 repeating row colorscyan
- light cyan backgroundyellow
- light yellow backgroundgreen
- light green backgroundCYAN
- light cyan borderYELLOW
- light yellow borderGREEN
- light green bordermixed
- fillers revealeddotted
- slightly coloreddotted-alt
- slightly colored, alternating row colorsdotted-mult
- slightly colored, 3 repeating row colorsdashed
- no colorsplain
- slightly coloredtest
- no colorsbare
- no colorsbarish
- like bare but coloredgreen-padded
- like green but with extra paddinggreen-unpadded
- like green but without paddingGREEN-PADDED
- like GREEN but with extra paddingGREEN-UNPADDED
- like GREEN but without paddingblack-alt
- black header, alternating row colorsblack-mult
- black header, 3 repeating row colorsgreen-alt
- green header, alternating row colorsgreen-mult
- green header, 3 repeating row colors
Examples
iex> alias NOAA.Observations.CLI
iex> CLI.parse(["-h"])
:help
iex> alias NOAA.Observations.CLI
iex> CLI.parse(["vt", "99"])
{"vt", 99, false, :dark, 88}
iex> alias NOAA.Observations.CLI
iex> CLI.parse(["TX", "88", "--last", "--bell"])
{"tx", -88, true, :dark, 88}
iex> alias NOAA.Observations.CLI
iex> CLI.parse(["nc", "6", "--table-style", "cyan"])
{"nc", 6, false, :cyan, 88}