-
Notifications
You must be signed in to change notification settings - Fork 9
/
dspbptk
executable file
·62 lines (55 loc) · 3.34 KB
/
dspbptk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env python3
# dspbptk - Dyson Sphere Program Blueprint Toolkit
# Copyright (C) 2021-2022 Johannes Bauer
#
# This file is part of dspbptk.
#
# dspbptk 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; this program is ONLY licensed under
# version 3 of the License, later versions are explicitly excluded.
#
# dspbptk 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/>.
#
# Johannes Bauer <JohannesBauer@gmx.de>
import sys
from MultiCommand import MultiCommand
from ActionBlueprintToJSON import ActionBlueprintToJSON
from ActionJSONToBlueprint import ActionJSONToBlueprint
from ActionDump import ActionDump
from ActionEdit import ActionEdit
mc = MultiCommand()
def genparser(parser):
parser.add_argument("-f", "--force", action = "store_true", help = "Overwrite output file if it exists.")
parser.add_argument("-p", "--pretty-print", action = "store_true", help = "Create a pretty-printed output JSON file.")
parser.add_argument("--ignore-corrupt", action = "store_true", help = "Do not validate the checksum when reading the blueprint file.")
parser.add_argument("-v", "--verbose", action = "count", default = 0, help = "Increase verbosity.")
parser.add_argument("infile", help = "Input blueprint text file")
parser.add_argument("outfile", help = "Output JSON file")
mc.register("bp2json", "Convert a blueprint to JSON", genparser, action = ActionBlueprintToJSON)
def genparser(parser):
parser.add_argument("-f", "--force", action = "store_true", help = "Overwrite output file if it exists.")
parser.add_argument("-v", "--verbose", action = "count", default = 0, help = "Increase verbosity.")
parser.add_argument("infile", help = "Input JSON file")
parser.add_argument("outfile", help = "Output blueprint text file")
mc.register("json2bp", "Convert a JSON document to blueprint", genparser, action = ActionJSONToBlueprint)
def genparser(parser):
parser.add_argument("--ignore-corrupt", action = "store_true", help = "Do not validate the checksum when reading the blueprint file.")
parser.add_argument("-v", "--verbose", action = "count", default = 0, help = "Increase verbosity.")
parser.add_argument("infile", nargs = "+", help = "Input blueprint text file(s)")
mc.register("dump", "Dump some information about a blueprint", genparser, action = ActionDump)
def genparser(parser):
parser.add_argument("-f", "--force", action = "store_true", help = "Overwrite output file if it exists.")
parser.add_argument("--short-desc", metavar = "description", help = "Set short description to this value.")
parser.add_argument("--ignore-corrupt", action = "store_true", help = "Do not validate the checksum when reading the blueprint file.")
parser.add_argument("-v", "--verbose", action = "count", default = 0, help = "Increase verbosity.")
parser.add_argument("infile", help = "Input blueprint text file")
parser.add_argument("outfile", help = "Output blueprint text file")
mc.register("edit", "Edit a blueprint", genparser, action = ActionEdit)
mc.run(sys.argv[1:])