Skip to content
This repository was archived by the owner on May 2, 2023. It is now read-only.

Commit 47385e4

Browse files
authored
Merge pull request #3 from datafold/dev
Added main with repl command
2 parents ba4bb30 + c8cf3e5 commit 47385e4

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

sqeleton/__main__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import click
2+
from .repl import repl as repl_main
3+
4+
@click.group(no_args_is_help=True)
5+
def cli():
6+
pass
7+
8+
@cli.command(no_args_is_help=True)
9+
@click.argument("database", required=True)
10+
def repl(database):
11+
return repl_main(database)
12+
13+
14+
if __name__ == '__main__':
15+
cli()

sqeleton/repl.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ def help():
2727
rich.print("Otherwise, runs regular SQL query")
2828

2929

30-
def main():
31-
uri = sys.argv[1]
30+
def repl(uri):
3231
db = connect(uri)
3332
db_name = db.name
3433

@@ -60,6 +59,9 @@ def main():
6059
if res:
6160
print_table(res, [str(i) for i in range(len(res[0]))], q)
6261

62+
def main():
63+
uri = sys.argv[1]
64+
return repl(uri)
6365

6466
if __name__ == "__main__":
6567
main()

0 commit comments

Comments
 (0)