summaryrefslogtreecommitdiff
path: root/pysquaredeal.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2024-01-15 15:12:13 +0100
committeremkael <emkael@tlen.pl>2024-01-15 15:15:18 +0100
commit61c0ba6c873db050cdb64c03b3ea8ef453b7d560 (patch)
treefb5998408614f7b05e1d8566d34f38c472efe603 /pysquaredeal.py
parent9917692c976c547a35a027e9e09172d024517eca (diff)
Argument parser with subcommand support
Diffstat (limited to 'pysquaredeal.py')
-rw-r--r--pysquaredeal.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/pysquaredeal.py b/pysquaredeal.py
index 4f12df6..8da8565 100644
--- a/pysquaredeal.py
+++ b/pysquaredeal.py
@@ -1,10 +1,18 @@
-import sys
+import argparse, sys
from squaredeal import SquareDeal
-sd = SquareDeal()
-sd.fromfile(sys.argv[1], encoding=sys.argv[2] if len(sys.argv) > 2 else 'utf-8')
-print(sd.__dict__)
-for phase in sd.phases:
- print(phase.__dict__)
+argparser = argparse.ArgumentParser(prog='pysquaredeal.py')
+
+argparser.add_argument('sqd_file', metavar='SQD_FILE', help='path to SQD file')
+argparser.add_argument('--sqk-file', metavar='SQK_FILE', help='path to SQK file, if not provided, deduced from SQD file', required=False)
+
+subparsers = argparser.add_subparsers(title='command-specific arguments', metavar='COMMAND', dest='command')
+
+argparser_create = subparsers.add_parser('create', help='create new SQD/SQK pair')
+argparser_create.add_argument('--event-name', required=False, metavar='EVENT_NAME', help='event name (description)')
+argparser_create.add_argument('--delayed-information', required=False, metavar='DELAYED_INFO', help='(description of) delayed information')
+
+arguments = argparser.parse_args()
+print(arguments)