From 72269ffceb0b4897992ba13fede48397a04bf230 Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Tue, 18 Sep 2018 11:47:55 +0200 Subject: [PATCH] Fuck me --- rsi/__main__.py | 10 ++++++++-- scripts/RSI.py | 38 -------------------------------------- setup.py | 2 +- 3 files changed, 9 insertions(+), 41 deletions(-) delete mode 100755 scripts/RSI.py diff --git a/rsi/__main__.py b/rsi/__main__.py index cf05ee7..22662ea 100644 --- a/rsi/__main__.py +++ b/rsi/__main__.py @@ -14,6 +14,8 @@ def main() -> int: _from_dmi = subparser.add_parser("from_dmi", help="Will create an RSI from a BYOND DMI file.") _from_dmi.add_argument("input", help="The DMI file to read from.", type=Path) _from_dmi.add_argument("output", help="The RSI to output to.", type=Path) + _from_dmi.add_argument("-c", "--copyright", help="Specifies the copyright of the new RSI file.") + _from_dmi.add_argument("-l", "--license", help="Specifies the license of the new RSI file.") _new_rsi = subparser.add_parser("new", help="Will create a new RSI at the provided directory.") _new_rsi.add_argument("rsi", help="The location of the new RSI. Must not exist yet.", type=Path) @@ -25,7 +27,7 @@ def main() -> int: args = parser.parse_args() if args.command == "from_dmi": - from_dmi(args.input, args.output) + from_dmi(args.input, args.output, args.license, args.copyright) return 0 if args.command == "new": @@ -35,8 +37,12 @@ def main() -> int: return 1 -def from_dmi(inputf: Path, output: Path) -> None: +def from_dmi(inputf: Path, output: Path, new_license: Optional[str], new_copyright: Optional[str]) -> None: rsi = Rsi.from_dmi(inputf) + if new_license: + rsi.license = new_license + if new_copyright: + rsi.copyright = new_copyright rsi.write(output) diff --git a/scripts/RSI.py b/scripts/RSI.py deleted file mode 100755 index 9a0b7a7..0000000 --- a/scripts/RSI.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -from pathlib import Path -from rsi import Rsi -from typing import Optional - - -def main() -> None: - parser = argparse.ArgumentParser() - subparser = parser.add_subparsers(dest="command") - - _from_dmi = subparser.add_parser("from_dmi", help="Will create an RSI from a BYOND DMI file.") - _from_dmi.add_argument("input", help="The DMI file to read from.", type=Path) - _from_dmi.add_argument("output", help="The RSI to output to.", type=Path) - _from_dmi.add_argument("--license", help="Specifies the license of the new RSI file.") - _from_dmi.add_argument("--copyright", help="Specifies the copyright of the new RSI file.") - - args = parser.parse_args() - - if args.command == "from_dmi": - from_dmi(args.input, args.output, args.license, args.copyright) - return - - print("No command specified!") - - -def from_dmi(inputf: Path, output: Path, new_license: Optional[str], new_copyright: Optional[str]) -> None: - rsi = Rsi.from_dmi(inputf) - if new_license: - rsi.license = new_license - if new_copyright: - rsi.copyright = new_copyright - rsi.write(output) - - -if __name__ == "__main__": - main() diff --git a/setup.py b/setup.py index 0323359..c45a980 100755 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name="RSI.py", - version="1.1.5", + version="1.1.6", description="A library for manipulation of the RSI format used in Space Station 14.", url="https://github.com/space-wizards/RSI.py", author="Pieter-Jan Briers",