locate.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/usr/bin/env python
  2. # encoding: utf-8
  3. import os
  4. from Naked.toolshed.system import stderr, exit_success
  5. class Locator:
  6. def __init__(self, needle):
  7. self.needle = needle
  8. self.location = self._display_location()
  9. def _display_location(self):
  10. if self.needle == 'main':
  11. main_path = os.path.join('<PROJECT>', 'lib', '<PROJECT>', 'app.py')
  12. print("app.py : " + main_path)
  13. exit_success()
  14. elif self.needle == "settings":
  15. settings_path = os.path.join('<PROJECT>', 'lib', '<PROJECT>','settings.py')
  16. print("settings.py : " + settings_path)
  17. exit_success()
  18. elif self.needle == "setup":
  19. setup_path = os.path.join('<PROJECT>', 'setup.py')
  20. print("setup.py : " + setup_path)
  21. exit_success()
  22. else:
  23. stderr("Unable to process the command. Use 'naked locate help' for more information.", 1)
  24. def help():
  25. help_string = """
  26. Naked locate Command Help
  27. =========================
  28. The locate command identifies the file path to commonly used files in your project directory.
  29. USAGE
  30. naked locate <argument>
  31. SECONDARY COMMANDS
  32. main - the main application script file, app.py
  33. setup - the setup.py file
  34. settings - the project settings files, settings.py
  35. OPTIONS
  36. none
  37. EXAMPLE
  38. naked locate main"""
  39. print(help_string)
  40. exit_success()
  41. if __name__ == '__main__':
  42. pass