mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-12 01:53:07 +03:00
fixed argument passing (#2209)
Using espota.py as a module by calling espota.main(args) was not working because the args given to main were not being passed into parser.parse_args(). I fixed this by having main pass args to the parser function, which in turn passes them to the parser object's parse_args() function.
This commit is contained in:
committed by
Ivan Grokhotkov
parent
4217e49b54
commit
24f84664e7
@ -21,7 +21,7 @@
|
|||||||
# Changes
|
# Changes
|
||||||
# 2015-11-09:
|
# 2015-11-09:
|
||||||
# - Added digest authentication
|
# - Added digest authentication
|
||||||
# - Enchanced error tracking and reporting
|
# - Enhanced error tracking and reporting
|
||||||
#
|
#
|
||||||
# Changes
|
# Changes
|
||||||
# 2016-01-03:
|
# 2016-01-03:
|
||||||
@ -199,7 +199,7 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm
|
|||||||
# end serve
|
# end serve
|
||||||
|
|
||||||
|
|
||||||
def parser():
|
def parser(unparsed_args):
|
||||||
parser = optparse.OptionParser(
|
parser = optparse.OptionParser(
|
||||||
usage = "%prog [options]",
|
usage = "%prog [options]",
|
||||||
description = "Transmit image over the air to the esp8266 module with OTA support."
|
description = "Transmit image over the air to the esp8266 module with OTA support."
|
||||||
@ -275,7 +275,7 @@ def parser():
|
|||||||
)
|
)
|
||||||
parser.add_option_group(group)
|
parser.add_option_group(group)
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args(unparsed_args)
|
||||||
|
|
||||||
return options
|
return options
|
||||||
# end parser
|
# end parser
|
||||||
@ -283,7 +283,7 @@ def parser():
|
|||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
# get options
|
# get options
|
||||||
options = parser()
|
options = parser(args)
|
||||||
|
|
||||||
# adapt log level
|
# adapt log level
|
||||||
loglevel = logging.WARNING
|
loglevel = logging.WARNING
|
||||||
|
Reference in New Issue
Block a user