scripts: Adopted double-indent on multiline expressions
This matches the style used in C, which is good for consistency:
a_really_long_function_name(
double_indent_after_first_newline(
single_indent_nested_newlines))
We were already doing this for multiline control-flow statements, simply
because I'm not sure how else you could indent this without making
things really confusing:
if a_really_long_function_name(
double_indent_after_first_newline(
single_indent_nested_newlines)):
do_the_thing()
This was the only real difference style-wise between the Python code and
C code, so now both should be following roughly the same style (80 cols,
double-indent multiline exprs, prefix multiline binary ops, etc).
This commit is contained in:
+14
-13
@@ -37,9 +37,9 @@ def main(errs, *,
|
||||
# print
|
||||
for n, e, h in ERRS:
|
||||
print('%-*s %-*s %s' % (
|
||||
w[0], 'LFS_ERR_'+n,
|
||||
w[1], e,
|
||||
h))
|
||||
w[0], 'LFS_ERR_'+n,
|
||||
w[1], e,
|
||||
h))
|
||||
|
||||
# find these errors
|
||||
else:
|
||||
@@ -77,20 +77,21 @@ def main(errs, *,
|
||||
except KeyError:
|
||||
print('%s ?' % err)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import argparse
|
||||
import sys
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Decode littlefs error codes.",
|
||||
allow_abbrev=False)
|
||||
description="Decode littlefs error codes.",
|
||||
allow_abbrev=False)
|
||||
parser.add_argument(
|
||||
'errs',
|
||||
nargs='*',
|
||||
help="Error codes or error names to decode.")
|
||||
'errs',
|
||||
nargs='*',
|
||||
help="Error codes or error names to decode.")
|
||||
parser.add_argument(
|
||||
'-l', '--list',
|
||||
action='store_true',
|
||||
help="List all known error codes.")
|
||||
'-l', '--list',
|
||||
action='store_true',
|
||||
help="List all known error codes.")
|
||||
sys.exit(main(**{k: v
|
||||
for k, v in vars(parser.parse_intermixed_args()).items()
|
||||
if v is not None}))
|
||||
for k, v in vars(parser.parse_intermixed_args()).items()
|
||||
if v is not None}))
|
||||
|
||||
Reference in New Issue
Block a user