267
264
names.update(cmd.aliases)
268
265
# candidate: modified levenshtein distance against cmd_name.
271
268
for name in sorted(names):
272
269
matcher = patiencediff.PatienceSequenceMatcher(None, cmd_name, name)
274
271
opcodes = matcher.get_opcodes()
275
272
for opcode, l1, l2, r1, r2 in opcodes:
278
275
elif opcode == 'replace':
283
280
# Score equal ranges lower, making similar commands of equal
284
281
# length closer than arbitrary same length commands.
287
284
costs.update(_GUESS_OVERRIDES.get(cmd_name, {}))
288
285
costs = sorted((costs[key], key) for key in costs)