cheat: frontmatter error
Thanks for submitting a bug report. Please provide the following information:
» cheat -l -t personal
failed to list cheatsheets: failed to load cheatsheets: failed to load sheet: ip, path: /Users/andrew/.config/cheat/cheatsheets/community/ip, err: failed to parse front-matter: failed to unmarshal frontmatter: yaml: unmarshal errors:
line 1: cannot unmarshal !!str `tags [ ...` into sheet.frontmatter
cheat version info 4.4.0
cheat configuration info If your bug pertains to how cheatsheets are loaded and/or displayed, please paste here the following information:
community: /Users/andrew/.config/cheat/cheatsheets/community
personal: /Users/andrew/Dropbox/computer_stuff/unix_files/personal_cheat_sheets
cwd: /Users/andrew/.cheat
- The contents of your
conf.ymlfile
# The editor to use with 'cheat -e <sheet>'. Defaults to $EDITOR or $VISUAL.
editor: vim
# Should 'cheat' always colorize output?
colorize: true
# Which 'chroma' colorscheme should be applied to the output?
# Options are available here:
# https://github.com/alecthomas/chroma/tree/master/styles
style: monokai
# Which 'chroma' "formatter" should be applied?
# One of: "terminal", "terminal256", "terminal16m"
formatter: terminal16m
# Through which pager should output be piped? (Unset this key for no pager.)
pager: less -FRX
# The paths at which cheatsheets are available. Tags associated with a cheatpath
# are automatically attached to all cheatsheets residing on that path.
#
# Whenever cheatsheets share the same title (like 'tar'), the most local
# cheatsheets (those which come later in this file) take precedent over the
# less local sheets. This allows you to create your own "overides" for
# "upstream" cheatsheets.
#
# But what if you want to view the "upstream" cheatsheets instead of your own?
# Cheatsheets may be filtered via 'cheat -t <tag>' in combination with other
# commands. So, if you want to view the 'tar' cheatsheet that is tagged as
# 'community' rather than your own, you can use: cheat tar -t community
cheatpaths:
# Paths that come earlier are considered to be the most "global", and will
# thus be overridden by more local cheatsheets. That being the case, you
# should probably list community cheatsheets first.
#
# Note that the paths and tags listed below are placeholders. You may freely
# change them to suit your needs.
#
# Community cheatsheets must be installed separately, though you may have
# downloaded them automatically when installing 'cheat'. If not, you may
# download them here:
#
# https://github.com/cheat/cheatsheets
#
# Once downloaded, ensure that 'path' below points to the location at which
# you downloaded the community cheatsheets.
- name: community
path: /Users/andrew/.config/cheat/cheatsheets/community
tags: [ community ]
readonly: true
# If you have personalized cheatsheets, list them last. They will take
# precedence over the more global cheatsheets.
- name: personal
path: /Users/andrew/.config/cheat/cheatsheets/personal
tags: [ personal ]
readonly: false
# While it requires no configuration here, it's also worth noting that
# 'cheat' will automatically append directories named '.cheat' within the
# current working directory to the 'cheatpath'. This can be very useful if
# you'd like to closely associate cheatsheets with, for example, a directory
# containing source code.
#
# Such "directory-scoped" cheatsheets will be treated as the most "local"
# cheatsheets, and will override less "local" cheatsheets. Likewise,
# directory-scoped cheatsheets will always be editable ('readonly: false').%
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 20 (7 by maintainers)
Commits related to this issue
- [golang] cheat最新版がエラーになるので4.3.3にしておく https://github.com/cheat/cheat/issues/708 — committed to umi-uyura/mydotfiles by umi-uyura a year ago
Maintainer here. Just seeing this.
I’m on the road today, but will try to get a fix out tomorrow. Sorry for the headache.
Ahh… thanks for spotting that! Adding the colon in my personal set of cheat sheets made that error go away.
I didn’t realize until now that I needed to periodically do a
git pullon the community sheets. Anyways, if that was only issue, I’d suggest handling this by just catching the error and then maybe outputting an explanation (because the yaml parser error is cryptic).I’m respectfully suggesting that this error should not be “intended behavior” as is. Right now it seems like a bug. It would seem more intended if instead of a parse error, there was a friendlier explanation.
Also, I just did the
git pulland it still does not fix it. This error is a show stopper, because it errors out on some random sheet even though the command I’m giving has nothing to do with it. Is the yaml parser checking all the sheets all the time? It would make more sense to me if the sheet that I’m trying to look at has the error and then the program throws the error because of that. It is less understandable when I’m just doing acheat -land I get the error just doing that.As a user, I am not familiar with yaml to troubleshoot the community sheets. I don’t work with that library, so… it’s kind of daunting to try to troubleshoot that.
As a user, the behavior in 4.3.3 was preferable to seeing an error like this. If a goal is to have a validity check on community sheets, maybe that could be handled on another way? Maybe another sort of validity check command? Or checked when people merge in new sheets on github?
Does that PR effectively fix the issue?
For context for others arriving here - presume an error message that looks like this:
What this means is that your cheatsheet’s “front-matter” - the metadata associated with a cheatsheet deliminted by
---- is malformed somehow. Fixing that will resolve the problem. The file path is denoted bypath, or/home/chris/.dotfiles/cheat/personal/fooin the example above.At some point in the past, malformed cheatsheets were committed to the community cheatsheets, though a community member opened a PR a while ago to resolve that.
In any case, if you encounter such an error message, do the following: