forked from flojoy-ai/studio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfjblock.py
33 lines (25 loc) · 871 Bytes
/
fjblock.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import os
import sys
import typer
from rich import print
from cli.cmd import add, sync
from cli.constants import BLOCKS_DOCS_FOLDER, BLOCKS_SOURCE_FOLDER, ERR_STRING
from cli.logging import err_console
from cli.state import state
app = typer.Typer()
app.command()(add.add)
app.command()(sync.sync)
@app.callback()
def main(verbose: bool = False):
if verbose:
print("Verbose mode is on!")
state["verbose"] = True
if __name__ == "__main__":
# this is to make sure we are running the cli in the right directory
required_folders = [BLOCKS_DOCS_FOLDER, BLOCKS_SOURCE_FOLDER]
if not all([os.path.isdir(folder) for folder in required_folders]):
err_console.print(
f"{ERR_STRING} fjblock.py must be run at a directory where the following folders are present: {required_folders}"
)
sys.exit(1)
app()