forked from canonical/jhack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jhack.py
executable file
·62 lines (52 loc) · 2.11 KB
/
jhack.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/python3
import typer
from charm import functional
from charm.init import init
from logger import logger
from charm.update import update
from charm.repack import repack
from charm.sync import sync as sync_packed_charm
from model.clear import sync_clear_model
from model.remove import rmodel
from utils.ffwd import fast_forward
from utils.sync import sync as sync_deployed_charm
from utils.show_relation import sync_show_relation
from utils.tail_charms import tail_events
from utils.unbork_juju import unbork_juju
from jinx.install import install as jinx_install
from jinx.init import init_jinx as jinx_init
from jinx.pack import pack as jinx_pack
from jinx.cleanup import cleanup as jinx_cleanup
if __name__ == '__main__':
model = typer.Typer(name='model', help='Juju model utilities.')
model.command(name='clear')(sync_clear_model)
model.command(name='rm')(rmodel)
utils = typer.Typer(name='utils', help='Charming utilities.')
utils.command(name='sync')(sync_deployed_charm)
utils.command(name='show-relation')(sync_show_relation)
utils.command(name='tail')(tail_events)
utils.command(name='ffwd')(fast_forward)
utils.command(name='unbork-juju')(unbork_juju)
jinx = typer.Typer(name='jinx',
help="Jinx commands. See https://github.com/PietroPasotti/jinx for more.")
jinx.command(name='install')(jinx_install)
jinx.command(name='init')(jinx_init)
jinx.command(name='pack')(jinx_pack)
jinx.command(name='cleanup')(jinx_cleanup)
charm = typer.Typer(name='charm', help='Charmcrafting utilities.')
charm.command(name='update')(update)
charm.command(name='repack')(repack)
charm.command(name='init')(init)
charm.command(name='func')(functional.run)
charm.command(name='sync')(sync_packed_charm)
app = typer.Typer(name='jhack', help='Hacky, wacky, but ultimately charming.')
app.add_typer(model)
app.add_typer(jinx)
app.add_typer(charm)
app.add_typer(utils)
@app.callback()
def main(verbose: bool = False):
if verbose:
typer.echo("::= Verbose mode. =::")
logger.setLevel('INFO')
app()