#!/usr/bin/python3 -s
# -*- coding: utf-8 -*-

import readline
from restshlib.restcmd import RestSH
import sys
import traceback

DEBUG = False

HELP_TEXT = '''Usage: command [<command-option>...]

Cliente commands:
  set <header|setting> <header-key> <header-value>
  unset <header|setting> <header-key>
  show <headers|settings>
  prompt <new-prompt>
  login <username>
  baseurl <host>
  help [<command>]

Rest actions:
  get <url>
  post <url> <data>
  put <url> <data>
  delete <url>
'''

if __name__ ==  '__main__':
    restsh = RestSH()
    while True:
        try:
            restsh.cmdloop()
        except Exception as e:
            if DEBUG:
                exc_type, exc_value, exc_traceback = sys.exc_info()
                print("*** print_tb:")
                traceback.print_tb(exc_traceback, file=sys.stdout)
            print("ERROR: %s " % str(e))
