2023-12-13 15:10:20 +01:00
|
|
|
// Package sheets implements functions pertaining to loading, sorting,
|
|
|
|
// filtering, and tagging cheatsheets.
|
2019-10-20 16:02:28 +02:00
|
|
|
package sheets
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/cheat/cheat/internal/sheet"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Consolidate applies cheatsheet "overrides", resolving title conflicts that
|
|
|
|
// exist among cheatpaths by preferring more local cheatsheets over less local
|
|
|
|
// cheatsheets.
|
|
|
|
func Consolidate(
|
|
|
|
cheatpaths []map[string]sheet.Sheet,
|
|
|
|
) map[string]sheet.Sheet {
|
|
|
|
|
|
|
|
consolidated := make(map[string]sheet.Sheet)
|
|
|
|
|
|
|
|
for _, cheatpath := range cheatpaths {
|
|
|
|
for title, sheet := range cheatpath {
|
|
|
|
consolidated[title] = sheet
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return consolidated
|
|
|
|
}
|