Adds argument parsing for help and version

This commit is contained in:
Abhay Rana 2013-12-01 16:45:12 +05:30
parent 61451d4c3c
commit 0e2d49f811
2 changed files with 17 additions and 2 deletions

View File

@ -7,7 +7,7 @@ import gtk
import requests
import webbrowser
import json
import argparse
from os.path import expanduser
try:
@ -15,6 +15,13 @@ try:
except ImportError:
import appindicator_replacement as appindicator
##This is to get --version to work
try:
import pkg_resources
__version = pkg_resources.require("hackertray")[0].version
except ImportError, e:
__version = "Can't read version number."
from hackernews import HackerNews
class HackerNewsApp:
@ -118,5 +125,8 @@ class HackerNewsApp:
gtk.timeout_add(10*60*1000, self.refresh)
def main():
parser = argparse.ArgumentParser(description='Hacker News in your System Tray')
parser.add_argument('--version', action='version', version=__version)
parser.parse_args()
indicator = HackerNewsApp()
indicator.run()

View File

@ -1,7 +1,12 @@
from setuptools import setup
import sys
requirements = ['requests']
if sys.version_info < (2, 7):
requirements.append('argparse')
setup(name='hackertray',
version='1.8.2',
version='1.8.3',
description='Hacker News app that sits in your System Tray',
long_description='HackerTray is a simple Hacker News Linux application that lets you view top HN stories in your System Tray. It relies on appindicator, so it is not guaranteed to work on all systems. It also provides a Gtk StatusIcon fallback in case AppIndicator is not available.',
keywords='hacker news hn tray system tray icon hackertray',