File: hello

package info (click to toggle)
python-milc 1.9.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 788 kB
  • sloc: python: 1,868; sh: 55; makefile: 3
file content (20 lines) | stat: -rwxr-xr-x 638 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python3
"""Hello World implementation using MILC.

PYTHON_ARGCOMPLETE_OK
"""
from milc import cli


@cli.argument('-c', '--comma', arg_only=True, help='comma in output', default=True, action='store_boolean')
@cli.argument('-n', '--name', help='Name to greet', default='World')
@cli.entrypoint('Greet a user.')
def main(cli):
    comma = ',' if cli.args.comma else ''
    cli.log.debug('You used -v you lucky person!')
    cli.log.info('Hello%s %s, from cli.log.info!', comma, cli.config.general.name)
    cli.echo('{fg_red}Hello%s %s, from cli.echo!', comma, cli.config.general.name)


if __name__ == '__main__':
    cli()