gibson-cli 0.5.1__py3-none-any.whl → 0.5.2__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.
- gibson/command/Help.py +1 -2
- gibson/command/new/Module.py +44 -0
- gibson/command/new/New.py +32 -0
- gibson/command/{New.py → new/Project.py} +1 -19
- gibson/core/CommandRouter.py +1 -4
- gibson/core/Conversation.py +11 -3
- gibson/data/bash-completion.tmpl +2 -5
- {gibson_cli-0.5.1.dist-info → gibson_cli-0.5.2.dist-info}/METADATA +2 -1
- {gibson_cli-0.5.1.dist-info → gibson_cli-0.5.2.dist-info}/RECORD +12 -11
- gibson/command/Module.py +0 -40
- {gibson_cli-0.5.1.dist-info → gibson_cli-0.5.2.dist-info}/WHEEL +0 -0
- {gibson_cli-0.5.1.dist-info → gibson_cli-0.5.2.dist-info}/entry_points.txt +0 -0
- {gibson_cli-0.5.1.dist-info → gibson_cli-0.5.2.dist-info}/top_level.txt +0 -0
gibson/command/Help.py
CHANGED
@@ -56,8 +56,7 @@ class Help(BaseCommand):
|
|
56
56
|
"description": "change an entity using natural language",
|
57
57
|
"memory": "last > stored",
|
58
58
|
},
|
59
|
-
"
|
60
|
-
"new": {"description": "start something new", "memory": None},
|
59
|
+
"new": {"description": "create something new", "memory": None},
|
61
60
|
"openapi": {"description": "build from an OpenAPI spec", "memory": "last"},
|
62
61
|
"remove": {
|
63
62
|
"description": "remove an entity from the project",
|
@@ -0,0 +1,44 @@
|
|
1
|
+
from gibson.api.Cli import Cli
|
2
|
+
from gibson.command.BaseCommand import BaseCommand
|
3
|
+
from gibson.core.Colors import argument, arguments, command, hint, subcommand
|
4
|
+
|
5
|
+
|
6
|
+
class Module(BaseCommand):
|
7
|
+
def execute(self):
|
8
|
+
self.configuration.ensure_project()
|
9
|
+
module_name = self.conversation.prompt_module()
|
10
|
+
|
11
|
+
self.conversation.newline()
|
12
|
+
self.conversation.type(f"Generating new module: {argument(module_name)}\n")
|
13
|
+
|
14
|
+
cli = Cli(self.configuration)
|
15
|
+
response = cli.modeler_module(
|
16
|
+
self.configuration.project.modeler.version,
|
17
|
+
self.configuration.project.description,
|
18
|
+
module_name,
|
19
|
+
)
|
20
|
+
|
21
|
+
self.memory.remember_last(response)
|
22
|
+
|
23
|
+
self.conversation.newline()
|
24
|
+
self.conversation.type(
|
25
|
+
f"The following entities were created in your {argument('last')} memory:\n"
|
26
|
+
)
|
27
|
+
|
28
|
+
for entity in response["entities"]:
|
29
|
+
self.conversation.newline()
|
30
|
+
print(entity["definition"])
|
31
|
+
|
32
|
+
self.conversation.newline()
|
33
|
+
self.conversation.type(f"If you want to persist these new entities run:\n")
|
34
|
+
self.conversation.type(
|
35
|
+
f"{command(self.configuration.command)} {subcommand('merge')}\n"
|
36
|
+
)
|
37
|
+
|
38
|
+
self.conversation.newline()
|
39
|
+
self.conversation.type(
|
40
|
+
f"Afterwards, you can modify any of these entities by running:\n"
|
41
|
+
)
|
42
|
+
self.conversation.type(
|
43
|
+
f"{command(self.configuration.command)} {subcommand('modify')} {argument('[entity name]')} {input('[instructions]')}\n"
|
44
|
+
)
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import sys
|
2
|
+
|
3
|
+
from gibson.command.BaseCommand import BaseCommand
|
4
|
+
from gibson.command.new.Module import Module
|
5
|
+
from gibson.command.new.Project import Project
|
6
|
+
from gibson.core.Colors import argument, arguments, command, hint, subcommand
|
7
|
+
|
8
|
+
|
9
|
+
class New(BaseCommand):
|
10
|
+
def execute(self):
|
11
|
+
if len(sys.argv) != 3:
|
12
|
+
self.usage()
|
13
|
+
elif sys.argv[2] == "project":
|
14
|
+
Project(self.configuration).execute()
|
15
|
+
elif sys.argv[2] == "module":
|
16
|
+
Module(self.configuration).execute()
|
17
|
+
else:
|
18
|
+
self.usage()
|
19
|
+
|
20
|
+
def usage(self):
|
21
|
+
self.configuration.display_project()
|
22
|
+
self.conversation.type(
|
23
|
+
f"usage: {command(self.configuration.command)} {subcommand('new')} {arguments(['project', 'module'])} {hint('create something new')}\n"
|
24
|
+
)
|
25
|
+
self.conversation.type(
|
26
|
+
f" {command(self.configuration.command)} {subcommand('new')} {argument('project')} {hint('create a new project')}\n"
|
27
|
+
)
|
28
|
+
self.conversation.type(
|
29
|
+
f" {command(self.configuration.command)} {subcommand('new')} {argument('module')} {hint('create a new module')}\n"
|
30
|
+
)
|
31
|
+
self.conversation.newline()
|
32
|
+
exit(1)
|
@@ -1,18 +1,8 @@
|
|
1
|
-
import sys
|
2
|
-
|
3
|
-
from gibson.api.Cli import Cli
|
4
1
|
from gibson.command.BaseCommand import BaseCommand
|
5
|
-
from gibson.core.Colors import argument, command, hint, subcommand
|
6
2
|
|
7
3
|
|
8
|
-
class
|
4
|
+
class Project(BaseCommand):
|
9
5
|
def execute(self):
|
10
|
-
if len(sys.argv) != 3:
|
11
|
-
self.usage()
|
12
|
-
|
13
|
-
if sys.argv[2] != "project":
|
14
|
-
self.usage()
|
15
|
-
|
16
6
|
self.conversation.new_project(self.configuration)
|
17
7
|
project_name = self.conversation.prompt_project()
|
18
8
|
if project_name in self.configuration.settings:
|
@@ -25,11 +15,3 @@ class New(BaseCommand):
|
|
25
15
|
self.configuration.append_project_to_conf(project_name, project_description)
|
26
16
|
|
27
17
|
self.conversation.configure_new_project(self.configuration)
|
28
|
-
|
29
|
-
def usage(self):
|
30
|
-
self.configuration.display_project()
|
31
|
-
self.conversation.type(
|
32
|
-
f"usage: {command(self.configuration.command)} {subcommand('new')} {argument('project')} {hint('create a new project')}\n"
|
33
|
-
)
|
34
|
-
self.conversation.newline()
|
35
|
-
exit(1)
|
gibson/core/CommandRouter.py
CHANGED
@@ -13,8 +13,7 @@ from gibson.command.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
|
16
|
-
from gibson.command.
|
17
|
-
from gibson.command.New import New
|
16
|
+
from gibson.command.new.New import New
|
18
17
|
from gibson.command.OpenApi import OpenApi
|
19
18
|
from gibson.command.Question import Question
|
20
19
|
from gibson.command.Remove import Remove
|
@@ -75,8 +74,6 @@ class CommandRouter:
|
|
75
74
|
command = Model(self.configuration)
|
76
75
|
elif sys.argv[1] == "modify":
|
77
76
|
command = Modify(self.configuration)
|
78
|
-
elif sys.argv[1] == "module":
|
79
|
-
command = Module(self.configuration)
|
80
77
|
elif sys.argv[1] == "new":
|
81
78
|
command = New(self.configuration)
|
82
79
|
elif sys.argv[1] == "openapi":
|
gibson/core/Conversation.py
CHANGED
@@ -55,8 +55,9 @@ class Conversation:
|
|
55
55
|
self.type(
|
56
56
|
"\nI am so excited that we're building something new together. "
|
57
57
|
+ "You probably need\nto execute:\n\n"
|
58
|
-
+ " gibson conf api::key
|
59
|
-
+ " gibson conf datastore::
|
58
|
+
+ " gibson conf api::key [API key]\n"
|
59
|
+
+ " gibson conf datastore::type [datastore type]\n"
|
60
|
+
+ " gibson conf datastore::uri [datastore URI]\n\n"
|
60
61
|
+ "To finish setting things up.\n"
|
61
62
|
)
|
62
63
|
self.newline()
|
@@ -202,7 +203,7 @@ class Conversation:
|
|
202
203
|
time.sleep(1)
|
203
204
|
|
204
205
|
def project_already_exists(self, project_name):
|
205
|
-
self.type(f'\nA project
|
206
|
+
self.type(f'\nA project named "{project_name}" already exists.\n')
|
206
207
|
self.newline()
|
207
208
|
|
208
209
|
def prompt_description(self, project_name):
|
@@ -212,6 +213,13 @@ class Conversation:
|
|
212
213
|
if len(user_prompt) > 0:
|
213
214
|
return user_prompt
|
214
215
|
|
216
|
+
def prompt_module(self):
|
217
|
+
while True:
|
218
|
+
self.type("Module Name [a-z0-9] > ")
|
219
|
+
user_prompt = input("")
|
220
|
+
if re.search("^[a-z0-9]+$", user_prompt):
|
221
|
+
return user_prompt
|
222
|
+
|
215
223
|
def prompt_project(self):
|
216
224
|
while True:
|
217
225
|
self.type("Project Name [A-Za-z0-9_-] > ")
|
gibson/data/bash-completion.tmpl
CHANGED
@@ -25,7 +25,6 @@ __gibson_commands_and_options() {
|
|
25
25
|
code
|
26
26
|
conf
|
27
27
|
count
|
28
|
-
create
|
29
28
|
dev
|
30
29
|
forget
|
31
30
|
help
|
@@ -36,8 +35,6 @@ __gibson_commands_and_options() {
|
|
36
35
|
modify
|
37
36
|
new
|
38
37
|
openapi
|
39
|
-
project
|
40
|
-
question
|
41
38
|
remove
|
42
39
|
rename
|
43
40
|
rewrite
|
@@ -65,12 +62,12 @@ __gibson_completions() {
|
|
65
62
|
gibson) __gibson_commands_and_options ;;
|
66
63
|
auth) __gibson_generate_completion "login logout" ;;
|
67
64
|
code) __gibson_generate_completion "entity" ;;
|
68
|
-
conf) __gibson_generate_completion "api::key code::custom::model::class code::custom::path datastore::uri" ;;
|
65
|
+
conf) __gibson_generate_completion "api::key code::custom::model::class code::custom::path datastore::uri datastore::type" ;;
|
69
66
|
dev) __gibson_generate_completion "on off" ;;
|
70
67
|
forget) __gibson_generate_completion "stored last all" ;;
|
71
68
|
import) __gibson_generate_completion "api datastore" ;;
|
72
69
|
list) __gibson_generate_completion "entities" ;;
|
73
|
-
new) __gibson_generate_completion "project" ;;
|
70
|
+
new) __gibson_generate_completion "project module" ;;
|
74
71
|
rewrite) __gibson_generate_completion "api base models schemas tests" ;;
|
75
72
|
# create) __gibson_generate_completion "project module entity" ;;
|
76
73
|
# project) __gibson_generate_completion "create delete list" ;;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: gibson-cli
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.2
|
4
4
|
Summary: Gibson Command Line Interface
|
5
5
|
Author-email: GibsonAI <noc@gibsonai.com>
|
6
6
|
Project-URL: Homepage, https://gibsonai.com/
|
@@ -169,6 +169,7 @@ More languages and frameworks are in active development. If you do not see a ver
|
|
169
169
|
|
170
170
|
### Configuring Your Datastore
|
171
171
|
|
172
|
+
`gibson conf datastore::type mysql`
|
172
173
|
`gibson conf datastore::uri mysql+pymysql://[user]:[password]@[host]/[database name]`
|
173
174
|
|
174
175
|
Note: Gibson currently only supports MySQL. Let us know if you need something else.
|
@@ -10,14 +10,12 @@ gibson/command/Conf.py,sha256=z7G-81GpPUGZxjuE0HJn3ltHBIScqy4-rzinLYCyiLA,2467
|
|
10
10
|
gibson/command/Count.py,sha256=FInot7Wz-lClKM1gfKgZXwBVIsTR0Gde0cMjYrCitog,1086
|
11
11
|
gibson/command/Dev.py,sha256=KXaWeAMGifrxb4uyBJ5W0v9XIYeG8_C1Dw8TiAeOlHE,4358
|
12
12
|
gibson/command/Forget.py,sha256=2-XpPqzjqhdGvilMitZECVBegDzlV12kDiR0xrxEVyY,1064
|
13
|
-
gibson/command/Help.py,sha256=
|
13
|
+
gibson/command/Help.py,sha256=KoHukpEk_jLNxaNdM-n4R-dXj_VZub6x4xIXbTK1_wU,4794
|
14
14
|
gibson/command/Import.py,sha256=4VeDtQNWf20j2tSvAMjU9r-gB05fD3hh6Mfxdp5B_oI,4174
|
15
15
|
gibson/command/List.py,sha256=XNL0p3WvGCjuWeFD_24VO5d2sflXfkk_CvAbXrcOMYI,2318
|
16
16
|
gibson/command/Merge.py,sha256=AKhyImy_MH8sy7m9Anh1SKBINvLrRmt91fFE4oVPg7k,1060
|
17
17
|
gibson/command/Model.py,sha256=rare94DN7Cij4IizBscwl6TBQvQy_RkVt8SgnUBZW1I,1278
|
18
18
|
gibson/command/Modify.py,sha256=jYx8ojVoecPAX_YasvpGGqq2d0dl2FfCB3WAlSxtdtM,1269
|
19
|
-
gibson/command/Module.py,sha256=m2vEbYsZgb9H5jUsDcle4amoclvSMy1u75EVrARTy4I,1247
|
20
|
-
gibson/command/New.py,sha256=YEnH9zVXGvSL5xb07EIimRWduBRYKpuBclZJyuT6T64,1179
|
21
19
|
gibson/command/OpenApi.py,sha256=mdjgzDgJTu8aMuI1bojExEAstCQuFzhFCnutNSm9z14,4313
|
22
20
|
gibson/command/Question.py,sha256=KHFDLI3ItIFg3Qeeamy_zaXSZQyFBXdl3LEr4iq8FOg,3986
|
23
21
|
gibson/command/Remove.py,sha256=i-ofK_uQfkgrP63vYaBxDTIhzs_-4p0FFaqd3f4fJvo,2435
|
@@ -31,6 +29,9 @@ gibson/command/WarGames.py,sha256=V0KIpz-Z546qtQaOPdIVHQ6wp2n3r3M3tgKx-GRQzzU,13
|
|
31
29
|
gibson/command/auth/Auth.py,sha256=JScajZ__oSo24jzFa5NccCgc4yKgxn0BI0dXPWE5bA4,1000
|
32
30
|
gibson/command/auth/Login.py,sha256=b43OfV76i6aGdOwj1NK64ZOdYlNyc08g3lZGQ_37KDw,437
|
33
31
|
gibson/command/auth/Logout.py,sha256=V01q4TdbiBqCnIrM6IA4T25fO6ws0UpXp42I3pwHZVM,248
|
32
|
+
gibson/command/new/Module.py,sha256=XTbfdWKiccEfuqjcCA2Fg1kfl2ngbHGjDhCrbTvevi4,1562
|
33
|
+
gibson/command/new/New.py,sha256=o-LMZurujp6cp01xKCdHY02F0hakXG3N7qkxKm-ZN58,1214
|
34
|
+
gibson/command/new/Project.py,sha256=sExmNYDKWMIohAoBiF73nkVubgy6iMleaknXW8fWZJA,657
|
34
35
|
gibson/command/rewrite/Api.py,sha256=sSvAqEJXdgQjYcu0uiM6ndHE3GnfkfVL6eqP2Otkbww,1002
|
35
36
|
gibson/command/rewrite/Base.py,sha256=YJ2a5Hl0f9NXHUBBPvlt-dUIqEPWQz5vH6-1EHmbFbA,640
|
36
37
|
gibson/command/rewrite/Models.py,sha256=eoUpZHpR0qwNgX60EWfcNz49GHmBw_FGfBuHH2ueZqY,799
|
@@ -58,16 +59,16 @@ gibson/conf/dev/Schema.py,sha256=kOSlX1jEyVb82xd8TO8jEAimLcaefIFJr6d2JYvyTqg,74
|
|
58
59
|
gibson/conf/tests/test_conf_Dependencies.py,sha256=LITeeYiqXM5rKkyWFBqcnMvUR5pzDRuHVAngH372jWc,116
|
59
60
|
gibson/conf/tests/test_conf_Platform.py,sha256=Zc53IsZmV-hT9VRrZEPNrsuehSdWnJXWKGMmOhEqWHo,138
|
60
61
|
gibson/core/Colors.py,sha256=5XJdm9n5Sa75Hv0BYVaGVhnzsgpwfbB2pGXcbGh5EjU,1539
|
61
|
-
gibson/core/CommandRouter.py,sha256=
|
62
|
+
gibson/core/CommandRouter.py,sha256=_CN9BVHDbBMy-o0RJ4NjZ8rHbZolqSEKYwWLCNRBMMw,3999
|
62
63
|
gibson/core/Completions.py,sha256=Bsh25vnf0pjpJA6MJNR_2MA2s58Ujj8XolR8fm8AQ_s,1197
|
63
64
|
gibson/core/Configuration.py,sha256=rJq6XFS-vV8elACYmbFdnzzW4PsQb1BjyWuajfx46KQ,15787
|
64
|
-
gibson/core/Conversation.py,sha256=
|
65
|
+
gibson/core/Conversation.py,sha256=FjDeaDy7xZqSlY3Sb1VZlAyRnycjSR_8t9-84TvNcsM,8993
|
65
66
|
gibson/core/Env.py,sha256=08dZRHzzR0ahrbM4S0bXC7V1xhYQkT8Zefs00qUHf0U,498
|
66
67
|
gibson/core/Memory.py,sha256=Yw6xmqtAsFwd5Q4VgmGDt4U2dUGLyFXZ_nO8c74Oo8E,4005
|
67
68
|
gibson/core/PythonPath.py,sha256=p1q7n_5KnPvA8XbxJyvqC2vrIdEdTiMr6vRU9yj77Cs,1567
|
68
69
|
gibson/core/TimeKeeper.py,sha256=0mzs04wizjGEJbiQFWZyi4ja4XgeJaDqc0JzPCHp9po,250
|
69
70
|
gibson/core/utils.py,sha256=KTnPvA3sUYnLFTZG7Tke5YEdls8Da0rNbeaOm8hapiU,408
|
70
|
-
gibson/data/bash-completion.tmpl,sha256=
|
71
|
+
gibson/data/bash-completion.tmpl,sha256=HhLAQryO-EAc5IY6q39bH1QjtE0-BNmbTxZadLnVsZU,2701
|
71
72
|
gibson/data/default-ref-table.tmpl,sha256=cVqjTsmHDjmTGrbDEpNHaDG-GX1iWMzsQDXk5TASEXg,123
|
72
73
|
gibson/data/default-table.tmpl,sha256=4t7SmXBuZN4nV5SjuQp6PBdo0-c3hdRnl8TQ2wdaS3w,247
|
73
74
|
gibson/db/TableExceptions.py,sha256=F1NGHDhusg9E_3tLez1_abrbANtWyR0UtC_wE9CwNFE,137
|
@@ -107,8 +108,8 @@ gibson/structure/tests/test_Entity.py,sha256=Gl9f1NcEKdpWCx4W3takFFzp18mLhCYWKrd
|
|
107
108
|
gibson/tests/test_Env.py,sha256=DPWmP0-aEelducq9bAwv7rKoY2NjWXUeCrzfJDQkn2M,369
|
108
109
|
gibson/tests/test_Memory.py,sha256=YP7owToABAk_-s7fD5UG0HTc4lamDjdA39JUlLnk3Fg,2574
|
109
110
|
gibson/tests/test_utils.py,sha256=r_y-EG05YTCNtL8MWiAK1KmPsmeoMgypKsQC_lVgOtM,559
|
110
|
-
gibson_cli-0.5.
|
111
|
-
gibson_cli-0.5.
|
112
|
-
gibson_cli-0.5.
|
113
|
-
gibson_cli-0.5.
|
114
|
-
gibson_cli-0.5.
|
111
|
+
gibson_cli-0.5.2.dist-info/METADATA,sha256=jMUs0Mfz7ffTyq0b4SQ-AsTqlSvFKCsuzagox03Lzvw,11605
|
112
|
+
gibson_cli-0.5.2.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
|
113
|
+
gibson_cli-0.5.2.dist-info/entry_points.txt,sha256=j5VUvq3AzL21xPvVC24zMoXFt-I5lUWulr66nL3OAPM,50
|
114
|
+
gibson_cli-0.5.2.dist-info/top_level.txt,sha256=RFaUY7VXGiqkMwo1Rj7pM4kGvxkhhnfo-2LmPpuL_fs,11
|
115
|
+
gibson_cli-0.5.2.dist-info/RECORD,,
|
gibson/command/Module.py
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
import re
|
2
|
-
import sys
|
3
|
-
|
4
|
-
from gibson.api.Cli import Cli
|
5
|
-
from gibson.command.BaseCommand import BaseCommand
|
6
|
-
from gibson.core.Colors import command, hint, input, subcommand
|
7
|
-
|
8
|
-
|
9
|
-
class Module(BaseCommand):
|
10
|
-
def execute(self):
|
11
|
-
if len(sys.argv) != 3:
|
12
|
-
self.usage()
|
13
|
-
|
14
|
-
self.configuration.ensure_project()
|
15
|
-
if not re.search("^[a-z0-9]+$", sys.argv[2]):
|
16
|
-
self.configuration.display_project()
|
17
|
-
self.conversation.type("[module name] should only contain ^[a-z0-9]+$.\n\n")
|
18
|
-
return True
|
19
|
-
|
20
|
-
cli = Cli(self.configuration)
|
21
|
-
|
22
|
-
response = cli.modeler_module(
|
23
|
-
self.configuration.project.modeler.version,
|
24
|
-
self.configuration.project.description,
|
25
|
-
sys.argv[2],
|
26
|
-
)
|
27
|
-
|
28
|
-
self.memory.remember_last(response)
|
29
|
-
|
30
|
-
for entity in response["entities"]:
|
31
|
-
print(entity["definition"])
|
32
|
-
self.conversation.newline()
|
33
|
-
|
34
|
-
def usage(self):
|
35
|
-
self.configuration.display_project()
|
36
|
-
self.conversation.type(
|
37
|
-
f"usage: {command(self.configuration.command)} {subcommand('module')} {input('[module name]')} {hint('create a new module for this project')}\n"
|
38
|
-
)
|
39
|
-
self.conversation.newline()
|
40
|
-
exit(1)
|
File without changes
|
File without changes
|
File without changes
|