options.py 1.4 KB

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-"
  3. """
  4. PyDog4Apache - 2016/2022 - by psy (epsylon@riseup.net)
  5. You should have received a copy of the GNU General Public License along
  6. with PyDog4Apache; if not, write to the Free Software Foundation, Inc., 51
  7. Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  8. """
  9. import optparse
  10. class PyDog4ApacheOptions(optparse.OptionParser):
  11. def __init__(self, *args):
  12. optparse.OptionParser.__init__(self,
  13. description='\nApache web logs sneaker - 2016/2022 - by psy (https://03c8.net)',
  14. prog='pydog4apache.py',
  15. version='\nVersion: v0.2 (2022) - https://pydog4apache.03c8.net\n')
  16. self.add_option("-u", "--update", action="store_true", dest="update", help="check for latest stable version")
  17. self.add_option("-v", "--verbose", action="store_true", dest="verbose", help="active verbose output")
  18. group1 = optparse.OptionGroup(self, "*Reporting*")
  19. group1.add_option("-r", action="store", dest="file", help="generate file with results (ex: -r 'visitants.txt')")
  20. group1.add_option("-n", action="store", dest="emails", help="notify via email (foo@email.net,bar@email.org,...)")
  21. self.add_option_group(group1)
  22. def get_options(self, user_args=None):
  23. (options, args) = self.parse_args(user_args)
  24. return options