Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 4.2.7 broke personal cheatsheets in custom location #690

Closed
mikemcduffie opened this issue Aug 7, 2022 · 11 comments
Closed

Version 4.2.7 broke personal cheatsheets in custom location #690

mikemcduffie opened this issue Aug 7, 2022 · 11 comments

Comments

@mikemcduffie
Copy link

mikemcduffie commented Aug 7, 2022

Thanks for submitting a bug report. Please provide the following information:

A description of the problem
I store my personal cheatsheets in a synced folder (/Users/mike/Resilio Sync/App Support/cheat/cheatsheets/personal) as configured in conf.yml. This has worked fine until version 4.2.7. Since upgrading my configuration no longer works:

  • cheat -l : no output
  • cheat -s <term> : no output
  • cheat <cheatsheet> : No cheatsheet found for <cheatsheet>.

Downgrading to 4.2.6 resolved the issue for me with no other changes to my configuration.

cheat version info
4.2.7

cheat configuration info

If your bug pertains to how cheatsheets are loaded and/or displayed, please
paste here the following information:

  1. The output of cheat -d
    community: /Users/mike/.config/cheat/cheatsheets/community
    personal: /Users/mike/Resilio Sync/App Support/cheat/cheatsheets/personal
  2. The contents of your conf.yml file
# The editor to use with 'cheat -e <sheet>'. Defaults to $EDITOR or $VISUAL.
editor: bbedit
# Should 'cheat' always colorize output?
colorize: false

# 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: terminal

# Through which pager should output be piped? (Unset this key for no pager.)
pager: bat -l bash --style=plain
# pager: less -FRX # <- recommended where available

# 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/mike/.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/mike/Resilio Sync/App Support/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').
@chrisallenlane
Copy link
Member

Hi, @mikemcduffie

I can't immediately reproduce this one. How did you install cheat?

Also, for the hell of it, please try the 4.3.0 release, which was published moments ago:
https://github.com/cheat/cheat/releases/tag/4.3.0

Thanks

@mikemcduffie
Copy link
Author

mikemcduffie commented Aug 8, 2022

Unfortunately 4.30 fails as well for me in exactly the same way.

I installed via homebrew:
brew install cheat

upgrades are via brew as well:
brew upgrade cheat

macOS 12.4 Monterey on a M1 processor.: zsh 5.9 (arm-apple-darwin21.3.0)
Nothing special in my setup that I can think of (except the location of my personal cheatsheets). Putting a copy of the personal folder in the original location did not resolve the issue, but since cheats -d lists the custom location I didn't expect it would.

bash-snippets NOT installed (conflicts with cheat). Again version 4.26 and previous versions work fine on my setup. Not sure what my first installed version was but again I've only used cheat for a few months IIRC.

Downgrade was also via brew, although the process is more complicated.

Again downgrading from 4.3.0 to 4.2.6 resolved the issue for me.

Thanks for the response. Let me know if I can supply more diagnostic info. I'm theoretically missing out of the fixes in later versions but cheat has been great so far. I only discovered it a few months ago and it solves nearly every issue I had with similar tools that I had tried before.

Thanks, Mike

@MC1R-13
Copy link

MC1R-13 commented Aug 8, 2022

I had the same issue. Installed via brew on macOS 12.5.
I'm guessing it's related to ignoring hidden directories from 484b447

Assuming that means all hidden directories, including .config, where Brew saves seemingly everything.

@mikemcduffie
Copy link
Author

Makes sense to me. Explains why community cheatsheets are not found as well (no -s or -l results at all). I had assumed the .config location was a cheat default rather than a brew default location.

@chrisallenlane
Copy link
Member

Hi, guys

Ah, of course. That makes sense.

Yeah, the intention behind that commit was primarily to prevent cheat from attempting to search .git for cheatsheets, because that can make hundreds/thousands of syscalls, and possibly slow down the application on machines with slow disks.

But yeah - I hadn't considered that folks might be saving cheatsheets into hidden directories. This was a stupid mistake, because it also means that I plainly broke the local .cheat cheatpath, which is explicitly supported.

I can probably modify the offending code to ignore .git directories and none others. That should fix the problem. I'll try to cut a new release tonight after work.

Sorry for the headache!

chrisallenlane added a commit to chrisallenlane/cheat that referenced this issue Aug 9, 2022
Fix an issue whereby cheatsheets that were contained within hidden
directories were prevented from being loaded.
@chrisallenlane chrisallenlane mentioned this issue Aug 9, 2022
@chrisallenlane
Copy link
Member

I believe I have this resolved with the 4.3.1 release:
https://github.com/cheat/cheat/releases/tag/4.3.1

I'm going to optimistically close this ticket as resolved, but please let me know if this does or doesn't work for you.

Thanks!

@MC1R-13
Copy link

MC1R-13 commented Aug 9, 2022

It's working now. Thanks.

@chrisallenlane
Copy link
Member

Perfect. Glad to hear. Thanks for letting me know 👍

@mikemcduffie
Copy link
Author

4.3.1 works here. Thanks

@chrisallenlane
Copy link
Member

Excellent. Thanks 🙂

@lucascosti
Copy link

👋 I think the fix for this broke using a git submodule as a cheatsheet location; I've opened a new issue here: #694 🙇‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants