MCPcopy Index your code
hub / github.com/pyinvoke/invoke / help_tuples

Method help_tuples

invoke/parser/context.py:219–251  ·  view source on GitHub ↗

Return sorted iterable of help tuples for all member Arguments. Sorts like so: * General sort is alphanumerically * Short flags win over long flags * Arguments with *only* long flags and *no* short flags will come first. * When an Argument

(self)

Source from the content-addressed store, hash-verified

217 return namestr, helpstr
218
219 def help_tuples(self) -> List[Tuple[str, Optional[str]]]:
220 """
221 Return sorted iterable of help tuples for all member Arguments.
222
223 Sorts like so:
224
225 * General sort is alphanumerically
226 * Short flags win over long flags
227 * Arguments with *only* long flags and *no* short flags will come
228 first.
229 * When an Argument has multiple long or short flags, it will sort using
230 the most favorable (lowest alphabetically) candidate.
231
232 This will result in a help list like so::
233
234 --alpha, --zeta # 'alpha' wins
235 --beta
236 -a, --query # short flag wins
237 -b, --argh
238 -c
239
240 .. versionadded:: 1.0
241 """
242 # TODO: argument/flag API must change :(
243 # having to call to_flag on 1st name of an Argument is just dumb.
244 # To pass in an Argument object to help_for may require moderate
245 # changes?
246 return list(
247 map(
248 lambda x: self.help_for(to_flag(x.name)),
249 sorted(self.flags.values(), key=flag_key),
250 )
251 )
252
253 def flag_names(self) -> Tuple[str, ...]:
254 """

Callers 4

_assert_orderMethod · 0.80
print_helpMethod · 0.80
print_task_helpMethod · 0.80

Calls 2

help_forMethod · 0.95
to_flagFunction · 0.85

Tested by

no test coverage detected