gibson-cli 0.5.8__py3-none-any.whl → 0.6.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.
gibson/command/Help.py CHANGED
@@ -37,7 +37,7 @@ class Help(BaseCommand):
37
37
  },
38
38
  "help": {"description": "for help", "memory": None},
39
39
  "import": {
40
- "description": "configure from a data source",
40
+ "description": "import entities from a data source",
41
41
  "memory": "stored",
42
42
  },
43
43
  "list": {
@@ -57,7 +57,6 @@ class Help(BaseCommand):
57
57
  "memory": "last > stored",
58
58
  },
59
59
  "new": {"description": "create something new", "memory": None},
60
- "openapi": {"description": "build from an OpenAPI spec", "memory": "last"},
61
60
  "remove": {
62
61
  "description": "remove an entity from the project",
63
62
  "memory": "last > stored",
@@ -80,7 +79,7 @@ class Help(BaseCommand):
80
79
  "memory": "stored",
81
80
  },
82
81
  "tree": {"description": "illustrate the project layout", "memory": None},
83
- "? | q": {"description": "ask a question", "memory": None},
82
+ "q": {"description": "ask Gibson a question", "memory": None},
84
83
  }
85
84
 
86
85
  self.conversation.set_delay(0.001)
gibson/command/Show.py CHANGED
@@ -26,9 +26,7 @@ class Show(BaseCommand):
26
26
  self.usage()
27
27
 
28
28
  for entity in sorted(entities, key=lambda x: x["name"]):
29
- statement = entity["definition"].replace(
30
- entity["name"], Colors.argument(entity["name"]), 1
31
- )
29
+ statement = Colors.table(entity["definition"], entity["name"])
32
30
  print(f"\n{statement}")
33
31
 
34
32
  def usage(self):
@@ -37,7 +35,7 @@ class Show(BaseCommand):
37
35
  f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('show')} {Colors.hint('display the entire schema')}\n"
38
36
  )
39
37
  self.conversation.type(
40
- f" or: {Colors.command(self.configuration.command)} {Colors.subcommand('show')} {Colors.argument('[entity name]')} {Colors.hint('display the schema for an entity')}\n"
38
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('show')} {Colors.argument('[entity name]')} {Colors.hint('display the schema for an entity')}\n"
41
39
  )
42
40
  self.conversation.newline()
43
41
  exit(1)
@@ -20,10 +20,13 @@ class Auth(BaseCommand):
20
20
  def usage(self):
21
21
  self.configuration.display_project()
22
22
  self.conversation.type(
23
- f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('auth')} {Colors.argument('login')} {Colors.hint('login to Gibson')}\n"
23
+ f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('auth')} {Colors.arguments(['login', 'logout'])}\n"
24
24
  )
25
25
  self.conversation.type(
26
- f" or: {Colors.command(self.configuration.command)} {Colors.subcommand('auth')} {Colors.argument('logout')} {Colors.hint('logout of Gibson')}\n"
26
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('auth')} {Colors.argument('login')} {Colors.hint('login to Gibson')}\n"
27
+ )
28
+ self.conversation.type(
29
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('auth')} {Colors.argument('logout')} {Colors.hint('logout of Gibson')}\n"
27
30
  )
28
31
  self.conversation.newline()
29
32
  exit(1)
@@ -3,24 +3,40 @@ import sys
3
3
  import gibson.core.Colors as Colors
4
4
  from gibson.command.BaseCommand import BaseCommand
5
5
  from gibson.command.code.Entity import CodeEntity
6
+ from gibson.command.code.Model import CodeModel
7
+ from gibson.command.code.Schema import CodeSchema
8
+ from gibson.command.code.Tests import CodeTests
6
9
 
7
10
 
8
11
  class Code(BaseCommand):
9
12
  def execute(self):
10
13
  if len(sys.argv) == 4 and sys.argv[2] == "entity":
11
14
  CodeEntity(self.configuration).execute()
15
+ elif len(sys.argv) == 4 and sys.argv[2] == "model":
16
+ CodeModel(self.configuration).execute()
17
+ elif len(sys.argv) == 4 and sys.argv[2] == "schema":
18
+ CodeSchema(self.configuration).execute()
19
+ elif len(sys.argv) == 4 and sys.argv[2] == "tests":
20
+ CodeTests(self.configuration).execute()
12
21
  else:
13
22
  self.usage()
14
23
 
15
24
  def usage(self):
16
25
  self.configuration.display_project()
17
26
  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"
27
+ f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.arguments(['entity', 'model', 'schema', 'tests'])} {Colors.input('[entity name]')} {Colors.hint('write code')}\n"
28
+ )
29
+ self.conversation.type(
30
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.argument('entity')} {Colors.input('[entity name]')} {Colors.hint('create or update an entity using the AI pair programmer')}\n"
31
+ )
32
+ self.conversation.type(
33
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.argument('model')} {Colors.input('[entity name]')} {Colors.hint('generate the model code for an entity')}\n"
34
+ )
35
+ self.conversation.type(
36
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.argument('schema')} {Colors.input('[entity name]')} {Colors.hint('generate the schema code for an entity')}\n"
19
37
  )
20
- self.conversation.newline()
21
38
  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"
39
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.argument('tests')} {Colors.input('[entity name]')} {Colors.hint('generate the unit tests for an entity')}\n"
24
40
  )
25
41
  self.conversation.newline()
26
42
  exit(1)
@@ -2,6 +2,7 @@ import os
2
2
  import sys
3
3
  from string import Template
4
4
 
5
+ import gibson.core.Colors as Colors
5
6
  from gibson.api.Cli import Cli
6
7
  from gibson.command.BaseCommand import BaseCommand
7
8
  from gibson.command.Merge import Merge
@@ -163,7 +164,7 @@ class CodeEntity(BaseCommand):
163
164
  print("")
164
165
  print(Header().render("SQL"))
165
166
  print("")
166
- print(entity.create_statement())
167
+ print(Colors.table(entity.create_statement(), entity.name))
167
168
 
168
169
  print("")
169
170
  print(Header().render("Model"))
@@ -7,16 +7,13 @@ from gibson.core.TimeKeeper import TimeKeeper
7
7
  from gibson.dev.Dev import Dev
8
8
 
9
9
 
10
- class Model(BaseCommand):
10
+ class CodeModel(BaseCommand):
11
11
  def execute(self):
12
- if len(sys.argv) != 3:
13
- self.usage()
14
-
15
12
  self.configuration.require_project()
16
- entity = self.memory.recall_stored_entity(sys.argv[2])
13
+ entity = self.memory.recall_stored_entity(sys.argv[3])
17
14
  if entity is None:
18
15
  self.conversation.not_sure_no_entity(
19
- self.configuration.project.name, sys.argv[2]
16
+ self.configuration.project.name, sys.argv[3]
20
17
  )
21
18
  exit(1)
22
19
 
@@ -29,13 +26,10 @@ class Model(BaseCommand):
29
26
  response["code"][0]["entity"]["name"], response["code"][0]["definition"]
30
27
  )
31
28
 
29
+ if self.configuration.project.dev.active is True:
30
+ self.conversation.type(
31
+ f"Gibson wrote the following {Colors.argument('model')} code to your project:\n"
32
+ )
33
+
32
34
  print(response["code"][0]["definition"])
33
35
  time_keeper.display()
34
-
35
- def usage(self):
36
- self.configuration.display_project()
37
- self.conversation.type(
38
- f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('model')} {Colors.input('[entity name]')} {Colors.hint('generate the model for an entity')}\n"
39
- )
40
- self.conversation.newline()
41
- exit(1)
@@ -7,16 +7,13 @@ from gibson.core.TimeKeeper import TimeKeeper
7
7
  from gibson.dev.Dev import Dev
8
8
 
9
9
 
10
- class Schema(BaseCommand):
10
+ class CodeSchema(BaseCommand):
11
11
  def execute(self):
12
- if len(sys.argv) != 3:
13
- self.usage()
14
-
15
12
  self.configuration.require_project()
16
- entity = self.memory.recall_stored_entity(sys.argv[2])
13
+ entity = self.memory.recall_stored_entity(sys.argv[3])
17
14
  if entity is None:
18
15
  self.conversation.not_sure_no_entity(
19
- self.configuration.project.name, sys.argv[2]
16
+ self.configuration.project.name, sys.argv[3]
20
17
  )
21
18
  exit(1)
22
19
 
@@ -29,13 +26,10 @@ class Schema(BaseCommand):
29
26
  response["code"][0]["entity"]["name"], response["code"][0]["definition"]
30
27
  )
31
28
 
29
+ if self.configuration.project.dev.active is True:
30
+ self.conversation.type(
31
+ f"Gibson wrote the following {Colors.argument('schema')} code to your project:\n"
32
+ )
33
+
32
34
  print(response["code"][0]["definition"])
33
35
  time_keeper.display()
34
-
35
- def usage(self):
36
- self.configuration.display_project()
37
- self.conversation.type(
38
- f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('schema')} {Colors.argument('[entity name]')} {Colors.hint('write the schema code for an entity')}\n"
39
- )
40
- self.conversation.newline()
41
- exit(1)
@@ -7,16 +7,13 @@ from gibson.core.TimeKeeper import TimeKeeper
7
7
  from gibson.dev.Dev import Dev
8
8
 
9
9
 
10
- class Test(BaseCommand):
10
+ class CodeTests(BaseCommand):
11
11
  def execute(self):
12
- if len(sys.argv) != 3:
13
- self.usage()
14
-
15
12
  self.configuration.require_project()
16
- entity = self.memory.recall_stored_entity(sys.argv[2])
13
+ entity = self.memory.recall_stored_entity(sys.argv[3])
17
14
  if entity is None:
18
15
  self.conversation.not_sure_no_entity(
19
- self.configuration.project.name, sys.argv[2]
16
+ self.configuration.project.name, sys.argv[3]
20
17
  )
21
18
  exit(1)
22
19
 
@@ -29,13 +26,10 @@ class Test(BaseCommand):
29
26
  response["code"][0]["entity"]["name"], response["code"][0]["definition"]
30
27
  )
31
28
 
29
+ if self.configuration.project.dev.active is True:
30
+ self.conversation.type(
31
+ f"Gibson wrote the following {Colors.argument('tests')} to your project:\n"
32
+ )
33
+
32
34
  print(response["code"][0]["definition"])
33
35
  time_keeper.display()
34
-
35
- def usage(self):
36
- self.configuration.display_project()
37
- self.conversation.type(
38
- f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('test')} {Colors.argument('[entity name]')} {Colors.hint('write the unit tests for an entity')}\n"
39
- )
40
- self.conversation.newline()
41
- exit(1)
@@ -6,44 +6,30 @@ from sqlalchemy.orm import sessionmaker
6
6
  import gibson.core.Colors as Colors
7
7
  from gibson.api.Cli import Cli
8
8
  from gibson.command.BaseCommand import BaseCommand
9
+ from gibson.command.importer.OpenApi import OpenApi
9
10
  from gibson.command.rewrite.Rewrite import Rewrite
10
11
  from gibson.db.TableExceptions import TableExceptions
11
12
 
12
13
 
13
14
  class Import(BaseCommand):
14
15
  def execute(self):
15
- if len(sys.argv) != 3 and len(sys.argv) != 5:
16
- self.usage()
17
-
18
16
  self.configuration.require_project()
19
17
  write_code = False
20
- if len(sys.argv) == 5:
21
- if sys.argv[3] != ".." or sys.argv[4] != "dev":
22
- self.usage()
23
-
24
- if self.configuration.project.dev.active is False:
25
- self.configuration.display_project()
26
- self.conversation.type(
27
- "Dude, seriously?! You have Dev Mode turned off. "
28
- + "Why would you do that?\n"
29
- )
30
- self.conversation.newline()
31
- exit(1)
32
-
33
- write_code = True
34
18
 
35
- if sys.argv[2] == "api":
19
+ if len(sys.argv) == 3 and sys.argv[2] == "api":
36
20
  entities = self.__import_from_api()
37
- elif sys.argv[2] == "datastore":
21
+ write_code = self.configuration.project.dev.active
22
+ elif len(sys.argv) == 3 and sys.argv[2] == "datastore":
38
23
  entities = self.__import_from_datastore()
24
+ write_code = self.configuration.project.dev.active
25
+ elif len(sys.argv) == 4 and sys.argv[2] == "openapi":
26
+ return OpenApi(self.configuration).execute()
39
27
  else:
40
28
  self.usage()
41
29
 
42
30
  self.memory.remember_entities(entities)
43
31
 
44
- word_entities = "entities"
45
- if len(entities) == 1:
46
- word_entities = "entity"
32
+ word_entities = "entity" if len(entities) == 1 else "entities"
47
33
 
48
34
  self.conversation.type("\nSummary\n")
49
35
  self.conversation.type(f" {len(entities)} {word_entities} imported\n")
@@ -62,7 +48,6 @@ class Import(BaseCommand):
62
48
  response = Cli(self.configuration).import_()
63
49
  self.conversation.type("Building schema...\n")
64
50
 
65
- entities = []
66
51
  for entity in response["project"]["entities"]:
67
52
  self.conversation.type(f" {entity['name']}\n", delay=0.002)
68
53
 
@@ -106,13 +91,16 @@ class Import(BaseCommand):
106
91
  else ""
107
92
  )
108
93
  self.conversation.type(
109
- f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('import')} {Colors.argument('api')} {Colors.hint('import all entities from your project created on GibsonAI.com')}\n"
94
+ f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('import')} {Colors.arguments(['api', 'datastore', 'openapi'])} {Colors.hint('import entities')}\n"
95
+ )
96
+ self.conversation.type(
97
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('import')} {Colors.argument('api')} {Colors.hint(f'import all entities from your project created on {Colors.link(self.configuration.app_domain())}')}\n"
110
98
  )
111
99
  self.conversation.type(
112
- f" or: {Colors.command(self.configuration.command)} {Colors.subcommand('import')} {Colors.argument('datastore')} {Colors.hint('import all entities from your local datastore')} {datastore_uri}\n"
100
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('import')} {Colors.argument('datastore')} {Colors.hint('import all entities from your local datastore')} {Colors.link(datastore_uri)}\n"
113
101
  )
114
102
  self.conversation.type(
115
- f" or: {Colors.command(self.configuration.command)} {Colors.subcommand('import')} {Colors.arguments(['api', 'datastore'])} {Colors.option('.. dev')} {Colors.hint('have dev mode write all the code')}\n"
103
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('import')} {Colors.argument('openapi')} {Colors.input('path/to/openapi.json')} {Colors.hint('import all entities from an OpenAPI spec file')}\n"
116
104
  )
117
105
  self.conversation.newline()
118
106
  exit(1)
@@ -2,7 +2,6 @@ import json
2
2
  import re
3
3
  import sys
4
4
 
5
- import gibson.core.Colors as Colors
6
5
  from gibson.api.Cli import Cli
7
6
  from gibson.command.BaseCommand import BaseCommand
8
7
 
@@ -17,11 +16,8 @@ class OpenApi(BaseCommand):
17
16
  exit(1)
18
17
 
19
18
  def execute(self):
20
- if len(sys.argv) != 3:
21
- self.usage()
22
-
23
19
  try:
24
- with open(sys.argv[2], "r") as f:
20
+ with open(sys.argv[3], "r") as f:
25
21
  contents = json.loads(f.read())
26
22
  except FileNotFoundError:
27
23
  self.file_not_found()
@@ -119,7 +115,7 @@ class OpenApi(BaseCommand):
119
115
  def file_not_found(self):
120
116
  self.configuration.display_project()
121
117
  self.conversation.type(
122
- f'Well that embarrassing. There is no file "{sys.argv[2]}".\n'
118
+ f'Well that embarrassing. There is no file "{sys.argv[3]}".\n'
123
119
  )
124
120
  self.conversation.newline()
125
121
  exit(1)
@@ -131,11 +127,3 @@ class OpenApi(BaseCommand):
131
127
  )
132
128
  self.conversation.newline()
133
129
  exit(1)
134
-
135
- def usage(self):
136
- self.configuration.display_project()
137
- self.conversation.type(
138
- f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('openapi')} {Colors.input('[file path]')} {Colors.hint('import entities from an OpenAPI spec file')}\n"
139
- )
140
- self.conversation.newline()
141
- exit(1)
@@ -18,10 +18,13 @@ class List(BaseCommand):
18
18
  def usage(self):
19
19
  self.configuration.display_project()
20
20
  self.conversation.type(
21
- f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('list')} {Colors.arguments(['entities'])} {Colors.hint('list all entities')}\n"
21
+ f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('list')} {Colors.arguments(['entities', 'projects'])}\n"
22
22
  )
23
23
  self.conversation.type(
24
- f" or: {Colors.command(self.configuration.command)} {Colors.subcommand('list')} {Colors.arguments(['projects'])} {Colors.hint('list all projects')}\n"
24
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('list')} {Colors.argument('entities')} {Colors.hint('list all entities')}\n"
25
+ )
26
+ self.conversation.type(
27
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('list')} {Colors.argument('projects')} {Colors.hint('list all projects')}\n"
25
28
  )
26
29
  self.conversation.newline()
27
30
  exit(1)
gibson/command/new/New.py CHANGED
@@ -9,13 +9,11 @@ from gibson.command.new.Project import NewProject
9
9
 
10
10
  class New(BaseCommand):
11
11
  def execute(self):
12
- if not len(sys.argv) >= 3:
13
- self.usage()
14
- elif sys.argv[2] == "project":
12
+ if len(sys.argv) == 3 and sys.argv[2] == "project":
15
13
  NewProject(self.configuration).execute()
16
- elif sys.argv[2] == "module":
14
+ elif len(sys.argv) == 3 and sys.argv[2] == "module":
17
15
  NewModule(self.configuration).execute()
18
- elif sys.argv[2] == "entity":
16
+ elif len(sys.argv) == 4 and sys.argv[2] == "entity":
19
17
  CodeEntity(self.configuration).execute()
20
18
  else:
21
19
  self.usage()
@@ -32,7 +30,7 @@ class New(BaseCommand):
32
30
  f" {Colors.command(self.configuration.command)} {Colors.subcommand('new')} {Colors.argument('module')} {Colors.hint('create a new module')}\n"
33
31
  )
34
32
  self.conversation.type(
35
- f" {Colors.command(self.configuration.command)} {Colors.subcommand('new')} {Colors.argument('entity')} {Colors.hint('create a new entity')}\n"
33
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('new')} {Colors.argument('entity')} {Colors.input('[entity name]')} {Colors.hint('create a new entity')}\n"
36
34
  )
37
35
  self.conversation.newline()
38
36
  exit(1)
@@ -121,7 +121,7 @@ class Rewrite(BaseCommand):
121
121
  f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('rewrite')} {Colors.hint('rewrite all code')}\n"
122
122
  )
123
123
  self.conversation.type(
124
- f" or: {Colors.command(self.configuration.command)} {Colors.subcommand('rewrite')} {Colors.arguments(self.arguments)} {Colors.hint('rewrite only the specified code')}\n"
124
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('rewrite')} {Colors.arguments(self.arguments)} {Colors.hint('rewrite only the specified code')}\n"
125
125
  )
126
126
  self.conversation.newline()
127
127
  exit(1)
gibson/core/Colors.py CHANGED
@@ -40,41 +40,61 @@ class Color:
40
40
  YELLOW2 = "\033[93m"
41
41
 
42
42
 
43
+ # Colorize text with a given color
43
44
  def colorize(text, color):
44
45
  return f"{color}{text}{Color.END}"
45
46
 
46
47
 
48
+ # Colorize a command
47
49
  def command(text):
48
50
  return colorize(text, Color.GREEN)
49
51
 
50
52
 
53
+ # Colorize a subcommand
51
54
  def subcommand(text):
52
55
  return colorize(text, Color.YELLOW)
53
56
 
54
57
 
58
+ # Colorize an argument
55
59
  def argument(text):
56
60
  return colorize(text, Color.VIOLET)
57
61
 
58
62
 
63
+ # Colorize a list of arguments
59
64
  def arguments(list):
60
65
  return f"[{'|'.join(map(lambda x: argument(x), list))}]"
61
66
 
62
67
 
68
+ # Colorize user input
63
69
  def input(text):
64
70
  return colorize(text, Color.WHITE2)
65
71
 
66
72
 
73
+ # Colorize a command option
67
74
  def option(text):
68
75
  return colorize(text, Color.CYAN)
69
76
 
70
77
 
78
+ # Colorize a hint
71
79
  def hint(text):
72
80
  return colorize(text, Color.GREY)
73
81
 
74
82
 
83
+ # Colorize a project name
75
84
  def project(text):
76
85
  return colorize(text, Color.BOLD)
77
86
 
78
87
 
88
+ # Colorize a URL to appear as a link
79
89
  def link(text):
80
90
  return colorize(colorize(text, Color.BLUE), Color.UNDERLINE)
91
+
92
+
93
+ # Colorize the table name in a SQL statement
94
+ def table(sql, name):
95
+ return sql.replace(name, colorize(name, Color.VIOLET))
96
+
97
+
98
+ # Colorize a time/duration output
99
+ def time(text):
100
+ return colorize(text, Color.GREEN)
@@ -8,20 +8,16 @@ 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
- from gibson.command.Import import Import
11
+ from gibson.command.importer.Import import Import
12
12
  from gibson.command.list.List import List
13
13
  from gibson.command.Merge import Merge
14
- from gibson.command.Model import Model
15
14
  from gibson.command.Modify import Modify
16
15
  from gibson.command.new.New import New
17
- from gibson.command.OpenApi import OpenApi
18
16
  from gibson.command.Question import Question
19
17
  from gibson.command.Remove import Remove
20
18
  from gibson.command.rename.Rename import Rename
21
19
  from gibson.command.rewrite.Rewrite import Rewrite
22
- from gibson.command.Schema import Schema
23
20
  from gibson.command.Show import Show
24
- from gibson.command.Test import Test
25
21
  from gibson.command.Tree import Tree
26
22
  from gibson.command.Version import Version
27
23
  from gibson.command.WarGames import WarGames
@@ -65,34 +61,24 @@ class CommandRouter:
65
61
  command = List(self.configuration)
66
62
  elif sys.argv[1] == "merge":
67
63
  command = Merge(self.configuration)
68
- elif sys.argv[1] == "model":
69
- command = Model(self.configuration)
70
64
  elif sys.argv[1] == "modify":
71
65
  command = Modify(self.configuration)
72
66
  elif sys.argv[1] == "new":
73
67
  command = New(self.configuration)
74
- elif sys.argv[1] == "openapi":
75
- command = OpenApi(self.configuration)
76
68
  elif sys.argv[1] == "remove":
77
69
  command = Remove(self.configuration)
78
70
  elif sys.argv[1] == "rename":
79
71
  command = Rename(self.configuration)
80
72
  elif sys.argv[1] == "rewrite":
81
73
  command = Rewrite(self.configuration, with_header=True)
82
- elif sys.argv[1] == "schema":
83
- command = Schema(self.configuration)
84
74
  elif sys.argv[1] == "show":
85
75
  command = Show(self.configuration)
86
- elif sys.argv[1] == "test":
87
- command = Test(self.configuration)
88
76
  elif sys.argv[1] == "tree":
89
77
  command = Tree(self.configuration)
90
- elif sys.argv[1] in ["?", "q"]:
78
+ elif sys.argv[1] in ["q"]:
91
79
  command = Question(self.configuration)
92
- elif sys.argv[1] in ["--version", "-v"]:
80
+ elif sys.argv[1] in ["version", "--version", "-v"]:
93
81
  command = Version(self.configuration)
94
- else:
95
- command = WarGames(self.configuration)
96
82
 
97
83
  if command is None or command.execute() is False:
98
84
  Help(self.configuration).execute()
gibson/core/Memory.py CHANGED
@@ -71,7 +71,7 @@ class Memory:
71
71
  def recall_last_entity(self, name):
72
72
  if self.last is not None:
73
73
  for entity in self.last["entities"]:
74
- if entity["name"] == name:
74
+ if entity["name"].lower() == name.lower():
75
75
  return entity
76
76
  return None
77
77
 
@@ -98,7 +98,7 @@ class Memory:
98
98
  def recall_stored_entity(self, name):
99
99
  if self.entities is not None:
100
100
  for entity in self.entities:
101
- if entity["name"] == name:
101
+ if entity["name"].lower() == name.lower():
102
102
  return entity
103
103
 
104
104
  return None
gibson/core/TimeKeeper.py CHANGED
@@ -1,5 +1,7 @@
1
1
  import time
2
2
 
3
+ import gibson.core.Colors as Colors
4
+
3
5
 
4
6
  class TimeKeeper:
5
7
  def __init__(self):
@@ -9,4 +11,4 @@ class TimeKeeper:
9
11
  print(self.get_display() + "\n")
10
12
 
11
13
  def get_display(self):
12
- return "[%ss]" % str(time.time() - self.__started)[0:7]
14
+ return Colors.time("[%ss]" % str(time.time() - self.__started)[0:7])
@@ -31,16 +31,12 @@ __gibson_commands_and_options() {
31
31
  import
32
32
  list
33
33
  merge
34
- model
35
34
  modify
36
35
  new
37
- openapi
38
36
  remove
39
37
  rename
40
38
  rewrite
41
- schema
42
39
  show
43
- test
44
40
  tree
45
41
  q
46
42
  '
@@ -61,16 +57,15 @@ __gibson_completions() {
61
57
  case "${previous_word}" in
62
58
  gibson) __gibson_commands_and_options ;;
63
59
  auth) __gibson_generate_completion "login logout" ;;
64
- code) __gibson_generate_completion "entity" ;;
60
+ code) __gibson_generate_completion "entity model schema tests" ;;
65
61
  conf) __gibson_generate_completion "api::key code::custom::model::class code::custom::path datastore::uri datastore::type" ;;
66
62
  dev) __gibson_generate_completion "on off" ;;
67
63
  forget) __gibson_generate_completion "stored last all" ;;
68
- import) __gibson_generate_completion "api datastore" ;;
64
+ import) __gibson_generate_completion "api datastore openapi" ;;
69
65
  list) __gibson_generate_completion "entities projects" ;;
70
66
  new) __gibson_generate_completion "project module entity" ;;
71
67
  rename) __gibson_generate_completion "entity" ;;
72
68
  rewrite) __gibson_generate_completion "api base models schemas tests" ;;
73
- # project) __gibson_generate_completion "create delete list" ;;
74
69
  esac
75
70
 
76
71
  return 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gibson-cli
3
- Version: 0.5.8
3
+ Version: 0.6.0
4
4
  Summary: Gibson Command Line Interface
5
5
  Author-email: GibsonAI <noc@gibsonai.com>
6
6
  Project-URL: Homepage, https://gibsonai.com/
@@ -10,37 +10,37 @@ gibson/command/Conf.py,sha256=MbEPT-lRujRJMBjKRQlshA3T3pplQ-zzia8RY_muWU4,2472
10
10
  gibson/command/Count.py,sha256=Jh9_ImJibpiTitbllSl0xF6KUrOhrY7Bz7-5sx9cBVs,1083
11
11
  gibson/command/Dev.py,sha256=-kmRHpOApUXklaCs4bJVqCRft4ubcVjAL7S1-BGr-ps,4355
12
12
  gibson/command/Forget.py,sha256=5fszuq6oIe0unMbXpFtDpouJ1eYZIvsi2mLsa8RwN5U,1061
13
- gibson/command/Help.py,sha256=KoHukpEk_jLNxaNdM-n4R-dXj_VZub6x4xIXbTK1_wU,4794
14
- gibson/command/Import.py,sha256=fD-PNsRk5qaOWmdmgLdFJ97wCYJDNFXzmHw_e68Lcv0,4216
13
+ gibson/command/Help.py,sha256=ZzCkPO8GJSfB84nwbWgE6qlnmvrGiJ2gQ3ut2Xb1RGc,4715
15
14
  gibson/command/Merge.py,sha256=R5ybMC1tUR5_T8YyUfXutzFa_V9j1_flv0s7KTJRq0M,1061
16
- gibson/command/Model.py,sha256=eRAAvklZjXgstGbM-P9QeG85YQ80TRVZyYTIzzUPzsk,1279
17
15
  gibson/command/Modify.py,sha256=3_fEGvLfGpgoXQ77SFA9J2KQDe1GMaAUPWkl-yCwR1E,1267
18
- gibson/command/OpenApi.py,sha256=G1LGfco0PgMIBw4C_ksja2_0nKKnZzUoiNl2iY64QKw,4314
19
16
  gibson/command/Question.py,sha256=8mWumOFKBeS_Lw8_4vF6eDIEx3kdbIwz11mLtY6e9zo,3998
20
17
  gibson/command/Remove.py,sha256=fRPJCTCQFZVfl6Ri319E1ZudADkbWBZUOPiBue1Vrao,2512
21
- gibson/command/Schema.py,sha256=zg10N6uHL37CHQRx8fH00kKS6loSS9kpFe_yv1K6-j8,1289
22
- gibson/command/Show.py,sha256=odBwJ-VXIjTnopnys586LSWm5HunfLgeNLxt-aFAPng,1589
23
- gibson/command/Test.py,sha256=HBwroaudQ1BSEsRDbv8MOOUiwXFjJgCUNnSFUi6uX3s,1283
18
+ gibson/command/Show.py,sha256=BOfgQQSo-q6RMWPgiyjcigwuW-fQmnQwUWdRbsslto8,1529
24
19
  gibson/command/Tree.py,sha256=BeJ_13xrrRCK5FP2rQHWpDKrshVzte-_D1pNG1GXPIw,3056
25
20
  gibson/command/Version.py,sha256=YLd2c9eiVT6Xzj-ulRuL9QSiu21Fid2Jp_B7nD6k86o,1267
26
21
  gibson/command/WarGames.py,sha256=V0KIpz-Z546qtQaOPdIVHQ6wp2n3r3M3tgKx-GRQzzU,1300
27
- gibson/command/auth/Auth.py,sha256=rkWhAast68jL-_XVRU-3mIx2_ntlgmAJuwYx37gNVEI,1025
22
+ gibson/command/auth/Auth.py,sha256=U8i5a7hKVjYgiJgS0kbwEmgHPCzRbMkJ8x2g6odQWSM,1204
28
23
  gibson/command/auth/Login.py,sha256=b43OfV76i6aGdOwj1NK64ZOdYlNyc08g3lZGQ_37KDw,437
29
24
  gibson/command/auth/Logout.py,sha256=V01q4TdbiBqCnIrM6IA4T25fO6ws0UpXp42I3pwHZVM,248
30
- gibson/command/code/Code.py,sha256=9nR3m1VXtbK8xUBwu3XPZj4V8tN1udbJMDImMXj9Vqs,985
31
- gibson/command/code/Entity.py,sha256=Y9Nl-e5Idq4EamK5e0gHncPupEZR8GifL7kRzxSIDAU,6001
25
+ gibson/command/code/Code.py,sha256=jv2hPW72tztuY_0QqiQyp1uKN3uH_N_IK6b6bSIogyY,2244
26
+ gibson/command/code/Entity.py,sha256=ORltg6IRSJuqdslPcH3ZaBXILwpEmwUFA77NalUeoDA,6064
27
+ gibson/command/code/Model.py,sha256=z1oD0DibVEcEeN17UDkrymj1Br0uh_TO85Iyy_1nt7g,1091
28
+ gibson/command/code/Schema.py,sha256=kSqOae_cmTaRD5JRJ9bCoBLUsPtJxxr1WcaYTRfqYis,1095
29
+ gibson/command/code/Tests.py,sha256=edDSU1KRjIu2zjU2QnGj32AunXqp2aeqyMpZU-uRXio,1087
30
+ gibson/command/importer/Import.py,sha256=_T6lKLusScqF1_oy-PcZEKreKyi_6gDmj7FDxh4BFYA,4199
31
+ gibson/command/importer/OpenApi.py,sha256=5TIpatnngcFDxsB82ij6kCdrNT6OTcImrLl51EKORxg,3871
32
32
  gibson/command/list/Entities.py,sha256=4qUxR5pBsUwnaW3SZQzCVbwyl_sCfM9lD9TWwipSyWw,1869
33
- gibson/command/list/List.py,sha256=r6YQdaeMRgFKcz-VyEQTE_I2lRaaJ4kew3E_RKKaaTU,1047
33
+ gibson/command/list/List.py,sha256=dfqPSUMYzsYwVjYMslhqdP6YcI5Q4d-EoZgxJXaR_6w,1225
34
34
  gibson/command/list/Projects.py,sha256=yR4o0eZFYxORLiEe0Z5Vs9T-hKb1NxrGVUOCrYx9qDM,1140
35
35
  gibson/command/new/Module.py,sha256=HK6CGAMvrzi5kVn7zNG6JDB5Y580djI12xHfXwFrj1w,1602
36
- gibson/command/new/New.py,sha256=PbXj6i4Dop65DWDFSoQthm1Podubh8z652l7DICL4Gc,1626
36
+ gibson/command/new/New.py,sha256=c44MylWi51y5Nqoi7b6Mv5rG_xI-Ki8IpqMLEvYthCo,1665
37
37
  gibson/command/new/Project.py,sha256=ZyYTME643Rcd-0jyy9d8lBOOKd2nncS-b-oyOFU1ffk,754
38
38
  gibson/command/rename/Entity.py,sha256=SaAiN1bYsTOsqjyVzxghK8-N3sAKITThTzS5LEYgppY,1801
39
39
  gibson/command/rename/Rename.py,sha256=T6iTjo6KRArbT8wBgrn-ehtNlY7tRlovlEZfBOUKYlk,731
40
40
  gibson/command/rewrite/Api.py,sha256=sSvAqEJXdgQjYcu0uiM6ndHE3GnfkfVL6eqP2Otkbww,1002
41
41
  gibson/command/rewrite/Base.py,sha256=YJ2a5Hl0f9NXHUBBPvlt-dUIqEPWQz5vH6-1EHmbFbA,640
42
42
  gibson/command/rewrite/Models.py,sha256=eoUpZHpR0qwNgX60EWfcNz49GHmBw_FGfBuHH2ueZqY,799
43
- gibson/command/rewrite/Rewrite.py,sha256=LUCUQsDToajd0v8uKB0N5HqIA57VjMfsFMGAFZzKb3I,4733
43
+ gibson/command/rewrite/Rewrite.py,sha256=8ABvPKTwaF3bQLH7eJg0ejcidQULBeNJV5FqZcStevY,4733
44
44
  gibson/command/rewrite/Schemas.py,sha256=zZ1gjmOJg77gh70t5y2WkzHWSAvEKx5-gqRN9OcsCXA,802
45
45
  gibson/command/rewrite/Tests.py,sha256=HO1WM6pSToVKsuJn7nUA_I5qrfBN0cgKgBzjlm2Qxt8,799
46
46
  gibson/command/tests/test_command_BaseCommand.py,sha256=hSbBfLFI3RTp_DdEHtm5oOLWoN6drI6ucFJypi7xxV8,364
@@ -63,17 +63,17 @@ gibson/conf/dev/Model.py,sha256=HbHRX3VDxR7hXlzuxkKw4Bf7FH6XMfQ96k9BeIUoBf4,73
63
63
  gibson/conf/dev/Schema.py,sha256=kOSlX1jEyVb82xd8TO8jEAimLcaefIFJr6d2JYvyTqg,74
64
64
  gibson/conf/tests/test_conf_Dependencies.py,sha256=LITeeYiqXM5rKkyWFBqcnMvUR5pzDRuHVAngH372jWc,116
65
65
  gibson/conf/tests/test_conf_Platform.py,sha256=Zc53IsZmV-hT9VRrZEPNrsuehSdWnJXWKGMmOhEqWHo,138
66
- gibson/core/Colors.py,sha256=Q974NVzqZY4x7biBXgwW2kQWQ-XZfC5MXgcL35m1ABs,1622
67
- gibson/core/CommandRouter.py,sha256=96Y38GvY14BtBNfb3LwBz-T0_qscyeo51q6xDxVjto0,3781
66
+ gibson/core/Colors.py,sha256=VLlnhQTReqNnPL0VywOMQpNsyf6hZ2ndM-RvADrO39I,2106
67
+ gibson/core/CommandRouter.py,sha256=G_4_OToiBQUgvZbO_yuIqYGus0FtV_sk6s9LzGwR4RY,3227
68
68
  gibson/core/Completions.py,sha256=Bsh25vnf0pjpJA6MJNR_2MA2s58Ujj8XolR8fm8AQ_s,1197
69
69
  gibson/core/Configuration.py,sha256=VUn1rfpzuK9zuzlXPLDtGrCXTED8qPhNxQ435kCUBKU,16370
70
70
  gibson/core/Conversation.py,sha256=QVx-YRWnre2YlkThe_8ACbx_s4ctyHJBLvgtBpdRqbQ,9836
71
71
  gibson/core/Env.py,sha256=08dZRHzzR0ahrbM4S0bXC7V1xhYQkT8Zefs00qUHf0U,498
72
- gibson/core/Memory.py,sha256=Yw6xmqtAsFwd5Q4VgmGDt4U2dUGLyFXZ_nO8c74Oo8E,4005
72
+ gibson/core/Memory.py,sha256=kAo9kFgsIAVrofTRepv81pw43Sl2zQrNFsfIy_yMb_w,4037
73
73
  gibson/core/PythonPath.py,sha256=p1q7n_5KnPvA8XbxJyvqC2vrIdEdTiMr6vRU9yj77Cs,1567
74
- gibson/core/TimeKeeper.py,sha256=0mzs04wizjGEJbiQFWZyi4ja4XgeJaDqc0JzPCHp9po,250
74
+ gibson/core/TimeKeeper.py,sha256=dSeIgGOQJOi0ULlFGAigroGTBfAZXrvP9a1Op_jIsZ0,300
75
75
  gibson/core/utils.py,sha256=KTnPvA3sUYnLFTZG7Tke5YEdls8Da0rNbeaOm8hapiU,408
76
- gibson/data/bash-completion.tmpl,sha256=X1E6EUsFDWSiLI0jmEQALpATZWKfWor65R5sOVx9Kvg,2645
76
+ gibson/data/bash-completion.tmpl,sha256=sYeWfw_i9YsSebpgZM7_0OCoKM9ujvYwQ1kntIYFx4Q,2546
77
77
  gibson/data/default-ref-table.tmpl,sha256=cVqjTsmHDjmTGrbDEpNHaDG-GX1iWMzsQDXk5TASEXg,123
78
78
  gibson/data/default-table.tmpl,sha256=4t7SmXBuZN4nV5SjuQp6PBdo0-c3hdRnl8TQ2wdaS3w,247
79
79
  gibson/db/TableExceptions.py,sha256=F1NGHDhusg9E_3tLez1_abrbANtWyR0UtC_wE9CwNFE,137
@@ -113,8 +113,8 @@ gibson/structure/tests/test_Entity.py,sha256=Gl9f1NcEKdpWCx4W3takFFzp18mLhCYWKrd
113
113
  gibson/tests/test_Env.py,sha256=DPWmP0-aEelducq9bAwv7rKoY2NjWXUeCrzfJDQkn2M,369
114
114
  gibson/tests/test_Memory.py,sha256=YP7owToABAk_-s7fD5UG0HTc4lamDjdA39JUlLnk3Fg,2574
115
115
  gibson/tests/test_utils.py,sha256=r_y-EG05YTCNtL8MWiAK1KmPsmeoMgypKsQC_lVgOtM,559
116
- gibson_cli-0.5.8.dist-info/METADATA,sha256=FCx7UVDFg94-3nlQGEXlSFLF7u1USC-Cb8rOOtXUYUk,11605
117
- gibson_cli-0.5.8.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
118
- gibson_cli-0.5.8.dist-info/entry_points.txt,sha256=j5VUvq3AzL21xPvVC24zMoXFt-I5lUWulr66nL3OAPM,50
119
- gibson_cli-0.5.8.dist-info/top_level.txt,sha256=RFaUY7VXGiqkMwo1Rj7pM4kGvxkhhnfo-2LmPpuL_fs,11
120
- gibson_cli-0.5.8.dist-info/RECORD,,
116
+ gibson_cli-0.6.0.dist-info/METADATA,sha256=WJ4VKXAhLmsza_6Y4Ff-I-Ff-w_mkBYgXqTN-1hw0cw,11605
117
+ gibson_cli-0.6.0.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
118
+ gibson_cli-0.6.0.dist-info/entry_points.txt,sha256=j5VUvq3AzL21xPvVC24zMoXFt-I5lUWulr66nL3OAPM,50
119
+ gibson_cli-0.6.0.dist-info/top_level.txt,sha256=RFaUY7VXGiqkMwo1Rj7pM4kGvxkhhnfo-2LmPpuL_fs,11
120
+ gibson_cli-0.6.0.dist-info/RECORD,,