1
0
mirror of https://github.com/vikstrous/pirate-get synced 2025-01-09 09:59:51 +01:00

Add option to print version number, fix issue #90

This commit is contained in:
rnhmjoj 2016-09-20 19:47:27 +02:00
parent 0bc34cf68f
commit 24e77a15b4
No known key found for this signature in database
GPG Key ID: 362BB82B7E496B7C
3 changed files with 12 additions and 1 deletions

View File

@ -5,6 +5,8 @@ import pkgutil
def get_resource(filename):
return pkgutil.get_data(__package__, 'data/' + filename)
version = '0.2.9'
categories = json.loads(get_resource('categories.json').decode())
sorts = json.loads(get_resource('sorts.json').decode())
blacklist = set(json.loads(get_resource('blacklist.json').decode()))

View File

@ -173,6 +173,9 @@ def parse_args(args_in):
parser.add_argument('-m', '--mirror',
type=str, nargs='+',
help='the pirate bay mirror(s) to use')
parser.add_argument('-v', '--version',
action='store_true',
help='print pirate-get version number')
args = parser.parse_args(args_in)
return args
@ -285,6 +288,11 @@ def search_mirrors(printer, args):
def pirate_main(args):
printer = Printer(args.color)
# print version
if args.version:
printer.print('pirate-get, version {}'.format(pirate.data.version))
sys.exit(0)
# check it transmission is running
if args.transmission:
ret = subprocess.call(args.transmission_command + ['-l'],

View File

@ -2,6 +2,7 @@
from setuptools import setup, find_packages
from distutils.version import LooseVersion
import sys
import pirate.data
if LooseVersion(sys.version) < LooseVersion("3.4.0"):
print("pirate-get requires at least python 3.4.0."
@ -10,7 +11,7 @@ if LooseVersion(sys.version) < LooseVersion("3.4.0"):
if __name__ == '__main__':
setup(name='pirate-get',
version='0.2.9',
version=pirate.data.version,
description='A command line interface for The Pirate Bay',
url='https://github.com/vikstrous/pirate-get',
author='vikstrous',