add command param

This commit is contained in:
Alexander Popov 2020-10-05 03:14:05 +03:00
parent 13f5892bdf
commit a9a64937fe
2 changed files with 31 additions and 7 deletions

View File

@ -12,12 +12,40 @@
""" """
import json import json
import click
__author__ = 'Alexander Popov' __author__ = 'Alexander Popov'
__version__ = '0.1.0' __version__ = '1.0.0'
__license__ = 'Unlicense' __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(): def parse_libs():
""" Make libraries list from version.json file """ """ Make libraries list from version.json file """
@ -33,9 +61,4 @@ def parse_libs():
if __name__ == '__main__': if __name__ == '__main__':
libraries = parse_libs() make_output()
for lib in libraries:
print('$MC_DIR/libraries/{0}'.format(lib), end=':')
print('$MC_DIR/versions/$GAME_VERSION/$GAME_VERSION.jar')

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
click==7.1.2