-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli
More file actions
executable file
·50 lines (36 loc) · 1.38 KB
/
cli
File metadata and controls
executable file
·50 lines (36 loc) · 1.38 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python3
import click
from shiftuser.cli import user_cli
from boiler.cli import cli as boiler_cli
from boiler.cli import db
# add orm cli
user_cli.add_command(db.cli, name='db')
user_cli.add_command(boiler_cli.run, name='run')
# -----------------------------------------------------------------------------
# Commands
# -----------------------------------------------------------------------------
@user_cli.command(name='importable')
def importable():
""" Make shiftuser module importable"""
import site
import os
pth = 'shiftuser.pth'
dst = os.path.join(site.getsitepackages()[0], pth)
if os.path.exists(dst):
print('Destination path file exists! {}\n'.format(dst))
return
import_from_here = os.path.dirname(os.path.realpath(__file__))
with open(dst, 'a') as file:
file.write('{}\n'.format(import_from_here))
@user_cli.command(name='test', context_settings=dict(ignore_unknown_options=True))
@click.argument('nose_argsuments', nargs=-1, type=click.UNPROCESSED)
def test(nose_argsuments):
""" Run shiftuser tests """
from nose import run
params = ['__main__', '-c', 'nose.ini']
params.extend(nose_argsuments)
run(argv=params)
# -----------------------------------------------------------------------------
# And run
# -----------------------------------------------------------------------------
user_cli()