-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks.py
32 lines (25 loc) · 880 Bytes
/
tasks.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
""" Invoke tasks for GreenPaths 2 CLI. """
# used to unify calling of green_paths_2_cli.py
# currently using monkeypatch to fix getargspec issue
# invoke seems not be too active so using green_paths_2_cli.py directly might be better?
import inspect
import os
import sys
if not hasattr(inspect, "getargspec"):
inspect.getargspec = inspect.getfullargspec
from invoke import task
@task
def gp2(c, args=""):
"""
Runs the GreenPaths 2 CLI with optional arguments.
"""
command = f"poetry run python -u green_paths_2_cli.py {args}"
# Check if the operating system is Windows
if os.name == "nt": # 'nt' means Windows
c.run(
command, echo=True, out_stream=sys.stdout, err_stream=sys.stderr, pty=False
)
else:
c.run(
command, echo=True, out_stream=sys.stdout, err_stream=sys.stderr, pty=True
)