Create setup scaffolding

This commit is contained in:
Bartłomiej Pluta
2019-09-24 14:56:32 +02:00
parent 0965ed290e
commit 25df849c19
9 changed files with 62 additions and 92 deletions

View File

@@ -1,13 +1,14 @@
import argparse
import os
def file(file):
return open(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, file)).read()
VERSION = "0.1"
DESCRIPTION = """
Simple Music Notation Processor is a command line tool enabling you to do some music stuff using custom domain-specific language.
"""
class CliParser(object):
def __init__(self):
self.parser = argparse.ArgumentParser(description=DESCRIPTION)
self.parser = argparse.ArgumentParser(description=file("__description__.txt"))
self.parser.add_argument('file', nargs='*', help='a file containing SMNP code')
self.parser.add_argument('-c', '--code', action='append', default=[], type=str, help='a string with SMNP code')
self.parser.add_argument('-m', '--mic', action='store_true', help='test microphone level')
@@ -17,7 +18,7 @@ class CliParser(object):
self.parser.add_argument('--tokens', action='store_true', help='print tokens of parsed code')
self.parser.add_argument('--ast', action='store_true', help='print abstract syntax tree of parsed code')
self.parser.add_argument('--dry-run', action='store_true', help='don\'t execute passed code')
self.parser.version = VERSION
self.parser.version = file("__version__.txt")
def parse(self):
return self.parser.parse_args()