Command line

Note

The documentation in this section is aimed at people wishing to contribute to cupage, and can be skipped if you are simply using the tool from the command line.

cupage.cmdline.USAGE = '%(prog)s checks web pages and displays changes from the last run that match\na given criteria. Its original purpose was to check web pages for new software\nreleases, but it is easily configurable and can be used for other purposes.'

Command line help string, for use with argparse

cupage.cmdline.main()[source]

Main script handler.

cupage.cmdline.add()

Add new site to config.

Parameters:
  • config (str) – Location of config file
  • site (str) – Site helper to match with
  • match_type (str) – Filename match pattern
  • match (str) – Regular expression to use when match_type is re
  • frequency (str) – Update frequency
  • select (str) – Page content to check
  • site – Type of selector to use
  • name (str) – Name for new entry
cupage.cmdline.check()

Check sites for updates.

Parameters:
  • globs (dict) – Global options object
  • config (str) – Location of config file
  • database (str) – Location of database file
  • cache (str) – Location of cache directory
  • write (bool) – Whether to update cache/database
  • force (bool) – Force update regardless of frequency setting
  • frequency (datetime.timedelta) – Update frequency
  • timeout (int) – Network timeout in seconds
  • pages (list of str) – Pages to check
cupage.cmdline.list_conf()

List site definitions in config file.

Parameters:
  • config (str) – Location of config file
  • database (str) – Location of database file
  • match (str) – Display sites matching the given regular expression
  • pages (list of str) – Pages to check
cupage.cmdline.list_sites()

List built-in site matcher definitions.

Parameters:globs (dict) – Global options object
cupage.cmdline.remove()

Remove sites for config file.

Parameters:
  • globs (dict) – Global options object
  • config (str) – Location of config file
  • pages (list of str) – Pages to check

Examples

Parse command line options

>>> options, args = process_command_line()