mirror of
https://github.com/vikstrous/pirate-get
synced 2025-01-09 09:59:51 +01:00
Merge pull request #92 from vikstrous/version
Add option to print version number, fix issue #90
This commit is contained in:
commit
5db2e2c0af
@ -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()))
|
||||
|
@ -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'],
|
||||
|
3
setup.py
3
setup.py
@ -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',
|
||||
|
Loading…
Reference in New Issue
Block a user