gibson-cli 0.5.3__tar.gz → 0.5.4__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.5.3/gibson_cli.egg-info → gibson_cli-0.5.4}/PKG-INFO +1 -1
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/api/BaseApi.py +9 -1
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/api/Cli.py +5 -12
- gibson_cli-0.5.4/gibson/api/ProjectApi.py +13 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/Build.py +1 -1
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/Conf.py +1 -1
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/Count.py +1 -1
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/Dev.py +1 -1
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/Forget.py +1 -1
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/Import.py +1 -1
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/Merge.py +1 -1
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/Model.py +1 -1
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/Modify.py +1 -1
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/OpenApi.py +1 -1
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/Question.py +1 -1
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/Remove.py +1 -1
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/Schema.py +1 -1
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/Show.py +7 -4
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/Test.py +1 -1
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/Tree.py +1 -1
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/Version.py +1 -4
- gibson_cli-0.5.4/gibson/command/code/Code.py +26 -0
- gibson_cli-0.5.3/gibson/command/Code.py → gibson_cli-0.5.4/gibson/command/code/Entity.py +2 -20
- gibson_cli-0.5.3/gibson/command/List.py → gibson_cli-0.5.4/gibson/command/list/Entities.py +2 -15
- gibson_cli-0.5.4/gibson/command/list/List.py +27 -0
- gibson_cli-0.5.4/gibson/command/list/Projects.py +25 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/new/Module.py +1 -1
- gibson_cli-0.5.3/gibson/command/Rename.py → gibson_cli-0.5.4/gibson/command/rename/Entity.py +9 -21
- gibson_cli-0.5.4/gibson/command/rename/Rename.py +21 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/rewrite/Rewrite.py +1 -1
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/core/CommandRouter.py +3 -8
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/core/Configuration.py +22 -15
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/core/Conversation.py +7 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4/gibson_cli.egg-info}/PKG-INFO +1 -1
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson_cli.egg-info/SOURCES.txt +8 -3
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson_cli.egg-info/top_level.txt +1 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/pyproject.toml +1 -1
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/.gitignore +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/.pre-commit-config.yaml +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/README.md +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/bin/build.sh +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/bin/release.sh +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/bin/gibson.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/BaseCommand.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/Help.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/WarGames.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/auth/Auth.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/auth/Login.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/auth/Logout.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/new/New.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/new/Project.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/rewrite/Api.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/rewrite/Base.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/rewrite/Models.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/rewrite/Schemas.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/rewrite/Tests.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/tests/test_command_BaseCommand.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/command/tests/test_command_Conf.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/conf/Api.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/conf/Code.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/conf/Custom.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/conf/Datastore.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/conf/Dependencies.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/conf/Dev.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/conf/Frameworks.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/conf/Modeler.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/conf/Paths.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/conf/Platform.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/conf/Project.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/conf/Version.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/conf/dev/Api.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/conf/dev/Base.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/conf/dev/Model.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/conf/dev/Schema.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/conf/tests/test_conf_Dependencies.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/conf/tests/test_conf_Platform.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/core/Colors.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/core/Completions.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/core/Env.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/core/Memory.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/core/PythonPath.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/core/TimeKeeper.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/core/utils.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/data/bash-completion.tmpl +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/data/default-ref-table.tmpl +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/data/default-table.tmpl +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/db/TableExceptions.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/db/tests/test_db_TableExceptions.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/dev/Dev.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/display/Header.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/display/WorkspaceFooter.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/display/WorkspaceHeader.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/display/tests/test_display_Header.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/display/tests/test_display_WorkspaceFooter.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/display/tests/test_display_WorkspaceHeader.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/lang/Python.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/lang/tests/test_lang_Python.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/services/auth/Server.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/services/code/context/schema/DataDictionary.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/services/code/context/schema/EntityKeys.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/services/code/context/schema/Manager.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/services/code/context/schema/tests/test_code_context_schema_DataDictionary.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/services/code/context/schema/tests/test_code_context_schema_EntityKeys.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/services/code/context/schema/tests/test_code_context_schema_Manager.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/services/code/customization/Authenticator.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/services/code/customization/BaseCustomization.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/services/code/customization/CustomizationManager.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/services/code/customization/Index.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/services/code/customization/tests/test_code_customization_Authenticator.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/services/code/customization/tests/test_code_customization_BaseCustomization.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/structure/Entity.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/structure/constraints/ReferenceConstraint.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/structure/keys/ForeignKey.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/structure/keys/Index.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/structure/keys/IndexAttribute.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/structure/keys/tests/test_ForeignKey.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/structure/keys/tests/test_Index.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/structure/keys/tests/test_IndexAttribute.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/structure/testing.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/structure/tests/test_Entity.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/tests/test_Env.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/tests/test_Memory.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson/tests/test_utils.py +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson_cli.egg-info/dependency_links.txt +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/gibson_cli.egg-info/entry_points.txt +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/requirements.txt +0 -0
- {gibson_cli-0.5.3 → gibson_cli-0.5.4}/setup.cfg +0 -0
@@ -25,7 +25,15 @@ class BaseApi:
|
|
25
25
|
return r.json()
|
26
26
|
|
27
27
|
def headers(self):
|
28
|
-
|
28
|
+
headers = {
|
29
|
+
"X-Gibson-Client-ID": self.configuration.client_id(),
|
30
|
+
}
|
31
|
+
|
32
|
+
token = self.configuration.get_access_token()
|
33
|
+
if token is not None:
|
34
|
+
headers["Authorization"] = f"Bearer {token}"
|
35
|
+
|
36
|
+
return headers
|
29
37
|
|
30
38
|
def post(self, endpoint, json: dict):
|
31
39
|
r = requests.post(self.url(endpoint), headers=self.headers(), json=json)
|
@@ -1,16 +1,16 @@
|
|
1
|
+
from gibson.api.BaseApi import BaseApi
|
1
2
|
from gibson.core.Configuration import Configuration
|
2
3
|
from gibson.core.Memory import Memory
|
3
4
|
from gibson.lang.Python import Python
|
4
5
|
|
5
|
-
from .BaseApi import BaseApi
|
6
|
-
|
7
6
|
|
8
7
|
class Cli(BaseApi):
|
9
8
|
PREFIX = "cli"
|
10
9
|
|
11
10
|
def __init__(self, configuration: Configuration):
|
12
11
|
self.configuration = configuration
|
13
|
-
self.configuration.
|
12
|
+
self.configuration.require_login()
|
13
|
+
self.configuration.require_project()
|
14
14
|
|
15
15
|
def code_api(self):
|
16
16
|
return self.post(
|
@@ -64,15 +64,8 @@ class Cli(BaseApi):
|
|
64
64
|
).json()
|
65
65
|
|
66
66
|
def headers(self):
|
67
|
-
headers =
|
68
|
-
|
69
|
-
"X-Gibson-API-Key": self.configuration.project.api.key,
|
70
|
-
}
|
71
|
-
|
72
|
-
token = self.configuration.get_access_token()
|
73
|
-
if token is not None:
|
74
|
-
headers["Authorization"] = f"Bearer {token}"
|
75
|
-
|
67
|
+
headers = super().headers()
|
68
|
+
headers["X-Gibson-API-Key"] = self.configuration.project.api.key
|
76
69
|
return headers
|
77
70
|
|
78
71
|
def import_(self):
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from gibson.api.BaseApi import BaseApi
|
2
|
+
from gibson.core.Configuration import Configuration
|
3
|
+
|
4
|
+
|
5
|
+
class ProjectApi(BaseApi):
|
6
|
+
PREFIX = "project"
|
7
|
+
|
8
|
+
def __init__(self, configuration: Configuration):
|
9
|
+
self.configuration = configuration
|
10
|
+
self.configuration.require_login()
|
11
|
+
|
12
|
+
def all_projects(self):
|
13
|
+
return self.get("all")["projects"]
|
@@ -49,7 +49,7 @@ class Build(BaseCommand):
|
|
49
49
|
if len(sys.argv) != 3 or sys.argv[2] != "datastore":
|
50
50
|
self.usage()
|
51
51
|
|
52
|
-
self.configuration.
|
52
|
+
self.configuration.require_project()
|
53
53
|
|
54
54
|
if self.memory.entities is None or len(self.memory.entities) == 0:
|
55
55
|
self.no_entities()
|
@@ -39,7 +39,7 @@ class Conf(BaseCommand):
|
|
39
39
|
except KeyError:
|
40
40
|
self.usage()
|
41
41
|
|
42
|
-
self.configuration.
|
42
|
+
self.configuration.require_project()
|
43
43
|
self.configuration.display_project()
|
44
44
|
self.conversation.type(f"{key}\n")
|
45
45
|
self.conversation.type(f" [old value] {old_value}\n")
|
@@ -30,7 +30,7 @@ class Dev(BaseCommand):
|
|
30
30
|
if len(sys.argv) != 3 or sys.argv[2] not in ["off", "on"]:
|
31
31
|
self.usage()
|
32
32
|
|
33
|
-
self.configuration.
|
33
|
+
self.configuration.require_project()
|
34
34
|
|
35
35
|
if sys.argv[2] == "off":
|
36
36
|
if self.configuration.project.dev.active is True:
|
@@ -9,7 +9,7 @@ class Forget(BaseCommand):
|
|
9
9
|
if len(sys.argv) != 3 or sys.argv[2] not in ["all", "last", "stored"]:
|
10
10
|
self.usage()
|
11
11
|
|
12
|
-
self.configuration.
|
12
|
+
self.configuration.require_project()
|
13
13
|
self.configuration.display_project()
|
14
14
|
|
15
15
|
if sys.argv[2] in ["all", "last"]:
|
@@ -15,7 +15,7 @@ class Import(BaseCommand):
|
|
15
15
|
if len(sys.argv) != 3 and len(sys.argv) != 5:
|
16
16
|
self.usage()
|
17
17
|
|
18
|
-
self.configuration.
|
18
|
+
self.configuration.require_project()
|
19
19
|
write_code = False
|
20
20
|
if len(sys.argv) == 5:
|
21
21
|
if sys.argv[3] != ".." or sys.argv[4] != "dev":
|
@@ -3,7 +3,7 @@ from gibson.command.BaseCommand import BaseCommand
|
|
3
3
|
|
4
4
|
class Merge(BaseCommand):
|
5
5
|
def execute(self):
|
6
|
-
self.configuration.
|
6
|
+
self.configuration.require_project()
|
7
7
|
self.configuration.display_project()
|
8
8
|
|
9
9
|
if self.memory.last is None or "entities" not in self.memory.last:
|
@@ -12,7 +12,7 @@ class Model(BaseCommand):
|
|
12
12
|
if len(sys.argv) != 3:
|
13
13
|
self.usage()
|
14
14
|
|
15
|
-
self.configuration.
|
15
|
+
self.configuration.require_project()
|
16
16
|
entity = self.memory.recall_stored_entity(sys.argv[2])
|
17
17
|
if entity is None:
|
18
18
|
self.conversation.not_sure_no_entity(
|
@@ -10,7 +10,7 @@ class Modify(BaseCommand):
|
|
10
10
|
if len(sys.argv) < 4:
|
11
11
|
self.usage()
|
12
12
|
|
13
|
-
self.configuration.
|
13
|
+
self.configuration.require_project()
|
14
14
|
entity = self.memory.recall_entity(sys.argv[2])
|
15
15
|
if entity is None:
|
16
16
|
self.conversation.not_sure_no_entity(
|
@@ -12,7 +12,7 @@ class Schema(BaseCommand):
|
|
12
12
|
if len(sys.argv) != 3:
|
13
13
|
self.usage()
|
14
14
|
|
15
|
-
self.configuration.
|
15
|
+
self.configuration.require_project()
|
16
16
|
entity = self.memory.recall_stored_entity(sys.argv[2])
|
17
17
|
if entity is None:
|
18
18
|
self.conversation.not_sure_no_entity(
|
@@ -7,13 +7,13 @@ from gibson.command.BaseCommand import BaseCommand
|
|
7
7
|
class Show(BaseCommand):
|
8
8
|
def execute(self):
|
9
9
|
if len(sys.argv) == 2:
|
10
|
-
self.configuration.
|
10
|
+
self.configuration.require_project()
|
11
11
|
entities = self.memory.recall_merged()
|
12
12
|
if entities is None:
|
13
13
|
self.conversation.cant_no_entities(self.configuration.project.name)
|
14
14
|
exit(1)
|
15
15
|
elif len(sys.argv) == 3:
|
16
|
-
self.configuration.
|
16
|
+
self.configuration.require_project()
|
17
17
|
entity = self.memory.recall_entity(sys.argv[2])
|
18
18
|
if entity is None:
|
19
19
|
self.conversation.not_sure_no_entity(
|
@@ -25,8 +25,11 @@ class Show(BaseCommand):
|
|
25
25
|
else:
|
26
26
|
self.usage()
|
27
27
|
|
28
|
-
for entity in entities:
|
29
|
-
|
28
|
+
for entity in sorted(entities, key=lambda x: x["name"]):
|
29
|
+
statement = entity["definition"].replace(
|
30
|
+
entity["name"], Colors.argument(entity["name"])
|
31
|
+
)
|
32
|
+
print(f"\n{statement}")
|
30
33
|
|
31
34
|
def usage(self):
|
32
35
|
self.configuration.display_project()
|
@@ -12,7 +12,7 @@ class Test(BaseCommand):
|
|
12
12
|
if len(sys.argv) != 3:
|
13
13
|
self.usage()
|
14
14
|
|
15
|
-
self.configuration.
|
15
|
+
self.configuration.require_project()
|
16
16
|
entity = self.memory.recall_stored_entity(sys.argv[2])
|
17
17
|
if entity is None:
|
18
18
|
self.conversation.not_sure_no_entity(
|
@@ -25,8 +25,5 @@ class Version(BaseCommand):
|
|
25
25
|
)
|
26
26
|
else:
|
27
27
|
self.conversation.type(
|
28
|
-
f"Nice! You are using the latest version of {Colors.command(self.configuration.command)}: {Colors.colorize(VersionConf.num, Colors.Color.CYAN)}\n"
|
28
|
+
f"Nice! 🎉 You are using the latest version of {Colors.command(self.configuration.command)}: {Colors.colorize(VersionConf.num, Colors.Color.CYAN)}\n"
|
29
29
|
)
|
30
|
-
|
31
|
-
self.conversation.newline()
|
32
|
-
return True
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import sys
|
2
|
+
|
3
|
+
import gibson.core.Colors as Colors
|
4
|
+
from gibson.command.BaseCommand import BaseCommand
|
5
|
+
from gibson.command.code.Entity import Entity
|
6
|
+
|
7
|
+
|
8
|
+
class Code(BaseCommand):
|
9
|
+
def execute(self):
|
10
|
+
if len(sys.argv) == 4 and sys.argv[2] == "entity":
|
11
|
+
Entity(self.configuration).execute()
|
12
|
+
else:
|
13
|
+
self.usage()
|
14
|
+
|
15
|
+
def usage(self):
|
16
|
+
self.configuration.display_project()
|
17
|
+
self.conversation.type(
|
18
|
+
f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.argument('entity')} {Colors.input('[entity name]')} {Colors.hint('create a new entity')}\n"
|
19
|
+
)
|
20
|
+
self.conversation.newline()
|
21
|
+
self.conversation.type(
|
22
|
+
' To create a new entity named "user":\n'
|
23
|
+
f" {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.argument('entity')} {Colors.input('user')}\n"
|
24
|
+
)
|
25
|
+
self.conversation.newline()
|
26
|
+
exit(1)
|
@@ -1,9 +1,7 @@
|
|
1
1
|
import os
|
2
|
-
import re
|
3
2
|
import sys
|
4
3
|
from string import Template
|
5
4
|
|
6
|
-
import gibson.core.Colors as Colors
|
7
5
|
from gibson.api.Cli import Cli
|
8
6
|
from gibson.command.BaseCommand import BaseCommand
|
9
7
|
from gibson.command.Merge import Merge
|
@@ -18,7 +16,7 @@ from gibson.services.code.context.schema.Manager import (
|
|
18
16
|
from gibson.structure.Entity import Entity
|
19
17
|
|
20
18
|
|
21
|
-
class
|
19
|
+
class Entity(BaseCommand):
|
22
20
|
CODE_WRITER_ENTITY_MODIFIER_NOOP = ""
|
23
21
|
|
24
22
|
def __init__(self, configuration: Configuration):
|
@@ -82,12 +80,9 @@ class Code(BaseCommand):
|
|
82
80
|
return Template(f.read()).substitute({"entity_name": sys.argv[3]})
|
83
81
|
|
84
82
|
def execute(self):
|
85
|
-
if len(sys.argv) != 4 or sys.argv[2] not in ["entity"]:
|
86
|
-
self.usage()
|
87
|
-
|
88
83
|
cli = Cli(self.configuration)
|
89
84
|
|
90
|
-
self.configuration.
|
85
|
+
self.configuration.require_project()
|
91
86
|
self.configuration.display_project()
|
92
87
|
definition = self.configure_definition()
|
93
88
|
|
@@ -184,16 +179,3 @@ class Code(BaseCommand):
|
|
184
179
|
|
185
180
|
print("")
|
186
181
|
print(WorkspaceFooter().render())
|
187
|
-
|
188
|
-
def usage(self):
|
189
|
-
self.configuration.display_project()
|
190
|
-
self.conversation.type(
|
191
|
-
f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.argument('entity')} {Colors.input('[entity name]')} {Colors.hint('create a new entity')}\n"
|
192
|
-
)
|
193
|
-
self.conversation.newline()
|
194
|
-
self.conversation.type(
|
195
|
-
' To create a new entity named "user":\n'
|
196
|
-
f" {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.argument('entity')} {Colors.input('user')}\n"
|
197
|
-
)
|
198
|
-
self.conversation.newline()
|
199
|
-
exit(1)
|
@@ -1,16 +1,11 @@
|
|
1
1
|
import sys
|
2
2
|
|
3
|
-
import gibson.core.Colors as Colors
|
4
|
-
from gibson.api.Cli import Cli
|
5
3
|
from gibson.command.BaseCommand import BaseCommand
|
6
4
|
|
7
5
|
|
8
|
-
class
|
6
|
+
class Entities(BaseCommand):
|
9
7
|
def execute(self):
|
10
|
-
|
11
|
-
self.usage()
|
12
|
-
|
13
|
-
self.configuration.ensure_project()
|
8
|
+
self.configuration.require_project()
|
14
9
|
self.configuration.display_project()
|
15
10
|
|
16
11
|
entities = {"last": [], "stored": []}
|
@@ -54,11 +49,3 @@ class List(BaseCommand):
|
|
54
49
|
self.conversation.newline()
|
55
50
|
|
56
51
|
self.conversation.newline()
|
57
|
-
|
58
|
-
def usage(self):
|
59
|
-
self.configuration.display_project()
|
60
|
-
self.conversation.type(
|
61
|
-
f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('list')} {Colors.arguments(['entities'])} {Colors.hint('list all entities')}\n"
|
62
|
-
)
|
63
|
-
self.conversation.newline()
|
64
|
-
exit(1)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import sys
|
2
|
+
|
3
|
+
import gibson.core.Colors as Colors
|
4
|
+
from gibson.command.BaseCommand import BaseCommand
|
5
|
+
from gibson.command.list.Entities import Entities
|
6
|
+
from gibson.command.list.Projects import Projects
|
7
|
+
|
8
|
+
|
9
|
+
class List(BaseCommand):
|
10
|
+
def execute(self):
|
11
|
+
if len(sys.argv) == 3 and sys.argv[2] == "entities":
|
12
|
+
Entities(self.configuration).execute()
|
13
|
+
elif len(sys.argv) == 3 and sys.argv[2] == "projects":
|
14
|
+
Projects(self.configuration).execute()
|
15
|
+
else:
|
16
|
+
self.usage()
|
17
|
+
|
18
|
+
def usage(self):
|
19
|
+
self.configuration.display_project()
|
20
|
+
self.conversation.type(
|
21
|
+
f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('list')} {Colors.arguments(['entities'])} {Colors.hint('list all entities')}\n"
|
22
|
+
)
|
23
|
+
self.conversation.type(
|
24
|
+
f" or: {Colors.command(self.configuration.command)} {Colors.subcommand('list')} {Colors.arguments(['projects'])} {Colors.hint('list all projects')}\n"
|
25
|
+
)
|
26
|
+
self.conversation.newline()
|
27
|
+
exit(1)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import re
|
2
|
+
|
3
|
+
import gibson.core.Colors as Colors
|
4
|
+
from gibson.api.ProjectApi import ProjectApi
|
5
|
+
from gibson.command.BaseCommand import BaseCommand
|
6
|
+
|
7
|
+
|
8
|
+
class Projects(BaseCommand):
|
9
|
+
def execute(self):
|
10
|
+
self.configuration.require_login()
|
11
|
+
projects = ProjectApi(self.configuration).all_projects()
|
12
|
+
|
13
|
+
self.conversation.type("Name".ljust(40))
|
14
|
+
self.conversation.type("ID")
|
15
|
+
self.conversation.newline()
|
16
|
+
self.conversation.type("----".ljust(40))
|
17
|
+
self.conversation.type("-" * 36)
|
18
|
+
self.conversation.newline()
|
19
|
+
|
20
|
+
for project in projects:
|
21
|
+
name = project["name"] if project["name"] is not None else "Untitled"
|
22
|
+
name = re.sub(r"^(.{36}).*$", "\g<1>...", name).ljust(40)
|
23
|
+
self.conversation.type(f"{Colors.command(name)}")
|
24
|
+
self.conversation.type(f"{project['uuid']}")
|
25
|
+
self.conversation.newline()
|
gibson_cli-0.5.3/gibson/command/Rename.py → gibson_cli-0.5.4/gibson/command/rename/Entity.py
RENAMED
@@ -1,29 +1,25 @@
|
|
1
1
|
import sys
|
2
2
|
|
3
|
-
import gibson.core.Colors as Colors
|
4
3
|
from gibson.api.Cli import Cli
|
5
4
|
from gibson.command.BaseCommand import BaseCommand
|
6
5
|
from gibson.command.rewrite.Rewrite import Rewrite
|
7
6
|
|
8
7
|
|
9
|
-
class
|
8
|
+
class Entity(BaseCommand):
|
10
9
|
def execute(self):
|
11
|
-
|
12
|
-
self.usage()
|
13
|
-
|
14
|
-
self.configuration.ensure_project()
|
10
|
+
self.configuration.require_project()
|
15
11
|
self.configuration.display_project()
|
16
12
|
|
17
|
-
if self.memory.recall_entity(sys.argv[
|
13
|
+
if self.memory.recall_entity(sys.argv[3]) is None:
|
18
14
|
self.conversation.type(
|
19
|
-
f'Nothing renamed, did not find entity named "{sys.argv[
|
15
|
+
f'Nothing renamed, did not find entity named "{sys.argv[3]}".\n'
|
20
16
|
)
|
21
17
|
self.conversation.newline()
|
22
18
|
return self
|
23
19
|
|
24
|
-
if self.memory.recall_entity(sys.argv[
|
20
|
+
if self.memory.recall_entity(sys.argv[4]) is not None:
|
25
21
|
self.conversation.type(
|
26
|
-
f'Cannot rename to "{sys.argv[
|
22
|
+
f'Cannot rename to "{sys.argv[4]}" because that entity already exists.\n'
|
27
23
|
)
|
28
24
|
self.conversation.newline()
|
29
25
|
return self
|
@@ -35,8 +31,8 @@ class Rename(BaseCommand):
|
|
35
31
|
response = cli.modeler_entity_rename(
|
36
32
|
self.configuration.project.modeler.version,
|
37
33
|
last["entities"],
|
38
|
-
sys.argv[2],
|
39
34
|
sys.argv[3],
|
35
|
+
sys.argv[4],
|
40
36
|
)
|
41
37
|
|
42
38
|
self.memory.remember_last({"entities": response["entities"]})
|
@@ -46,13 +42,13 @@ class Rename(BaseCommand):
|
|
46
42
|
response = cli.modeler_entity_rename(
|
47
43
|
self.configuration.project.modeler.version,
|
48
44
|
stored,
|
49
|
-
sys.argv[2],
|
50
45
|
sys.argv[3],
|
46
|
+
sys.argv[4],
|
51
47
|
)
|
52
48
|
|
53
49
|
self.memory.remember_entities(response["entities"])
|
54
50
|
|
55
|
-
self.conversation.type(f"[Renamed] {sys.argv[
|
51
|
+
self.conversation.type(f"[Renamed] {sys.argv[3]} -> {sys.argv[4]}\n")
|
56
52
|
self.conversation.newline()
|
57
53
|
|
58
54
|
Rewrite(self.configuration, header="Refactoring").write()
|
@@ -60,11 +56,3 @@ class Rename(BaseCommand):
|
|
60
56
|
self.conversation.newline()
|
61
57
|
|
62
58
|
return self
|
63
|
-
|
64
|
-
def usage(self):
|
65
|
-
self.configuration.display_project()
|
66
|
-
self.conversation.type(
|
67
|
-
f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('rename')} {Colors.argument('[current]')} {Colors.input('[new]')} {Colors.hint('rename an entity')}\n"
|
68
|
-
)
|
69
|
-
self.conversation.newline()
|
70
|
-
exit(1)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import sys
|
2
|
+
|
3
|
+
import gibson.core.Colors as Colors
|
4
|
+
from gibson.command.BaseCommand import BaseCommand
|
5
|
+
from gibson.command.rename.Entity import Entity
|
6
|
+
|
7
|
+
|
8
|
+
class Rename(BaseCommand):
|
9
|
+
def execute(self):
|
10
|
+
if len(sys.argv) == 5 and sys.argv[2] == "entity":
|
11
|
+
Entity(self.configuration).execute()
|
12
|
+
else:
|
13
|
+
self.usage()
|
14
|
+
|
15
|
+
def usage(self):
|
16
|
+
self.configuration.display_project()
|
17
|
+
self.conversation.type(
|
18
|
+
f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('rename')} {Colors.argument('entity')} {Colors.input('[existing name]')} {Colors.input('[new name]')} {Colors.hint('rename an entity')}\n"
|
19
|
+
)
|
20
|
+
self.conversation.newline()
|
21
|
+
exit(1)
|
@@ -37,7 +37,7 @@ class Rewrite(BaseCommand):
|
|
37
37
|
self.usage()
|
38
38
|
|
39
39
|
def write(self, argument=None):
|
40
|
-
self.configuration.
|
40
|
+
self.configuration.require_project()
|
41
41
|
|
42
42
|
if len(self.memory.recall_merged()) == 0:
|
43
43
|
self.conversation.cant_no_entities(self.configuration.project.name)
|
@@ -2,14 +2,14 @@ import sys
|
|
2
2
|
|
3
3
|
from gibson.command.auth.Auth import Auth
|
4
4
|
from gibson.command.Build import Build
|
5
|
-
from gibson.command.Code import Code
|
5
|
+
from gibson.command.code.Code import Code
|
6
6
|
from gibson.command.Conf import Conf
|
7
7
|
from gibson.command.Count import Count
|
8
8
|
from gibson.command.Dev import Dev
|
9
9
|
from gibson.command.Forget import Forget
|
10
10
|
from gibson.command.Help import Help
|
11
11
|
from gibson.command.Import import Import
|
12
|
-
from gibson.command.List import List
|
12
|
+
from gibson.command.list.List import List
|
13
13
|
from gibson.command.Merge import Merge
|
14
14
|
from gibson.command.Model import Model
|
15
15
|
from gibson.command.Modify import Modify
|
@@ -17,13 +17,8 @@ from gibson.command.new.New import New
|
|
17
17
|
from gibson.command.OpenApi import OpenApi
|
18
18
|
from gibson.command.Question import Question
|
19
19
|
from gibson.command.Remove import Remove
|
20
|
-
from gibson.command.Rename import Rename
|
21
|
-
from gibson.command.rewrite.Api import Api
|
22
|
-
from gibson.command.rewrite.Base import Base
|
23
|
-
from gibson.command.rewrite.Models import Models
|
20
|
+
from gibson.command.rename.Rename import Rename
|
24
21
|
from gibson.command.rewrite.Rewrite import Rewrite
|
25
|
-
from gibson.command.rewrite.Schemas import Schemas
|
26
|
-
from gibson.command.rewrite.Tests import Tests
|
27
22
|
from gibson.command.Schema import Schema
|
28
23
|
from gibson.command.Show import Show
|
29
24
|
from gibson.command.Test import Test
|
@@ -248,7 +248,7 @@ class Configuration:
|
|
248
248
|
return self
|
249
249
|
|
250
250
|
def create_project_memory(self):
|
251
|
-
self.
|
251
|
+
self.require_project()
|
252
252
|
try:
|
253
253
|
os.makedirs(self.project.paths.memory)
|
254
254
|
except OSError as e:
|
@@ -259,17 +259,6 @@ class Configuration:
|
|
259
259
|
if self.project is not None:
|
260
260
|
self.conversation.display_project(self.project.name)
|
261
261
|
|
262
|
-
def ensure_project(self):
|
263
|
-
if self.project is None:
|
264
|
-
self.conversation.gibsonai_project_not_set(self)
|
265
|
-
exit(1)
|
266
|
-
|
267
|
-
if self.project.name not in self.settings:
|
268
|
-
self.conversation.unrecognized_project(self, self.project.name)
|
269
|
-
exit(1)
|
270
|
-
|
271
|
-
return self
|
272
|
-
|
273
262
|
def get_access_token(self):
|
274
263
|
try:
|
275
264
|
with open(f"{self.paths.auth}/{self.API_ENV}", "r") as f:
|
@@ -281,7 +270,7 @@ class Configuration:
|
|
281
270
|
return token["access_token"]
|
282
271
|
|
283
272
|
def get_my_settings(self):
|
284
|
-
self.
|
273
|
+
self.require_project()
|
285
274
|
return self.settings[self.project.name]
|
286
275
|
|
287
276
|
def get_refresh_token(self):
|
@@ -358,6 +347,24 @@ class Configuration:
|
|
358
347
|
|
359
348
|
return self
|
360
349
|
|
350
|
+
def require_login(self):
|
351
|
+
if self.get_access_token() is None:
|
352
|
+
self.conversation.message_login_required()
|
353
|
+
exit(1)
|
354
|
+
|
355
|
+
return self
|
356
|
+
|
357
|
+
def require_project(self):
|
358
|
+
if self.project is None:
|
359
|
+
self.conversation.gibsonai_project_not_set(self)
|
360
|
+
exit(1)
|
361
|
+
|
362
|
+
if self.project.name not in self.settings:
|
363
|
+
self.conversation.unrecognized_project(self, self.project.name)
|
364
|
+
exit(1)
|
365
|
+
|
366
|
+
return self
|
367
|
+
|
361
368
|
def set_auth_tokens(self, access_token, refresh_token):
|
362
369
|
try:
|
363
370
|
os.mkdir(self.paths.auth)
|
@@ -439,7 +446,7 @@ class Configuration:
|
|
439
446
|
return self
|
440
447
|
|
441
448
|
def turn_dev_off(self):
|
442
|
-
self.
|
449
|
+
self.require_project()
|
443
450
|
self.settings[self.project.name]["dev"]["active"] = False
|
444
451
|
self.write_config()
|
445
452
|
return self
|
@@ -447,7 +454,7 @@ class Configuration:
|
|
447
454
|
def turn_dev_on(
|
448
455
|
self, api_path, api_prefix, api_version, base_path, model_path, schema_path
|
449
456
|
):
|
450
|
-
self.
|
457
|
+
self.require_project()
|
451
458
|
self.settings[self.project.name]["dev"]["active"] = True
|
452
459
|
self.settings[self.project.name]["dev"]["api"]["path"] = api_path
|
453
460
|
self.settings[self.project.name]["dev"]["api"]["prefix"] = api_prefix
|
@@ -130,6 +130,13 @@ class Conversation:
|
|
130
130
|
self.type("Login failed, please try again.\n")
|
131
131
|
return self
|
132
132
|
|
133
|
+
def message_login_required(self):
|
134
|
+
self.type("You need to login before performing this action.\n")
|
135
|
+
self.type(
|
136
|
+
f"Run {Colors.command('gibson')} {Colors.subcommand('auth')} {Colors.argument('login')} and try again.\n"
|
137
|
+
)
|
138
|
+
return self
|
139
|
+
|
133
140
|
def message_login_success(self):
|
134
141
|
self.newline()
|
135
142
|
self.type("Nice! You're now logged in.\n")
|
@@ -7,24 +7,22 @@ bin/build.sh
|
|
7
7
|
bin/release.sh
|
8
8
|
gibson/api/BaseApi.py
|
9
9
|
gibson/api/Cli.py
|
10
|
+
gibson/api/ProjectApi.py
|
10
11
|
gibson/bin/gibson.py
|
11
12
|
gibson/command/BaseCommand.py
|
12
13
|
gibson/command/Build.py
|
13
|
-
gibson/command/Code.py
|
14
14
|
gibson/command/Conf.py
|
15
15
|
gibson/command/Count.py
|
16
16
|
gibson/command/Dev.py
|
17
17
|
gibson/command/Forget.py
|
18
18
|
gibson/command/Help.py
|
19
19
|
gibson/command/Import.py
|
20
|
-
gibson/command/List.py
|
21
20
|
gibson/command/Merge.py
|
22
21
|
gibson/command/Model.py
|
23
22
|
gibson/command/Modify.py
|
24
23
|
gibson/command/OpenApi.py
|
25
24
|
gibson/command/Question.py
|
26
25
|
gibson/command/Remove.py
|
27
|
-
gibson/command/Rename.py
|
28
26
|
gibson/command/Schema.py
|
29
27
|
gibson/command/Show.py
|
30
28
|
gibson/command/Test.py
|
@@ -34,9 +32,16 @@ gibson/command/WarGames.py
|
|
34
32
|
gibson/command/auth/Auth.py
|
35
33
|
gibson/command/auth/Login.py
|
36
34
|
gibson/command/auth/Logout.py
|
35
|
+
gibson/command/code/Code.py
|
36
|
+
gibson/command/code/Entity.py
|
37
|
+
gibson/command/list/Entities.py
|
38
|
+
gibson/command/list/List.py
|
39
|
+
gibson/command/list/Projects.py
|
37
40
|
gibson/command/new/Module.py
|
38
41
|
gibson/command/new/New.py
|
39
42
|
gibson/command/new/Project.py
|
43
|
+
gibson/command/rename/Entity.py
|
44
|
+
gibson/command/rename/Rename.py
|
40
45
|
gibson/command/rewrite/Api.py
|
41
46
|
gibson/command/rewrite/Base.py
|
42
47
|
gibson/command/rewrite/Models.py
|
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.5.3 → gibson_cli-0.5.4}/gibson/services/code/customization/BaseCustomization.py
RENAMED
File without changes
|
{gibson_cli-0.5.3 → gibson_cli-0.5.4}/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
|
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
|