def pre_input_hook(): readline.insert_text(display.display( thing, shortid=False, colored=False)) readline.redisplay() # Unset the hook again readline.set_pre_input_hook(None)
def viewCb(things): things = list(things) if len(things) == 0: cmd.stdout.write("No thing found.\n") return # we let just one result go through, even if ignoreDone is True, # because our caller can show output about a task that is already done. if len(things) == 1: return things[0] if ignoreDone: things = [t for t in things if t.complete < 100] if len(things) > 1: for t in things: cmd.stdout.write("%s\n" % display.display(t)) cmd.stdout.write("%d things found, please be more specific.\n" % len(things)) return return things[0]