aboutsummaryrefslogtreecommitdiff
path: root/src/cli.py
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-01-24 17:09:10 +0100
committerCharles <sircharlesaze@gmail.com>2020-01-24 17:09:10 +0100
commitd5e51613d3582e18e858055cf4874507a0df452f (patch)
treee751049eb92fb9930e970ecef00794e86a47b454 /src/cli.py
parentf1cad00d3c8f3a96bc09ffb33f04d0ba670776c0 (diff)
downloaddslr-d5e51613d3582e18e858055cf4874507a0df452f.tar.gz
dslr-d5e51613d3582e18e858055cf4874507a0df452f.tar.bz2
dslr-d5e51613d3582e18e858055cf4874507a0df452f.zip
random stuff
Diffstat (limited to 'src/cli.py')
-rw-r--r--src/cli.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/cli.py b/src/cli.py
new file mode 100644
index 0000000..ec1a324
--- /dev/null
+++ b/src/cli.py
@@ -0,0 +1,29 @@
+class CommandLineInterface:
+ def __init__(self):
+ pass
+
+ def parse_args(self):
+ parse = argparse.ArgumentParser(prog="dslr_cli",
+ description="CLI for the dslr project")
+ subparser = parser.add_subparsers(dest="subparser_name")
+ parser_describe = subparsers.add_parser("describe",
+ help="give useful information about a dataset")
+ parser_describe.add_argument("path", help="path to the dataset")
+ parser_describe.set_defaults(func=self._describe)
+
+ self.args = parser.parse_args(sys.argv[1:])
+
+ def exec_args(self):
+ if self.args.subparser_name is None:
+ print("{} --help for more information".format(sys.argv[0]))
+ return
+ self.args.func()
+
+ def _describe(self):
+ describe.describe(self.args.path)
+
+
+if __name__ == "__main__":
+ cli = CommandLineInterface()
+ cli.parse_args()
+ cli.exec_args()