From c5eda25b6186cac932f268586c72ecc9fa9c1787 Mon Sep 17 00:00:00 2001 From: Thibaut Horel Date: Sat, 16 Aug 2014 20:01:10 -0400 Subject: Command line utility: add epilog and version --- pushover.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pushover.py b/pushover.py index 3c82f3d..a62609f 100644 --- a/pushover.py +++ b/pushover.py @@ -16,7 +16,7 @@ # along with this program. If not, see . import time from ConfigParser import RawConfigParser, NoSectionError -from argparse import ArgumentParser +from argparse import ArgumentParser, RawDescriptionHelpFormatter import os import requests @@ -265,7 +265,10 @@ def _get_config(profile='Default', config_path='~/.pushoverrc', def main(): - parser = ArgumentParser(description="Send a message to pushover.") + parser = ArgumentParser(description="Send a message to pushover.", + formatter_class=RawDescriptionHelpFormatter, + epilog=""" +For more details and bug reports, see: https://github.com/Thibauth/python-pushover""") parser.add_argument("--api-token", help="Pushover application token") parser.add_argument("--user-key", "-u", help="Pushover user key") parser.add_argument("message", help="message to send") @@ -278,6 +281,14 @@ def main(): parser.add_argument("--profile", help="profile to read in the\ configuration file (default: Default)", default="Default") + parser.add_argument("--version", "-v", action="version", + help="output version information and exit", + version=""" +%(prog)s 0.2 +Copyright (C) 2013-2014 Thibaut Horel +License GPLv3+: GNU GPL version 3 or later . +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law.""") args = parser.parse_args() Client(args.user_key, None, args.api_token, args.config, -- cgit v1.2.3-70-g09d2