NOAA Observations v0.1.9 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

Functions

Parses and processes the command line arguments

Parses the command line arguments

Types

Functions

main(argv)
main([String.t]) :: :ok | no_return

Parses and processes the command line arguments.

Parameters

  • argv - command line arguments (list)
parse(argv)
parse([String.t]) :: parsed

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 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
  • dark - dark colors
  • dark-alt - dark colors, alternating row colors
  • dark-mult - dark colors, 3 repeating row colors
  • pretty - multicolored
  • pretty-alt - multicolored, alternating row colors
  • pretty-mult - multicolored, 3 repeating row colors
  • cyan - light cyan background
  • yellow - light yellow background
  • green - light green background
  • CYAN - light cyan border
  • YELLOW - light yellow border
  • GREEN - light green border
  • mixed - fillers revealed
  • dotted - slightly colored
  • dotted-alt - slightly colored, alternating row colors
  • dotted-mult - slightly colored, 3 repeating row colors
  • dashed - no colors
  • plain - slightly colored
  • test - no colors
  • bare - no colors
  • barish - like bare but colored
  • green-padded - like green but with extra padding
  • green-unpadded - like green but without padding
  • GREEN-PADDED - like GREEN but with extra padding
  • GREEN-UNPADDED - like GREEN but without padding
  • black-alt - black header, alternating row colors
  • black-mult - black header, 3 repeating row colors
  • green-alt - green header, alternating row colors
  • green-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}