1from stem.manual import Manual 2from stem.util import term 3 4try: 5 print("Downloading tor's manual information, please wait...") 6 manual = Manual.from_remote() 7 print(" done\n") 8except IOError as exc: 9 print(" unsuccessful (%s), using information provided with stem\n" % exc) 10 manual = Manual.from_cache() # fall back to our bundled manual information 11 12print('Which tor configuration would you like to learn about? (press ctrl+c to quit)\n') 13 14try: 15 while True: 16 requested_option = raw_input('> ').strip() 17 18 if requested_option: 19 if requested_option in manual.config_options: 20 option = manual.config_options[requested_option] 21 print(term.format('%s %s' % (option.name, option.usage), term.Color.GREEN, term.Attr.BOLD)) 22 print(term.format(option.summary, term.Color.GREEN)) # brief description provided by stem 23 24 print(term.format('\nFull Description:\n', term.Color.GREEN, term.Attr.BOLD)) 25 print(term.format(option.description + '\n', term.Color.GREEN)) 26 else: 27 print(term.format("Sorry, we don't have any information about %s. Are you sure it's an option?" % requested_option, term.Color.RED)) 28except KeyboardInterrupt: 29 pass # user pressed ctrl+c 30 31