mirror of
https://github.com/cheat/cheat.git
synced 2026-03-07 11:13:33 +01:00
- cmdInit (--init) now substitutes EDITOR_PATH, PAGER_PATH, and WORK_PATH instead of leaving them as literal strings - Installer now substitutes WORK_PATH and always creates personal and work directories regardless of community cheatsheet choice - When community cheatsheets are declined, the community cheatpath is commented out in the generated config - config.New() skips nonexistent cheatpaths with a warning instead of hard-erroring on EvalSymlinks failure Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -44,13 +44,23 @@ func cmdInit() {
|
||||
confpath := confpaths[0]
|
||||
confdir := filepath.Dir(confpath)
|
||||
|
||||
// create paths for community and personal cheatsheets
|
||||
// create paths for community, personal, and work cheatsheets
|
||||
community := filepath.Join(confdir, "cheatsheets", "community")
|
||||
personal := filepath.Join(confdir, "cheatsheets", "personal")
|
||||
work := filepath.Join(confdir, "cheatsheets", "work")
|
||||
|
||||
// template the above paths into the default configs
|
||||
configs = strings.Replace(configs, "COMMUNITY_PATH", community, -1)
|
||||
configs = strings.Replace(configs, "PERSONAL_PATH", personal, -1)
|
||||
configs = strings.Replace(configs, "WORK_PATH", work, -1)
|
||||
|
||||
// locate and set a default pager
|
||||
configs = strings.Replace(configs, "PAGER_PATH", config.Pager(), -1)
|
||||
|
||||
// locate and set a default editor
|
||||
if editor, err := config.Editor(); err == nil {
|
||||
configs = strings.Replace(configs, "EDITOR_PATH", editor, -1)
|
||||
}
|
||||
|
||||
// output the templated configs
|
||||
fmt.Println(configs)
|
||||
|
||||
Reference in New Issue
Block a user