gibson-cli 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. api/BaseApi.py +45 -0
  2. api/Cli.py +248 -0
  3. bin/gibson.py +16 -0
  4. command/Api.py +31 -0
  5. command/Base.py +28 -0
  6. command/BaseCommand.py +26 -0
  7. command/Build.py +69 -0
  8. command/Code.py +198 -0
  9. command/Conf.py +74 -0
  10. command/Count.py +35 -0
  11. command/Dev.py +121 -0
  12. command/Forget.py +34 -0
  13. command/Import.py +109 -0
  14. command/List.py +61 -0
  15. command/Merge.py +35 -0
  16. command/Model.py +42 -0
  17. command/Models.py +31 -0
  18. command/Modify.py +43 -0
  19. command/Module.py +42 -0
  20. command/New.py +38 -0
  21. command/OpenApi.py +141 -0
  22. command/Question.py +105 -0
  23. command/Remove.py +80 -0
  24. command/Rename.py +71 -0
  25. command/Rewrite.py +107 -0
  26. command/Schema.py +42 -0
  27. command/Schemas.py +31 -0
  28. command/Show.py +37 -0
  29. command/Test.py +42 -0
  30. command/Tests.py +31 -0
  31. command/Tree.py +92 -0
  32. command/WarGames.py +35 -0
  33. command/auth/Auth.py +25 -0
  34. command/auth/Login.py +17 -0
  35. command/auth/Logout.py +7 -0
  36. command/tests/test_command_BaseCommand.py +10 -0
  37. command/tests/test_command_Conf.py +19 -0
  38. conf/Api.py +3 -0
  39. conf/Code.py +9 -0
  40. conf/Custom.py +4 -0
  41. conf/Datastore.py +4 -0
  42. conf/Dependencies.py +24 -0
  43. conf/Dev.py +15 -0
  44. conf/Frameworks.py +7 -0
  45. conf/Modeler.py +3 -0
  46. conf/Paths.py +10 -0
  47. conf/Platform.py +16 -0
  48. conf/Project.py +18 -0
  49. conf/Version.py +2 -0
  50. conf/dev/Api.py +5 -0
  51. conf/dev/Base.py +3 -0
  52. conf/dev/Model.py +3 -0
  53. conf/dev/Schema.py +3 -0
  54. conf/tests/test_conf_Dependencies.py +5 -0
  55. conf/tests/test_conf_Platform.py +7 -0
  56. core/CommandRouter.py +249 -0
  57. core/Configuration.py +418 -0
  58. core/Conversation.py +270 -0
  59. core/Env.py +12 -0
  60. core/Memory.py +148 -0
  61. core/TimeKeeper.py +12 -0
  62. core/utils.py +19 -0
  63. data/default-ref-table.tmpl +4 -0
  64. data/default-table.tmpl +6 -0
  65. db/TableExceptions.py +6 -0
  66. db/tests/test_db_TableExceptions.py +9 -0
  67. dev/Dev.py +92 -0
  68. display/Header.py +6 -0
  69. display/WorkspaceFooter.py +10 -0
  70. display/WorkspaceHeader.py +8 -0
  71. display/tests/test_display_Header.py +9 -0
  72. display/tests/test_display_WorkspaceFooter.py +9 -0
  73. display/tests/test_display_WorkspaceHeader.py +8 -0
  74. gibson_cli-0.1.0.dist-info/METADATA +306 -0
  75. gibson_cli-0.1.0.dist-info/RECORD +102 -0
  76. gibson_cli-0.1.0.dist-info/WHEEL +5 -0
  77. gibson_cli-0.1.0.dist-info/entry_points.txt +2 -0
  78. gibson_cli-0.1.0.dist-info/top_level.txt +12 -0
  79. lang/Python.py +57 -0
  80. lang/tests/test_lang_Python.py +70 -0
  81. services/auth/Server.py +75 -0
  82. services/code/context/schema/DataDictionary.py +12 -0
  83. services/code/context/schema/EntityKeys.py +49 -0
  84. services/code/context/schema/Manager.py +28 -0
  85. services/code/context/schema/tests/test_code_context_schema_DataDictionary.py +8 -0
  86. services/code/context/schema/tests/test_code_context_schema_EntityKeys.py +52 -0
  87. services/code/context/schema/tests/test_code_context_schema_Manager.py +34 -0
  88. services/code/customization/Authenticator.py +51 -0
  89. services/code/customization/BaseCustomization.py +12 -0
  90. services/code/customization/CustomizationManager.py +20 -0
  91. services/code/customization/tests/test_code_customization_Authenticator.py +53 -0
  92. services/code/customization/tests/test_code_customization_BaseCustomization.py +14 -0
  93. structure/Entity.py +115 -0
  94. structure/constraints/ReferenceConstraint.py +36 -0
  95. structure/keys/ForeignKey.py +41 -0
  96. structure/keys/Index.py +64 -0
  97. structure/keys/IndexAttribute.py +14 -0
  98. structure/keys/tests/test_ForeignKey.py +80 -0
  99. structure/keys/tests/test_Index.py +98 -0
  100. structure/keys/tests/test_IndexAttribute.py +17 -0
  101. structure/testing.py +194 -0
  102. structure/tests/test_Entity.py +107 -0
command/Tree.py ADDED
@@ -0,0 +1,92 @@
1
+ import os
2
+
3
+ from .BaseCommand import BaseCommand
4
+
5
+
6
+ class Tree(BaseCommand):
7
+ def execute(self):
8
+ self.conversation.display_project(self.configuration.project.name)
9
+
10
+ if self.configuration.project.dev.base.path is None:
11
+ self.conversation.configure_dev_mode()
12
+ self.conversation.newline()
13
+ exit(1)
14
+
15
+ print(self.configuration.project.dev.base.path)
16
+ base_path = os.path.expandvars(self.configuration.project.dev.base.path)
17
+
18
+ if os.path.isfile(f"{base_path}/BaseModel.py"):
19
+ self.render_file("BaseModel.py", 2, False)
20
+
21
+ if os.path.isfile(f"{base_path}/BaseSchema.py"):
22
+ self.render_file("BaseSchema.py", 2, False)
23
+
24
+ if os.path.isfile(f"{base_path}/Deps.py"):
25
+ self.render_file("Deps.py", 2, False)
26
+
27
+ if os.path.isfile(f"{base_path}/Enums.py"):
28
+ self.render_file("Enums.py", 2, False)
29
+
30
+ if os.path.isfile(f"{base_path}/Session.py"):
31
+ self.render_file("Session.py", 2, False)
32
+
33
+ if os.path.isdir(f"{base_path}/api"):
34
+ self.render_dir("api", 2, False, explanation="FastAPI Application")
35
+ self.list_dir(f"{base_path}/api", 6)
36
+
37
+ if os.path.isdir(f"{base_path}/lib"):
38
+ self.render_dir("lib", 2, False, explanation="GibsonAI Libraries")
39
+ self.list_dir(f"{base_path}/lib", 6)
40
+
41
+ if os.path.isdir(f"{base_path}/model"):
42
+ self.render_dir("model", 2, False, explanation="SQLAlchemy Models")
43
+ self.list_dir(f"{base_path}/model", 6)
44
+
45
+ if os.path.isdir(f"{base_path}/schema"):
46
+ self.render_dir("schema", 2, False, explanation="Pydantic Schemas")
47
+ self.list_dir(f"{base_path}/schema", 6)
48
+
49
+ if os.path.isfile(f"{base_path}/testing.py"):
50
+ self.render_file("testing.py", 2, True)
51
+
52
+ self.conversation.newline()
53
+
54
+ def list_dir(self, path, indent):
55
+ entries = []
56
+ for entry in os.listdir(path):
57
+ if entry not in [".pytest_cache"]:
58
+ if os.path.isdir(path + f"/{entry}"):
59
+ entry += "/"
60
+
61
+ entries.append(entry)
62
+
63
+ entries.sort()
64
+
65
+ for i in range(len(entries)):
66
+ is_last = i == len(entries) - 1
67
+ if entries[i][-1] == "/":
68
+ self.render_dir(entries[i], indent, is_last)
69
+ self.list_dir(path + "/" + entries[i], indent + 4)
70
+ else:
71
+ self.render_file(entries[i], indent, is_last)
72
+
73
+ def render_dir(self, path, indent, is_last, explanation=None):
74
+ char = "-"
75
+ if is_last is True:
76
+ char = "_"
77
+
78
+ if path[-1] != "/":
79
+ path += "/"
80
+
81
+ explain = ""
82
+ if explanation is not None:
83
+ explain = f"<{explanation}> "
84
+
85
+ print(" " * indent + "|" + char * 2 + f" {explain}{path}")
86
+
87
+ def render_file(self, name, indent, is_last):
88
+ char = "-"
89
+ if is_last is True:
90
+ char = "_"
91
+
92
+ print(" " * indent + "|" + char + f" {name}")
command/WarGames.py ADDED
@@ -0,0 +1,35 @@
1
+ import hashlib
2
+ import sys
3
+
4
+ from core.Conversation import Conversation
5
+
6
+ from .BaseCommand import BaseCommand
7
+
8
+
9
+ class WarGames(BaseCommand):
10
+ def execute(self):
11
+ if hashlib.sha256(" ".join(sys.argv[1:]).lower().encode()).hexdigest() != (
12
+ "17dca0c0f6b4fe47e18b34551e3e65d1b91b88c94011be4de552bb64e443f6fc"
13
+ ):
14
+ return False
15
+
16
+ self.conversation.newline()
17
+ self.conversation.type("FALKEN'S WEB\n")
18
+ self.conversation.type("BLACK JACK\n")
19
+ self.conversation.type("GIN RUMMY\n")
20
+ self.conversation.type("HEARTS\n")
21
+ self.conversation.type("BRIDGE\n")
22
+ self.conversation.type("CHECKERS\n")
23
+ self.conversation.type("CHESS\n")
24
+ self.conversation.type("POKER\n")
25
+ self.conversation.type("FIGHTER COMBAT\n")
26
+ self.conversation.type("GUERRILLA ENGAGEMENT\n")
27
+ self.conversation.type("DESERT WARFARE\n")
28
+ self.conversation.type("AIR-TO-GROUND ACTIONS\n")
29
+ self.conversation.type("THEATERWIDE TACTICAL WARFARE\n")
30
+ self.conversation.type("THEATERWIDE BIOTOXIC AND CHEMICAL WARFARE\n")
31
+ self.conversation.newline()
32
+ self.conversation.type("GLOBAL THERMONUCLEAR WAR\n", delay=0.2)
33
+ self.conversation.newline()
34
+
35
+ return True
command/auth/Auth.py ADDED
@@ -0,0 +1,25 @@
1
+ import sys
2
+
3
+ from ..BaseCommand import BaseCommand
4
+ from .Login import Login
5
+ from .Logout import Logout
6
+
7
+
8
+ class Auth(BaseCommand):
9
+ def execute(self):
10
+ if len(sys.argv) != 3:
11
+ self.usage()
12
+ elif sys.argv[2] == "login":
13
+ Login(self.configuration).execute()
14
+ elif sys.argv[2] == "logout":
15
+ Logout(self.configuration).execute()
16
+ else:
17
+ self.usage()
18
+
19
+ def usage(self):
20
+ self.conversation.type(
21
+ f"usage: {self.configuration.command} auth login\n"
22
+ + f" or: {self.configuration.command} auth logout\n"
23
+ )
24
+ self.conversation.newline()
25
+ exit(1)
command/auth/Login.py ADDED
@@ -0,0 +1,17 @@
1
+ from api.Cli import Cli
2
+
3
+ from ..BaseCommand import BaseCommand
4
+
5
+
6
+ class Login(BaseCommand):
7
+ def execute(self):
8
+ cli = Cli(self.configuration)
9
+ token = cli.login()
10
+
11
+ if token is None:
12
+ self.conversation.type("Login failed, please try again.")
13
+ else:
14
+ self.configuration.set_access_token(token)
15
+ self.conversation.type(f"Welcome! You are now logged in.")
16
+
17
+ self.conversation.newline()
command/auth/Logout.py ADDED
@@ -0,0 +1,7 @@
1
+ from ..BaseCommand import BaseCommand
2
+
3
+
4
+ class Logout(BaseCommand):
5
+ def execute(self):
6
+ self.configuration.set_access_token(None)
7
+ self.conversation.type(f"You are now logged out.")
@@ -0,0 +1,10 @@
1
+ from command.BaseCommand import BaseCommand
2
+ from core.Configuration import Configuration
3
+
4
+
5
+ def test_customization_management():
6
+ command = BaseCommand(Configuration())
7
+
8
+ assert command.customization_management_is_enabled() is True
9
+ command.disable_customization_management()
10
+ assert command.customization_management_is_enabled() is False
@@ -0,0 +1,19 @@
1
+ from command.Conf import Conf
2
+ from core.Configuration import Configuration
3
+
4
+
5
+ def test_get_configuration_keys():
6
+ assert Conf(Configuration()).get_configuration_keys() == [
7
+ "api::key",
8
+ "code::custom::model::class",
9
+ "code::custom::model::path",
10
+ "code::frameworks::api",
11
+ "code::frameworks::model",
12
+ "code::frameworks::revision",
13
+ "code::frameworks::schema",
14
+ "code::frameworks::test",
15
+ "code::language",
16
+ "datastore::type",
17
+ "datastore::uri",
18
+ "meta::project::description",
19
+ ]
conf/Api.py ADDED
@@ -0,0 +1,3 @@
1
+ class Api:
2
+ def __init__(self):
3
+ self.key = None
conf/Code.py ADDED
@@ -0,0 +1,9 @@
1
+ from .Custom import Custom
2
+ from .Frameworks import Frameworks
3
+
4
+
5
+ class Code:
6
+ def __init__(self):
7
+ self.custom = Custom()
8
+ self.frameworks = Frameworks()
9
+ self.language = None
conf/Custom.py ADDED
@@ -0,0 +1,4 @@
1
+ class Custom:
2
+ def __init__(self):
3
+ self.model_class = None
4
+ self.model_path = None
conf/Datastore.py ADDED
@@ -0,0 +1,4 @@
1
+ class Datastore:
2
+ def __init__(self):
3
+ self.type = None
4
+ self.uri = None
conf/Dependencies.py ADDED
@@ -0,0 +1,24 @@
1
+ import importlib
2
+
3
+
4
+ class Dependencies:
5
+ def __init__(self):
6
+ self.api = "fastapi==0.85"
7
+ self.model = "sqlalchemy==1.4"
8
+ self.revision = "alembic==1.12"
9
+ self.schema = "pydantic==2.6"
10
+ self.test = "pytest==7.1"
11
+
12
+ def compute(self):
13
+ self.api = f"fastapi=={self.get_package_version('fastapi', '0.85')}"
14
+ self.model = f"sqlalchemy=={self.get_package_version('sqlalchemy', '1.4')}"
15
+ self.revision = f"alembic=={self.get_package_version('alembic', '1.12')}"
16
+ self.schema = f"pydantic=={self.get_package_version('pydantic', '2.6')}"
17
+ self.test = f"pytest=={self.get_package_version('pytest', '7.1')}"
18
+ return self
19
+
20
+ def get_package_version(self, name, default):
21
+ try:
22
+ return importlib.metadata.version(name)
23
+ except importlib.metadata.PackageNotFoundError:
24
+ return default
conf/Dev.py ADDED
@@ -0,0 +1,15 @@
1
+ import os
2
+
3
+ from conf.dev.Api import Api
4
+ from conf.dev.Base import Base
5
+ from conf.dev.Model import Model
6
+ from conf.dev.Schema import Schema
7
+
8
+
9
+ class Dev:
10
+ def __init__(self):
11
+ self.active = False
12
+ self.api = Api()
13
+ self.base = Base()
14
+ self.model = Model()
15
+ self.schema = Schema()
conf/Frameworks.py ADDED
@@ -0,0 +1,7 @@
1
+ class Frameworks:
2
+ def __init__(self):
3
+ self.api = None
4
+ self.model = None
5
+ self.revision = None
6
+ self.schema = None
7
+ self.test = None
conf/Modeler.py ADDED
@@ -0,0 +1,3 @@
1
+ class Modeler:
2
+ def __init__(self):
3
+ self.version = None
conf/Paths.py ADDED
@@ -0,0 +1,10 @@
1
+ class ConfigPaths:
2
+ def __init__(self):
3
+ self.auth = None
4
+
5
+
6
+ class ProjectPaths:
7
+ def __init__(self):
8
+ self.config = None
9
+ self.memory = None
10
+ self.top = None
conf/Platform.py ADDED
@@ -0,0 +1,16 @@
1
+ import os
2
+ import platform
3
+ import subprocess
4
+
5
+
6
+ class Platform:
7
+ def __init__(self):
8
+ self.system = platform.system().lower()
9
+
10
+ def cmd_clear(self):
11
+ if self.system == "windows":
12
+ os.system("cls")
13
+ else:
14
+ subprocess.call("/usr/bin/clear")
15
+
16
+ return self
conf/Project.py ADDED
@@ -0,0 +1,18 @@
1
+ from .Api import Api
2
+ from .Code import Code
3
+ from .Datastore import Datastore
4
+ from .Dev import Dev
5
+ from .Modeler import Modeler
6
+ from .Paths import ProjectPaths
7
+
8
+
9
+ class Project:
10
+ def __init__(self):
11
+ self.api = Api()
12
+ self.code = Code()
13
+ self.datastore = Datastore()
14
+ self.description = None
15
+ self.dev = Dev()
16
+ self.modeler = Modeler()
17
+ self.name = None
18
+ self.paths = ProjectPaths()
conf/Version.py ADDED
@@ -0,0 +1,2 @@
1
+ class Version:
2
+ NUM = "0.1.0"
conf/dev/Api.py ADDED
@@ -0,0 +1,5 @@
1
+ class Api:
2
+ def __init__(self, path=None, prefix=None, version=None):
3
+ self.path = path
4
+ self.prefix = prefix
5
+ self.version = version
conf/dev/Base.py ADDED
@@ -0,0 +1,3 @@
1
+ class Base:
2
+ def __init__(self, path=None):
3
+ self.path = path
conf/dev/Model.py ADDED
@@ -0,0 +1,3 @@
1
+ class Model:
2
+ def __init__(self, path=None):
3
+ self.path = path
conf/dev/Schema.py ADDED
@@ -0,0 +1,3 @@
1
+ class Schema:
2
+ def __init__(self, path=None):
3
+ self.path = path
@@ -0,0 +1,5 @@
1
+ from conf.Dependencies import Dependencies
2
+
3
+
4
+ def test_compute():
5
+ dependencies = Dependencies().compute()
@@ -0,0 +1,7 @@
1
+ import platform
2
+
3
+ from conf.Platform import Platform
4
+
5
+
6
+ def test_system():
7
+ assert Platform().system == platform.system().lower()
core/CommandRouter.py ADDED
@@ -0,0 +1,249 @@
1
+ import sys
2
+
3
+ from command.Api import Api
4
+ from command.auth.Auth import Auth
5
+ from command.Base import Base
6
+ from command.Build import Build
7
+ from command.Code import Code
8
+ from command.Conf import Conf
9
+ from command.Count import Count
10
+ from command.Dev import Dev
11
+ from command.Forget import Forget
12
+ from command.Import import Import
13
+ from command.List import List
14
+ from command.Merge import Merge
15
+ from command.Model import Model
16
+ from command.Models import Models
17
+ from command.Modify import Modify
18
+ from command.Module import Module
19
+ from command.New import New
20
+ from command.OpenApi import OpenApi
21
+ from command.Question import Question
22
+ from command.Remove import Remove
23
+ from command.Rename import Rename
24
+ from command.Rewrite import Rewrite
25
+ from command.Schema import Schema
26
+ from command.Schemas import Schemas
27
+ from command.Show import Show
28
+ from command.Test import Test
29
+ from command.Tests import Tests
30
+ from command.Tree import Tree
31
+ from command.WarGames import WarGames
32
+ from .Configuration import Configuration
33
+ from .Conversation import Conversation
34
+ from .Env import Env
35
+ from .Memory import Memory
36
+
37
+
38
+ class CommandRouter:
39
+ def __init__(self, configuration: Configuration):
40
+ self.configuration = configuration
41
+ self.conversation = Conversation()
42
+
43
+ def help(self, exit_code=0):
44
+ dev_off = "*"
45
+ dev_on = ""
46
+ if self.configuration.project.dev.active is True:
47
+ dev_off = ""
48
+ dev_on = "*"
49
+
50
+ commands = {
51
+ "api": {
52
+ "description": "write the API code for the project",
53
+ "memory": "stored",
54
+ },
55
+ "auth": {
56
+ "description": "login | logout",
57
+ "memory": None,
58
+ },
59
+ "base": {
60
+ "description": "write the base code for the project",
61
+ "memory": "stored",
62
+ },
63
+ "build": {
64
+ "description": "create the entities in the datastore",
65
+ "memory": "stored",
66
+ },
67
+ "code": {"description": "pair program", "memory": None},
68
+ "conf": {"description": "set a configuration variable", "memory": None},
69
+ "count": {
70
+ "description": "show the number of entities stored",
71
+ "memory": "last | stored",
72
+ },
73
+ "dev": {
74
+ "description": f"mode off{dev_off} | on{dev_on}",
75
+ "memory": None,
76
+ },
77
+ "forget": {
78
+ "description": "delete memory",
79
+ "memory": "all | last | stored",
80
+ },
81
+ "help": {"description": "for help", "memory": None},
82
+ "import": {
83
+ "description": "configure from a data source",
84
+ "memory": "stored",
85
+ },
86
+ "list": {
87
+ "description": "show the names of entities in your project",
88
+ "memory": None,
89
+ },
90
+ "merge": {
91
+ "description": "move last changes into project",
92
+ "memory": "last -> stored",
93
+ },
94
+ "model": {
95
+ "description": "write the model code for an entity",
96
+ "memory": "stored",
97
+ },
98
+ "models": {
99
+ "description": "write all the model code",
100
+ "memory": "stored",
101
+ },
102
+ "modify": {
103
+ "description": "change an entity using natural language",
104
+ "memory": "last > stored",
105
+ },
106
+ "module": {"description": "create a new module", "memory": "last"},
107
+ "new": {"description": "start something new", "memory": None},
108
+ "openapi": {"description": "build from an OpenAPI spec", "memory": "last"},
109
+ "remove": {
110
+ "description": "remove an entity from the project",
111
+ "memory": "last > stored",
112
+ },
113
+ "rename": {
114
+ "description": "rename an entity",
115
+ "memory": "last > stored",
116
+ },
117
+ "rewrite": {
118
+ "description": "rewrite all code from scratch",
119
+ "memory": "stored",
120
+ },
121
+ "schema": {
122
+ "description": "write the schema code for an entity",
123
+ "memory": "stored",
124
+ },
125
+ "schemas": {
126
+ "description": "write all the schema code",
127
+ "memory": "stored",
128
+ },
129
+ "show": {"description": "display an entity", "memory": "last > stored"},
130
+ "test": {
131
+ "description": "write the unit tests for an entity",
132
+ "memory": "stored",
133
+ },
134
+ "tests": {
135
+ "description": "write all the unit tests",
136
+ "memory": "stored",
137
+ },
138
+ "tree": {"description": "illustrate the project layout", "memory": None},
139
+ "? | q": {"description": "ask a question", "memory": None},
140
+ }
141
+
142
+ self.conversation.set_delay(0.001)
143
+ self.conversation.display_project(self.configuration.project.name)
144
+ self.conversation.type(f"usage: {self.configuration.command} [command]\n\n")
145
+ self.conversation.type(" command description" + " " * 40 + "memory\n")
146
+ self.conversation.type(" ------- -----------" + " " * 40 + "------\n")
147
+
148
+ for command, config in commands.items():
149
+ memory = ""
150
+ if config["memory"] is not None:
151
+ memory = f"[{config['memory']}]"
152
+
153
+ spaces = 61 - (8 + 2 + len(config["description"]))
154
+
155
+ self.conversation.type(
156
+ f"{command.rjust(8)}"
157
+ + f" {config['description']}"
158
+ + " " * spaces
159
+ + f"{memory}\n"
160
+ )
161
+
162
+ self.conversation.newline()
163
+ self.conversation.type("memory:\n\n")
164
+
165
+ stats = Memory(self.configuration).stats()
166
+ self.conversation.type(
167
+ f"{str(stats['entities']['num']).rjust(8)}"
168
+ + f" {stats['entities']['word']}"
169
+ + " " * (43 if stats["entities"]["word"] == "entities" else 45)
170
+ + "[stored]\n"
171
+ )
172
+ self.conversation.type(
173
+ f"{str(stats['last']['num']).rjust(8)}"
174
+ + f" {stats['last']['word']}"
175
+ + " " * (43 if stats["last"]["word"] == "entities" else 45)
176
+ + "[last]\n\n"
177
+ )
178
+
179
+ exit(exit_code)
180
+
181
+ def run(self):
182
+ if len(sys.argv) == 1 or sys.argv[1] == "help":
183
+ self.help()
184
+ return self
185
+
186
+ Env().verify(self.configuration)
187
+
188
+ command = None
189
+ if sys.argv[1] == "api":
190
+ command = Api(self.configuration)
191
+ elif sys.argv[1] == "auth":
192
+ command = Auth(self.configuration)
193
+ elif sys.argv[1] == "base":
194
+ command = Base(self.configuration)
195
+ elif sys.argv[1] == "build":
196
+ command = Build(self.configuration)
197
+ elif sys.argv[1] == "code":
198
+ command = Code(self.configuration)
199
+ elif sys.argv[1] == "conf":
200
+ command = Conf(self.configuration)
201
+ elif sys.argv[1] == "count":
202
+ command = Count(self.configuration)
203
+ elif sys.argv[1] == "dev":
204
+ command = Dev(self.configuration)
205
+ elif sys.argv[1] == "forget":
206
+ command = Forget(self.configuration)
207
+ elif sys.argv[1] == "import":
208
+ command = Import(self.configuration)
209
+ elif sys.argv[1] == "list":
210
+ command = List(self.configuration)
211
+ elif sys.argv[1] == "merge":
212
+ command = Merge(self.configuration)
213
+ elif sys.argv[1] == "model":
214
+ command = Model(self.configuration)
215
+ elif sys.argv[1] == "models":
216
+ command = Models(self.configuration)
217
+ elif sys.argv[1] == "modify":
218
+ command = Modify(self.configuration)
219
+ elif sys.argv[1] == "module":
220
+ command = Module(self.configuration)
221
+ elif sys.argv[1] == "new":
222
+ command = New(self.configuration)
223
+ elif sys.argv[1] == "openapi":
224
+ command = OpenApi(self.configuration)
225
+ elif sys.argv[1] == "remove":
226
+ command = Remove(self.configuration)
227
+ elif sys.argv[1] == "rename":
228
+ command = Rename(self.configuration)
229
+ elif sys.argv[1] == "rewrite":
230
+ command = Rewrite(self.configuration, with_header=True)
231
+ elif sys.argv[1] == "schema":
232
+ command = Schema(self.configuration)
233
+ elif sys.argv[1] == "schemas":
234
+ command = Schemas(self.configuration)
235
+ elif sys.argv[1] == "show":
236
+ command = Show(self.configuration)
237
+ elif sys.argv[1] == "test":
238
+ command = Test(self.configuration)
239
+ elif sys.argv[1] == "tests":
240
+ command = Tests(self.configuration)
241
+ elif sys.argv[1] == "tree":
242
+ command = Tree(self.configuration)
243
+ elif sys.argv[1] in ["?", "q"]:
244
+ command = Question(self.configuration)
245
+ else:
246
+ command = WarGames(self.configuration)
247
+
248
+ if command is None or command.execute() is False:
249
+ self.help(exit_code=1)