You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
4.4 KiB

  1. """
  2. Example program to demonstrate Gooey's presentation of subparsers
  3. """
  4. import argparse
  5. from gooey import Gooey, GooeyParser
  6. from gooey.examples import display_message
  7. running = True
  8. @Gooey(optional_cols=2, program_name="Subparser Demo")
  9. def main():
  10. settings_msg = 'Subparser example demonstating bundled configurations ' \
  11. 'for Siege, Curl, and FFMPEG'
  12. parser = GooeyParser(description=settings_msg)
  13. parser.add_argument('--verbose', help='be verbose', dest='verbose',
  14. action='store_true', default=False)
  15. subs = parser.add_subparsers(help='commands', dest='command')
  16. curl_parser = subs.add_parser('curl', help='curl is a tool to transfer data from or to a server')
  17. curl_parser.add_argument('Path',
  18. help='URL to the remote server',
  19. type=str, widget='FileChooser')
  20. curl_parser.add_argument('--connect-timeout',
  21. help='Maximum time in seconds that you allow curl\'s connection to take')
  22. curl_parser.add_argument('--user-agent',
  23. help='Specify the User-Agent string ')
  24. curl_parser.add_argument('--cookie',
  25. help='Pass the data to the HTTP server as a cookie')
  26. curl_parser.add_argument('--dump-header', type=argparse.FileType,
  27. help='Write the protocol headers to the specified file')
  28. curl_parser.add_argument('--progress-bar', action="store_true",
  29. help='Make curl display progress as a simple progress bar')
  30. curl_parser.add_argument('--http2', action="store_true",
  31. help='Tells curl to issue its requests using HTTP 2')
  32. curl_parser.add_argument('--ipv4', action="store_true",
  33. help=' resolve names to IPv4 addresses only')
  34. # ########################################################
  35. siege_parser = subs.add_parser('siege', help='Siege is an http/https regression testing and benchmarking utility')
  36. siege_parser.add_argument('--get',
  37. help='Pull down headers from the server and display HTTP transaction',
  38. type=str)
  39. siege_parser.add_argument('--concurrent',
  40. help='Stress the web server with NUM number of simulated users',
  41. type=int)
  42. siege_parser.add_argument('--time',
  43. help='allows you to run the test for a selected period of time',
  44. type=int)
  45. siege_parser.add_argument('--delay',
  46. help='simulated user is delayed for a random number of seconds between one and NUM',
  47. type=int)
  48. siege_parser.add_argument('--message',
  49. help='mark the log file with a separator',
  50. type=int)
  51. # ########################################################
  52. ffmpeg_parser = subs.add_parser('ffmpeg', help='Siege is an http/https regression testing and benchmarking utility')
  53. ffmpeg_parser.add_argument('Output',
  54. help='Pull down headers from the server and display HTTP transaction',
  55. widget='FileSaver', type=argparse.FileType)
  56. ffmpeg_parser.add_argument('--bitrate',
  57. help='set the video bitrate in kbit/s (default = 200 kb/s)',
  58. type=str)
  59. ffmpeg_parser.add_argument('--fps',
  60. help='set frame rate (default = 25)',
  61. type=str)
  62. ffmpeg_parser.add_argument('--size',
  63. help='set frame size. The format is WxH (default 160x128)',
  64. type=str)
  65. ffmpeg_parser.add_argument('--aspect',
  66. help='set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)',
  67. type=str)
  68. ffmpeg_parser.add_argument('--tolerance',
  69. help='set video bitrate tolerance (in kbit/s)',
  70. type=str)
  71. ffmpeg_parser.add_argument('--maxrate',
  72. help='set min video bitrate tolerance (in kbit/s)',
  73. type=str)
  74. ffmpeg_parser.add_argument('--bufsize',
  75. help='set ratecontrol buffere size (in kbit)',
  76. type=str)
  77. parser.parse_args()
  78. display_message()
  79. if __name__ == '__main__':
  80. main()