|
@@ -0,0 +1,30 @@
|
|
1
|
+#! /usr/bin/env python3
|
|
2
|
+
|
|
3
|
+import sys
|
|
4
|
+
|
|
5
|
+import argparse
|
|
6
|
+import pydantic
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+class Options(pydantic.BaseModel):
|
|
10
|
+ config_path: str = pydantic.Field(alias='config')
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+def main(argv):
|
|
14
|
+ default_options = Options(**{
|
|
15
|
+ 'config': './config.yml'
|
|
16
|
+ })
|
|
17
|
+
|
|
18
|
+ parser = argparse.ArgumentParser(description='Some awesome project')
|
|
19
|
+ parser.add_argument('-c', '--config', type=str, default=default_options.config_path, help='Path to config file')
|
|
20
|
+ args = parser.parse_args(argv[1:])
|
|
21
|
+
|
|
22
|
+ options = Options(**vars(args))
|
|
23
|
+
|
|
24
|
+ print(options.config_path)
|
|
25
|
+
|
|
26
|
+ return 0
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+if __name__ == '__main__':
|
|
30
|
+ sys.exit(main(sys.argv))
|