blob: 06acd6c6af95166d843a4823f9edc07a15deaf5e (
plain) (
blame)
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
|
#!/usr/bin/env python3
import argparse
import sys
from pathlib import Path
from taskipy.exceptions import TaskipyError
from taskipy.task_runner import TaskRunner
def main():
parser = argparse.ArgumentParser(
prog='task',
description='runs a task specified in your pyproject.toml under [tool.taskipy.tasks]',
)
parser.add_argument('name', help='name of the task')
parser.add_argument(
'args', nargs=argparse.REMAINDER, help='arguments to pass to the task'
)
args = parser.parse_args()
try:
exit_code = TaskRunner(Path.cwd() / 'pyproject.toml').run(args.name, args.args)
sys.exit(exit_code)
except TaskipyError as e:
print(e)
sys.exit(e.exit_code)
except Exception as e:
print(e)
sys.exit(1)
if __name__ == '__main__':
main()
|