mirror of
https://gitlab.com/niansa/pilang.git
synced 2025-03-06 20:48:26 +01:00
Added license note stuff to CLI
This commit is contained in:
parent
3f0b852e0d
commit
308d29247c
2 changed files with 68 additions and 0 deletions
7
cli.py
7
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)
|
||||
|
|
61
modules/help.py
Normal file
61
modules/help.py
Normal file
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
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 <https://www.gnu.org/licenses/>."""
|
||||
|
||||
|
||||
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)
|
Loading…
Add table
Reference in a new issue