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