#! /usr/bin/env python
import sys
import os
import inspect
import log_calls


def usage():
    """
Usage: log_calls-path-to-docs [-h]
    Writes the path to the HTML version of the log_calls documentation.
    -h     Displays this message.
To open the docs in the default browser:
   $ open $(log_calls-path-to-docs)
       on Mac OS X;
   $ xdg-open $(log_calls-path-to-docs)
       on any *nix with xdg-open installed (e.g. most Linuxes),
       otherwise, use an explicit browser -- firefox $(log_calls-path-to-docs);
   $ log_calls-path-to-docs | cmd
       on Windows."""
    exit(usage.__doc__)

if len(sys.argv) > 1:
    arg = sys.argv[1].upper()

    if arg.startswith("-H"):
        usage()     # exits

home, _ = os.path.split(
    inspect.getfile(log_calls)
)
docs_dir = os.path.join(home, 'docs', 'log_calls.html')
print(docs_dir)
