mirror of
https://github.com/Erreur32/cheat.git
synced 2024-12-22 21:52:12 +01:00
Remove duplicates from the list of cheatsheets.
This commit is contained in:
parent
73d9f0c83d
commit
cdf0aa1926
1 changed files with 10 additions and 0 deletions
10
cheat
10
cheat
|
@ -24,6 +24,16 @@ if 'CHEATPATH' in os.environ and os.environ['CHEATPATH']:
|
|||
path = os.environ['CHEATPATH'].split(os.pathsep)
|
||||
if os.path.isdir(path):
|
||||
cheatsheets += [(f, path) for f in os.listdir(path) if '.' not in f]
|
||||
|
||||
# remove any duplicates
|
||||
def remove_duplicates(cheats):
|
||||
sheets = []
|
||||
for i, sheet in enumerate(cheats):
|
||||
if sheet[0] not in [c[0] for c in sheets]:
|
||||
sheets.append(sheet)
|
||||
return sheets
|
||||
|
||||
cheatsheets = remove_duplicates(cheatsheets)
|
||||
cheatsheets.sort()
|
||||
|
||||
# assemble a keyphrase out of all params passed to the script
|
||||
|
|
Loading…
Reference in a new issue