From 308d29247ccff48fa448ee95658fefa690ad538a Mon Sep 17 00:00:00 2001 From: niansa Date: Fri, 10 Apr 2020 00:08:27 +0200 Subject: [PATCH] Added license note stuff to CLI --- cli.py | 7 ++++++ modules/help.py | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 modules/help.py diff --git a/cli.py b/cli.py index 2165829..9970f7d 100755 --- a/cli.py +++ b/cli.py @@ -19,6 +19,13 @@ import sys from intern import main_class if len(sys.argv) == 1: # CLI loop + # Show copyright note + print("pilang Copyright (C) 2020 niansa") + print("This program comes with ABSOLUTELY NO WARRANTY; for details type `warranty'.") + print("This is free software, and you are welcome to redistribute it") + print("under certain conditions; type `license' for details.") + print("") + # Initialise interpreter main = main_class() while True: print(">>> ", end="", flush=True) diff --git a/modules/help.py b/modules/help.py new file mode 100644 index 0000000..a46f480 --- /dev/null +++ b/modules/help.py @@ -0,0 +1,61 @@ +""" +This file is part of pilang. + +pilang is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +pilang is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with pilang. If not, see . +""" +import sys +import rtypes + +licensenote = """pilang - a litttle, fun, weird programming language! +Copyright (C) 2020 niansa + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see .""" + + +class help: + def __init__(self, environ): + self.commands = { + "help": self.cmd_help, + "license": self.cmd_license, + "copyright": self.cmd_license + } + self.environ = environ + + + def processor(self, command, args): + try: + return self.commands[command](args) + except KeyError: + return errors.nochsuchcmd + + def cmd_help(self, args): + return "No documentation yet.." + + def cmd_license(self, args): + return licensenote + + +def adder(registerer): + registerer(help)