From a9a64937fe522378e3b7e4e7019aedac83101ed9 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Mon, 5 Oct 2020 03:14:05 +0300 Subject: [PATCH] add command param --- make_libs.py | 37 ++++++++++++++++++++++++++++++------- requirements.txt | 1 + 2 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 requirements.txt diff --git a/make_libs.py b/make_libs.py index 70a90f8..77954f7 100755 --- a/make_libs.py +++ b/make_libs.py @@ -12,12 +12,40 @@ """ import json +import click __author__ = 'Alexander Popov' -__version__ = '0.1.0' +__version__ = '1.0.0' __license__ = 'Unlicense' +@click.command() +@click.option('--platform', default='win', + help='Output platform (win, unix).') +def make_output(platform): + """ Return libraries list """ + + libraries = parse_libs() + + _ = { + 'win': ';', + 'unix': ':' + } + + output = str() + + for lib in libraries: + output = output + '$MC_DIR/libraries/{0}'.format(lib) + _[platform] + + output = output + '$MC_DIR/versions/$GAME_VERSION/$GAME_VERSION.jar' + + if platform == 'win': + output = output.replace('$MC_DIR', '%MC_DIR%') + output = output.replace('$GAME_VERSION', '%GAME_VERSION%') + + click.echo(output) + + def parse_libs(): """ Make libraries list from version.json file """ @@ -33,9 +61,4 @@ def parse_libs(): if __name__ == '__main__': - libraries = parse_libs() - - for lib in libraries: - print('$MC_DIR/libraries/{0}'.format(lib), end=':') - - print('$MC_DIR/versions/$GAME_VERSION/$GAME_VERSION.jar') + make_output() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..f7fc59b --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +click==7.1.2