getprops 703 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env python3
  2. import common
  3. import json
  4. import path_properties
  5. class Main(common.LkmcCliFunction):
  6. def __init__(self):
  7. super().__init__(
  8. defaults = {
  9. 'show_time': False,
  10. },
  11. description='''\
  12. Get the path_properties for an userland executable:
  13. https://cirosantilli.com/linux-kernel-module-cheat#path-properties
  14. TODO check that the path exists.
  15. ''',
  16. )
  17. self.add_argument('path')
  18. def timed_main(self):
  19. properties = path_properties.get(self.env['path']).properties
  20. for key in sorted(properties):
  21. print('{}={}'.format(key, properties[key]))
  22. if __name__ == '__main__':
  23. Main().cli()