Skip to content

Commit bfb24c9

Browse files
committed
Fix Repo already intiallized bug
1 parent 82e3a62 commit bfb24c9

File tree

4 files changed

+12
-16
lines changed

4 files changed

+12
-16
lines changed

octo/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@
55
__author__ = "Pranav Prajapati"
66
__email__ = "[email protected]"
77
__version__ = "0.1.0"
8-

octo/cli.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
# Command: Start Mindsdb server
1919
parser_start = subparsers.add_parser("start", help="Start the Mindsdb server")
20+
parser_start.add_argument("--debug", action="store_true", help="Debug mode")
21+
2022
parser_stop = subparsers.add_parser("stop", help="Stop the Mindsdb server")
2123

2224
# Command: init
@@ -59,8 +61,8 @@ def main():
5961
except:
6062
if args.command == "start":
6163
with console.status("[bold green]Starting Mindsdb...", spinner="dots2"):
62-
octo.start_local()
63-
console.print(f"[bold][green]Started Mindsdb local server")
64+
octo.start_local(debug=args.debug)
65+
console.print(f"[bold][green]Started Mindsdb local server")
6466
else:
6567
console.print(
6668
"[bold][red]Error: Mindsdb server is not running. Use 'octo start' to start the server."
@@ -73,8 +75,8 @@ def main():
7375

7476
if args.command == "init":
7577
try:
76-
owner = args.repo.split("/")[0]
77-
repo = args.repo.split("/")[1]
78+
owner = args.repo.split("/")[0].lower()
79+
repo = args.repo.split("/")[1].lower()
7880
except:
7981
console.print(
8082
"[bold][red]Error: Invalid repository name, format should be 'owner/repo'"
@@ -154,6 +156,5 @@ def main():
154156
console.print(i)
155157

156158

157-
158159
if __name__ == "__main__":
159160
main()

octo/github_handle/mindsdb_octo.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ def __init__(self):
1515
"""
1616
self.connection_string = "http://127.0.0.1:47334"
1717

18-
def start_local(self):
18+
def start_local(self, debug=False):
1919
"""
2020
Connect to local installation of mindsdb
2121
"""
2222
# Run shell command to start the local mindsdb server
23-
command = "nohup python -m mindsdb > mindsdb.log 2>&1 &"
23+
if debug:
24+
command = "nohup python -m mindsdb > /dev/null 2>&1 &"
25+
else:
26+
command = "nohup python -m mindsdb > mindsdb.log 2>&1 &"
2427
subprocess.run(command, shell=True, check=True)
2528

2629
def stop_local(self):
@@ -96,5 +99,3 @@ def _get_project(self):
9699
server = mindsdb_sdk.connect(self.connection_string)
97100
project = server.get_project()
98101
return project
99-
100-

octo/github_handle/octo.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ def init(self, repo, owner, branch, all_files=False):
2323
)
2424
if not error:
2525
self._save_state()
26-
elif (
27-
self.repo.lower() == repo
28-
and self.owner.lower() == owner
29-
and self.branch.lower() == branch
30-
):
26+
elif self.repo == repo and self.owner == owner and self.branch == branch:
3127
message = f"[bold][blue]Repository already initialized."
3228
self.repo_initialized = True
3329
else:
@@ -88,4 +84,3 @@ def _load_state(self):
8884
self.repo = state["repo"]
8985
self.owner = state["owner"]
9086
self.branch = state["branch"]
91-

0 commit comments

Comments
 (0)