solaar-cli: fix argument parsing in Python 3 again
Fix frome3a887f36c
, this got removed in: commit3b75b69970
Author: Daniel Pavel <daniel.pavel@gmail.com> Date: Fri Aug 9 12:25:47 2013 +0200 merged solaar-cli functionality into main solaar binary
This commit is contained in:
parent
288c607069
commit
f144816256
|
@ -136,6 +136,12 @@ def run(cli_args=None):
|
||||||
args = _cli_parser.parse_args(cli_args)
|
args = _cli_parser.parse_args(cli_args)
|
||||||
else:
|
else:
|
||||||
args = _cli_parser.parse_args()
|
args = _cli_parser.parse_args()
|
||||||
|
# Python 3 has an undocumented 'feature' that breaks parsing empty args
|
||||||
|
# http://bugs.python.org/issue16308
|
||||||
|
if not 'cmd' in args:
|
||||||
|
_cli_parser.print_usage(_sys.stderr)
|
||||||
|
_sys.stderr.write('%s: error: too few arguments\n' % NAME.lower())
|
||||||
|
_sys.exit(2)
|
||||||
action = args.action
|
action = args.action
|
||||||
assert action in actions
|
assert action in actions
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue