NOAA Observations v0.3.18 NOAA.Observations.CLI View Source

Parses the command line and generates a table of observations from the NOAA Weather Service.

Link to this section Summary

Functions

Parses and processes argv (command line arguments)

Parses argv (command line arguments)

Link to this section Types

Link to this section Functions

Parses and processes argv (command line arguments).

Parameters

  • argv - command line arguments (list)

Parses argv (command line arguments).

argv can be [“-h”] or [“—help”], which returns :help. Otherwise it contains 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. To ring the bell, specify switch --bell. To apply a specific table style, use switch --table-style.

Returns either a tuple of {state, count, bell, table_style} or :help if --help was specified.

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

Table styles

  • bare - no colors
  • barish - like bare but colored
  • cyan - cyan background
  • cyan-alt - cyan header, alternating row colors
  • cyan-border - light cyan border
  • cyan-mult - cyan header, 3 repeating row colors
  • dark - dark colors
  • dark-alt - dark colors, alternating row colors
  • dark-mult - dark colors, 3 repeating row colors
  • dashed - no colors
  • dotted - slightly colored
  • dotted-alt - slightly colored, alternating row colors
  • dotted-mult - slightly colored, 3 repeating row colors
  • game - game board
  • green - green background
  • green-alt - green header, alternating row colors
  • green-border - light green border
  • green-border-padded - light green border with extra padding
  • green-border-unpadded - light green border without padding
  • green-mult - green header, 3 repeating row colors
  • green-padded - like green but with extra padding
  • green-unpadded - like green but without padding
  • light - light colors
  • light-alt - light colors, alternating row colors
  • light-mult - light colors, 3 repeating row colors
  • medium - medium colors
  • medium-alt - medium colors, alternating row colors
  • medium-mult - medium colors, 3 repeating row colors
  • mixed - fillers revealed
  • plain - slightly colored
  • pretty - multicolored
  • pretty-alt - multicolored, alternating row colors
  • pretty-mult - multicolored, 3 repeating row colors
  • test - no colors
  • yellow - light yellow background
  • yellow-border - light yellow border

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}

iex> alias NOAA.Observations.CLI
iex> CLI.parse ["TX", "88", "--last", "--bell"]
{"tx", -88, true, :dark}

iex> alias NOAA.Observations.CLI
iex> CLI.parse ["nc", "6", "--table-style", "cyan"]
{"nc", 6, false, :cyan}