%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /data/old/usr/lib/python2.7/site-packages/ngxtop/
Upload File :
Create Path :
Current File : //data/old/usr/lib/python2.7/site-packages/ngxtop/utils.py

import sys


def choose_one(choices, prompt):
    for idx, choice in enumerate(choices):
        print('%d. %s' % (idx + 1, choice))
    selected = None
    while not selected or selected <= 0 or selected > len(choices):
        selected = raw_input(prompt)
        try:
            selected = int(selected)
        except ValueError:
            selected = None
    return choices[selected - 1]


def error_exit(msg, status=1):
    sys.stderr.write('Error: %s\n' % msg)
    sys.exit(status)

Zerion Mini Shell 1.0