mirror of
https://github.com/cheat/cheat.git
synced 2024-11-25 15:31:36 +01:00
Remove duplicates from the list of cheatsheets.
This commit is contained in:
parent
73d9f0c83d
commit
cdf0aa1926
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 New Issue
Block a user