35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
from collections import namedtuple as nt
|
|
from cliget import _load_catalog as ldc, _local_version as lv, _gh_version
|
|
from semver import VersionInfo
|
|
|
|
Result = nt('res', "cli lver gh rver asset exe")
|
|
#Result.__repr__ = lambda x: f'{x.gh}'
|
|
|
|
# catalog completion report:
|
|
ctl = ldc({'__catalog':'catalog.yaml'})
|
|
|
|
|
|
if __name__ == '__main__':
|
|
report = []
|
|
for cli, props in ctl.items():
|
|
lver, gh, rver, asset, exe = (False,)*5 # it is False until it is True
|
|
# output semver on `--version`
|
|
lver = lv(cli) > VersionInfo(0)
|
|
# has github repo
|
|
gh = props.github is not None
|
|
if gh:
|
|
# has semver release
|
|
rver = _gh_version(props.github) > VersionInfo(0)
|
|
# has linux + x86_64 + tgz asset
|
|
# has exe at a known place
|
|
r = Result(cli, lver, gh, rver, asset, exe)
|
|
report.append(r)
|
|
print(r)
|
|
tick = '\u2713'
|
|
sad = '\U0001F61E'
|
|
report = ["cli lver gh rver asset exe".split()] + [tuple(map(lambda x: ['-', tick][x] if type(x)==bool else x,r)) for r in report]
|
|
from terminaltables import SingleTable
|
|
table = SingleTable(report)
|
|
table.inner_row_border=False
|
|
print(table.table)
|