pyh.py 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/usr/bin/env python
  2. # encoding: utf-8
  3. import sys
  4. def python_help(help_string):
  5. try:
  6. needle = help_string
  7. if needle.startswith("'") and needle.endswith("'"):
  8. needle = needle[1:-1]
  9. elif needle.startswith('"') and needle.endswith('"'):
  10. needle = needle[1:-1]
  11. help(needle)
  12. except Exception as e:
  13. print(e)
  14. sys.stderr.write("•naked• There was an error processing the query.")
  15. sys.exit(1)
  16. def pyh_help():
  17. from Naked.toolshed.system import exit_success
  18. help_string = """
  19. Naked pyh Command Help
  20. ======================
  21. The pyh command searches the built-in Python documentation for a query term. The query term can be a Python built-in module, class/type, method, or function.
  22. USAGE
  23. naked pyh <query>
  24. SECONDARY COMMANDS
  25. none
  26. OPTIONS
  27. none
  28. EXAMPLES
  29. Module Docs: naked pyh sys
  30. Class Docs: naked pyh dict
  31. Method Docs: naked pyh dict.update
  32. Function Docs: naked pyh max"""
  33. print(help_string)
  34. exit_success()
  35. if __name__ == '__main__':
  36. pass