@@ -158,36 +158,48 @@ ${SPLIT_END}
158158 - ${ p.get(' description' ) or NO_DESC | xml_escape ,indent_all_but_first_by(2 )}
159159</%def >
160160
161- <%def name = "_list_schem_args(schema , abs_cursor = '' ) "> \
161+ <%def name = "_list_schem_args(schema , cursor_tokens = list() ) "> \
162162<%
163+ if len (cursor_tokens) == 0 :
164+ cursor_tokens = [FIELD_SEP ]
165+
163166 def cursor_fmt (cursor ):
164- return ' -%s %s ' % (STRUCT_FLAG , cursor)
167+ fndfi = 0 # first non-dot field index
168+ for (fndfi, v) in enumerate (cursor):
169+ if v != FIELD_SEP :
170+ break
171+ return ' -%s %s ' % (STRUCT_FLAG , ' ' .join(cursor[:fndfi]) + FIELD_SEP .join(cursor[fndfi:]))
165172
166173 def cursor_arg ():
167- if abs_cursor:
168- return cursor_fmt(abs_cursor)
174+ if cursor_tokens:
175+ res = cursor_fmt(cursor_tokens)
176+ del cursor_tokens[:]
177+ return res
169178 return ' '
170- abs_cursor_arg = cursor_arg()
171179%> \
172180% for fn in sorted (schema.fields.keys()):
173181<%
174182 f = schema.fields[fn]
175- cursor_prefix = ' '
176- if abs_cursor == ' ' :
177- cursor_prefix = FIELD_SEP
178183%> \
179184% if isinstance (f, SchemaEntry):
180- * **${ abs_cursor_arg } -${ STRUCT_FLAG } ${ mangle_subcommand(fn)} =${ field_to_value(f)} **
185+ * **${ cursor_arg() } -${ STRUCT_FLAG } ${ mangle_subcommand(fn)} =${ field_to_value(f)} **
181186 - ${ f.property.get(' description' , NO_DESC ) | xml_escape, indent_all_but_first_by(2 )}
182187% if f.container_type == CTYPE_ARRAY :
183188 - Each invocation of this argument appends the given value to the array.
184189% elif f.container_type == CTYPE_MAP :
185190 - the value will be associated with the given `key`
186191% endif # handle container type
187- <% abs_cursor_arg = ' ' %>
188192% else :
189- ${ self ._list_schem_args(f, ' %s%s ' % (cursor_prefix, mangle_subcommand(fn)))}
190- <% abs_cursor_arg = cursor_fmt(FIELD_SEP + FIELD_SEP ) %> \
193+ <%
194+ cursor_tokens.append(mangle_subcommand(fn))
195+ %> \
196+ ${ self ._list_schem_args(f, cursor_tokens)}
197+ <%
198+ assert not cursor_tokens or cursor_tokens[- 1 ] == FIELD_SEP
199+ if not cursor_tokens:
200+ cursor_tokens.append(FIELD_SEP )
201+ cursor_tokens.append(FIELD_SEP )
202+ %> \
191203% endif
192204% endfor
193205</%def >
0 commit comments