1. johannes
  2. sms

Commits

johannes  committed 417e9b0

Prioritize full name matches to substring matches

  • Participants
  • Parent commits 87cfb93
  • Branches default

Comments (0)

Files changed (1)

File sms.py

View file
  • Ignore whitespace
 		if 'nickname' in person and person['nickname'].lower() == name:
 			yield (1, person)
 		elif 'first' in person and name in person['first'].lower():
-			yield (2, person)
+			yield (2 if name == person['first'].lower() else 3, person)
 		elif 'last' in person and name in person['last'].lower():
-			yield (2, person)
+			yield (2 if name == person['last'].lower() else 3, person)
 
 name_arg = codecs.decode(argv[1], 'utf-8')
 if name_arg.isdigit() or name_arg.startswith('+') and name_arg[1:].isdigit():