gibson-cli 0.7.4__tar.gz → 0.7.5__tar.gz
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.
- {gibson_cli-0.7.4/gibson_cli.egg-info → gibson_cli-0.7.5}/PKG-INFO +1 -1
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/code/Entity.py +58 -31
- gibson_cli-0.7.5/gibson/core/Diff.py +34 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/display/Header.py +3 -1
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/display/WorkspaceHeader.py +2 -2
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/display/tests/test_display_Header.py +2 -2
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/display/tests/test_display_WorkspaceHeader.py +1 -1
- {gibson_cli-0.7.4 → gibson_cli-0.7.5/gibson_cli.egg-info}/PKG-INFO +1 -1
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson_cli.egg-info/SOURCES.txt +1 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/pyproject.toml +1 -1
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/.gitignore +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/.pre-commit-config.yaml +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/README.md +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/bin/build.sh +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/bin/clean.sh +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/bin/release.sh +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/api/BaseApi.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/api/Cli.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/api/ProjectApi.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/bin/gibson.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/BaseCommand.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/Build.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/Conf.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/Count.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/Dev.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/Forget.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/Help.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/Merge.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/Modify.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/Question.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/Remove.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/Show.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/Tree.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/Version.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/WarGames.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/auth/Auth.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/auth/Login.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/auth/Logout.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/code/Api.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/code/Base.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/code/Code.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/code/Model.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/code/Models.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/code/Schema.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/code/Schemas.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/code/Test.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/code/Tests.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/importer/Import.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/importer/OpenApi.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/list/Entities.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/list/List.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/list/Projects.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/new/Module.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/new/New.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/new/Project.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/rename/Entity.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/rename/Rename.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/rewrite/Rewrite.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/tests/test_command_BaseCommand.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/command/tests/test_command_Conf.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/conf/Api.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/conf/Code.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/conf/Custom.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/conf/Datastore.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/conf/Dependencies.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/conf/Dev.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/conf/Frameworks.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/conf/Modeler.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/conf/Paths.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/conf/Platform.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/conf/Project.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/conf/Version.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/conf/dev/Api.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/conf/dev/Base.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/conf/dev/Model.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/conf/dev/Schema.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/conf/tests/test_conf_Dependencies.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/conf/tests/test_conf_Platform.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/core/Colors.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/core/CommandRouter.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/core/Completions.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/core/Configuration.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/core/Conversation.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/core/Env.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/core/Memory.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/core/PythonPath.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/core/Spinner.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/core/TimeKeeper.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/core/utils.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/data/bash-completion.tmpl +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/data/mysql/default-ref-table.tmpl +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/data/mysql/default-table.tmpl +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/data/postgresql/default-ref-table.tmpl +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/data/postgresql/default-table.tmpl +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/db/TableExceptions.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/db/tests/test_db_TableExceptions.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/dev/Dev.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/display/WorkspaceFooter.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/display/tests/test_display_WorkspaceFooter.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/lang/Python.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/lang/tests/test_lang_Python.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/services/auth/Server.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/services/code/context/schema/DataDictionary.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/services/code/context/schema/EntityKeys.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/services/code/context/schema/Manager.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/services/code/context/schema/tests/test_code_context_schema_DataDictionary.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/services/code/context/schema/tests/test_code_context_schema_EntityKeys.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/services/code/context/schema/tests/test_code_context_schema_Manager.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/services/code/customization/Authenticator.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/services/code/customization/BaseCustomization.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/services/code/customization/CustomizationManager.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/services/code/customization/Index.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/services/code/customization/tests/test_code_customization_Authenticator.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/services/code/customization/tests/test_code_customization_BaseCustomization.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/structure/Entity.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/structure/mysql/Entity.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/structure/mysql/constraints/ReferenceConstraint.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/structure/mysql/keys/ForeignKey.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/structure/mysql/keys/Index.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/structure/mysql/keys/IndexAttribute.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/structure/mysql/keys/tests/test_structure_mysql_keys_ForeignKey.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/structure/mysql/keys/tests/test_structure_mysql_keys_Index.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/structure/mysql/keys/tests/test_structure_mysql_keys_IndexAttribute.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/structure/mysql/testing.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/structure/mysql/tests/test_structure_mysql_Entity.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/structure/postgresql/Entity.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/structure/postgresql/References.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/structure/postgresql/table/ForeignKey.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/structure/postgresql/table/tests/test_structure_postgresql_table_ForeignKey.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/structure/postgresql/testing.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/structure/postgresql/tests/test_structure_postgresql_Entity.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/structure/tests/test_structure_Entity.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/tests/test_Env.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/tests/test_Memory.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/tests/test_utils.py +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson_cli.egg-info/dependency_links.txt +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson_cli.egg-info/entry_points.txt +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson_cli.egg-info/requires.txt +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson_cli.egg-info/top_level.txt +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/requirements.txt +0 -0
- {gibson_cli-0.7.4 → gibson_cli-0.7.5}/setup.cfg +0 -0
@@ -1,3 +1,5 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
1
3
|
import os
|
2
4
|
import sys
|
3
5
|
from string import Template
|
@@ -10,6 +12,7 @@ from gibson.command.code.Schema import Schema
|
|
10
12
|
from gibson.command.code.Test import Test
|
11
13
|
from gibson.command.Merge import Merge
|
12
14
|
from gibson.core.Configuration import Configuration
|
15
|
+
from gibson.core.Diff import additions, diff
|
13
16
|
from gibson.core.Spinner import ComputingSpinner, Spinner
|
14
17
|
from gibson.display.Header import Header
|
15
18
|
from gibson.display.WorkspaceFooter import WorkspaceFooter
|
@@ -60,34 +63,15 @@ class Entity(BaseCommand):
|
|
60
63
|
|
61
64
|
return True
|
62
65
|
|
63
|
-
def configure_definition(self):
|
64
|
-
existing_entity = self.memory.recall_entity(sys.argv[3])
|
65
|
-
if existing_entity is not None:
|
66
|
-
return existing_entity["definition"]
|
67
|
-
|
68
|
-
parts = sys.argv[3].split("_")
|
69
|
-
if len(parts) > 1 and parts[1] == "ref":
|
70
|
-
# This is a reference table implementation. We will handle this here.
|
71
|
-
with open(self.get_default_ref_table_template_path()) as f:
|
72
|
-
definition = Template(f.read()).substitute({"entity_name": sys.argv[3]})
|
73
|
-
|
74
|
-
self.memory.append_last({"definition": definition, "name": sys.argv[3]})
|
75
|
-
|
76
|
-
self.conversation.type(
|
77
|
-
"Reference table created and stored in last memory. What's next?\n"
|
78
|
-
)
|
79
|
-
self.conversation.newline()
|
80
|
-
|
81
|
-
exit(1)
|
82
|
-
|
83
|
-
with open(self.get_default_table_template_path()) as f:
|
84
|
-
return Template(f.read()).substitute({"entity_name": sys.argv[3]})
|
85
|
-
|
86
66
|
def execute(self):
|
87
67
|
cli = Cli(self.configuration)
|
88
|
-
|
89
|
-
self.
|
90
|
-
definition =
|
68
|
+
entity_name = sys.argv[3]
|
69
|
+
existing_entity = self.memory.recall_entity(entity_name)
|
70
|
+
definition = (
|
71
|
+
existing_entity["definition"]
|
72
|
+
if existing_entity
|
73
|
+
else self.template_definition(entity_name)
|
74
|
+
)
|
91
75
|
|
92
76
|
with ComputingSpinner():
|
93
77
|
self.__context = CodeContextSchemaManager().from_code_writer_schema_context(
|
@@ -104,10 +88,19 @@ class Entity(BaseCommand):
|
|
104
88
|
.instantiate(self.configuration.project.datastore.type)
|
105
89
|
.import_from_struct(data)
|
106
90
|
)
|
91
|
+
original_entity = entity if existing_entity else None
|
92
|
+
original_model_code = (
|
93
|
+
data["code"][0]["definition"] if existing_entity else None
|
94
|
+
)
|
107
95
|
|
108
96
|
while True:
|
109
97
|
try:
|
110
|
-
self.__render_workspace(
|
98
|
+
self.__render_workspace(
|
99
|
+
original_entity,
|
100
|
+
entity,
|
101
|
+
original_model_code,
|
102
|
+
data["code"][0]["definition"],
|
103
|
+
)
|
111
104
|
input_ = input("> ")
|
112
105
|
if input_.lower() in [":q", ":q!", ":wq"]:
|
113
106
|
self.conversation.newline()
|
@@ -185,8 +178,24 @@ class Entity(BaseCommand):
|
|
185
178
|
+ "/default-table.tmpl"
|
186
179
|
)
|
187
180
|
|
188
|
-
def __render_workspace(
|
181
|
+
def __render_workspace(
|
182
|
+
self,
|
183
|
+
original_entity: StructureEntity | None,
|
184
|
+
entity: StructureEntity,
|
185
|
+
original_model_code: str | None,
|
186
|
+
model_code: str,
|
187
|
+
):
|
189
188
|
self.configuration.platform.cmd_clear()
|
189
|
+
create_table_statement_diff = (
|
190
|
+
diff(original_entity.create_statement(), entity.create_statement())
|
191
|
+
if original_entity
|
192
|
+
else additions(entity.create_statement())
|
193
|
+
)
|
194
|
+
model_code_diff = (
|
195
|
+
diff(original_model_code, model_code)
|
196
|
+
if original_model_code
|
197
|
+
else additions(model_code)
|
198
|
+
)
|
190
199
|
|
191
200
|
print("")
|
192
201
|
print(WorkspaceHeader().render(self.configuration.project.name))
|
@@ -194,11 +203,29 @@ class Entity(BaseCommand):
|
|
194
203
|
print("")
|
195
204
|
print(Header().render("SQL", Colors.cyan))
|
196
205
|
print("")
|
197
|
-
print(Colors.table(
|
206
|
+
print(Colors.table(create_table_statement_diff, entity.name))
|
198
207
|
|
199
208
|
print("")
|
200
209
|
print(Header().render("Model", Colors.yellow))
|
201
210
|
print("")
|
202
|
-
print(Colors.model(
|
203
|
-
|
211
|
+
print(Colors.model(model_code_diff, entity.name))
|
204
212
|
print(WorkspaceFooter().render())
|
213
|
+
|
214
|
+
def template_definition(self, entity_name):
|
215
|
+
parts = entity_name.split("_")
|
216
|
+
if len(parts) > 1 and parts[1] == "ref":
|
217
|
+
# This is a reference table implementation. We will handle this here.
|
218
|
+
with open(self.get_default_ref_table_template_path()) as f:
|
219
|
+
definition = Template(f.read()).substitute({"entity_name": entity_name})
|
220
|
+
|
221
|
+
self.memory.append_last({"definition": definition, "name": entity_name})
|
222
|
+
|
223
|
+
self.conversation.type(
|
224
|
+
"Reference table created and stored in last memory. What's next?\n"
|
225
|
+
)
|
226
|
+
self.conversation.newline()
|
227
|
+
|
228
|
+
exit(1)
|
229
|
+
|
230
|
+
with open(self.get_default_table_template_path()) as f:
|
231
|
+
return Template(f.read()).substitute({"entity_name": entity_name})
|
@@ -0,0 +1,34 @@
|
|
1
|
+
from difflib import Differ
|
2
|
+
|
3
|
+
from gibson.core.Colors import green, red
|
4
|
+
|
5
|
+
|
6
|
+
# Highlights all lines as additions with a green + at the beginning
|
7
|
+
# This keeps visual clutter to a minimum when showing the diff of an entirely new entity
|
8
|
+
def additions(input: str):
|
9
|
+
lines = input.splitlines(keepends=True)
|
10
|
+
result = []
|
11
|
+
for line in lines:
|
12
|
+
result.append(f"{green('+')} {line}")
|
13
|
+
return "".join(result)
|
14
|
+
|
15
|
+
|
16
|
+
# Highlights the diffs between two strings, showing the additions and removals as distinct colored lines
|
17
|
+
def diff(original: str, modified: str):
|
18
|
+
diffs = list(
|
19
|
+
Differ().compare(
|
20
|
+
original.splitlines(keepends=True), modified.splitlines(keepends=True)
|
21
|
+
)
|
22
|
+
)
|
23
|
+
|
24
|
+
result = []
|
25
|
+
for line in diffs:
|
26
|
+
if line.startswith("+ "):
|
27
|
+
result.append(green(line))
|
28
|
+
elif line.startswith("- "):
|
29
|
+
result.append(red(line))
|
30
|
+
elif line.startswith(" "):
|
31
|
+
result.append(line)
|
32
|
+
# Ignore lines starting with '? ' as they are not needed for this highlighting
|
33
|
+
|
34
|
+
return "".join(result)
|
@@ -1,9 +1,11 @@
|
|
1
1
|
import math
|
2
2
|
|
3
|
+
from gibson.core.Colors import bold
|
4
|
+
|
3
5
|
|
4
6
|
class Header:
|
5
7
|
def render(self, text, colorizer=None):
|
6
8
|
output = text if colorizer is None else colorizer(text)
|
7
9
|
half = math.floor((78 - len(text)) / 2) # 80 line length - 2 spaces
|
8
|
-
header = "/" * half + f" {output} " + "/" * half
|
10
|
+
header = "/" * half + f" {bold(output)} " + "/" * half
|
9
11
|
return header
|
@@ -5,7 +5,7 @@ class WorkspaceHeader:
|
|
5
5
|
def render(self, project_name):
|
6
6
|
return (
|
7
7
|
f"Project {project_name}".ljust(50)
|
8
|
-
+ " " *
|
9
|
-
+ "
|
8
|
+
+ " " * 14
|
9
|
+
+ f"{Colors.bold('PAIR PROGRAMMER')}\n"
|
10
10
|
+ "-" * 79
|
11
11
|
).replace(project_name, Colors.project(project_name))
|
@@ -5,8 +5,8 @@ from gibson.display.Header import Header
|
|
5
5
|
def test_render():
|
6
6
|
text = "abc def ghi"
|
7
7
|
assert Header().render(text) == (
|
8
|
-
"/////////////////////////////////
|
8
|
+
f"///////////////////////////////// {Colors.bold(text)} /////////////////////////////////"
|
9
9
|
)
|
10
10
|
assert Header().render(text, Colors.red) == (
|
11
|
-
f"///////////////////////////////// {Colors.red(text)} /////////////////////////////////"
|
11
|
+
f"///////////////////////////////// {Colors.bold(Colors.red(text))} /////////////////////////////////"
|
12
12
|
)
|
@@ -4,6 +4,6 @@ from gibson.display.WorkspaceHeader import WorkspaceHeader
|
|
4
4
|
|
5
5
|
def test_render():
|
6
6
|
assert WorkspaceHeader().render("abc def ghi") == (
|
7
|
-
f"""Project {Colors.project("abc def ghi")}
|
7
|
+
f"""Project {Colors.project("abc def ghi")} {Colors.bold("PAIR PROGRAMMER")}
|
8
8
|
-------------------------------------------------------------------------------"""
|
9
9
|
)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/services/code/customization/BaseCustomization.py
RENAMED
File without changes
|
{gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/services/code/customization/CustomizationManager.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/structure/mysql/constraints/ReferenceConstraint.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{gibson_cli-0.7.4 → gibson_cli-0.7.5}/gibson/structure/mysql/tests/test_structure_mysql_Entity.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|