Пример #1
0
def init(argv):
    flag = argv.pop(0) if argv[0][0] == '-' else None

    if flag == '-h':
        help_text = get_help_text(argv)

        if help_text is None:
            err('Can\'t help :(')

        else:
            print help_text

    else:
        try:
            execCommand(argv, flag == '-p')
            # Check: Should the dispatch mode log the return value? It isn't logging it now to keep the console from excess output.

        except HandledException as e:
            Member = e.Info.get('Member')

            if Member:
                alias = Member.Config.get('alias')
                name = Member.Config['name']

                if name == '__main__':
                    name = 'Members'

                label = '%s%s' % (name, ', %s' % alias if alias else '')
                e = '%s\n\n%s\n%s\n%s' % (str(e), label, '-' * len(label),
                                          getMemberHelp(Member))

            err(e, 1)
Пример #2
0
def init(argv):
  flag = argv.pop(0) if argv[0][0] == '-' else None

  if flag == '-h':
    help_text = get_help_text(argv)

    if help_text is None:
      err('Can\'t help :(')

    else:
      print help_text

  else:
    try:
      execCommand(argv, flag == '-p')
      # Check: Should the dispatch mode log the return value? It isn't logging it now to keep the console from excess output.

    except HandledException as e:
      Member = e.Info.get('Member')

      if Member:
        alias = Member.Config.get('alias')
        name = Member.Config['name']

        if name == '__main__':
          name = 'Members'

        label = '%s%s' % (name, ', %s' % alias if alias else '')
        e = '%s\n\n%s\n%s\n%s' % (str(e), label, '-' * len(label), getMemberHelp(Member))

      err(e, 1)
Пример #3
0
  def worker(line):
    try:
      result = execCommand(split(line), True)
      print '' if result is None else '%s\n' % str(result)

    except HandledException as e:
      err('%s\n' % e)
Пример #4
0
def init():
  if Settings.get('helper_tasks', True):
    import helper_tasks
    helper_tasks.main()

  while True:
    try:
      line = raw_input('>')

      if line:
        result = execCommand(split(line), True)
        print '' if result is None else '%s\n' % str(result)

    except HandledException as e:
      err('%s\n' % e)

    except EOFError: # ^z (null character) was passed
      exit()