cheat icon indicating copy to clipboard operation
cheat copied to clipboard

Default behavior when cheat a subdirectory

Open lengyijun opened this issue 5 years ago • 8 comments

# structure in cheat directory
golang/index
golang/loop
cheat golang/index    # open golang/index
cheat golang/loop     # open golang/loop
cheat golang           # open golang/index by default

It's useful to arrange programming language's cheatsheet

lengyijun avatar Aug 28 '20 12:08 lengyijun

That's an interesting idea. I see how this could be useful.

Let me experiment a bit with this. I'll update the ticket when I have more information.

Thanks.

chrisallenlane avatar Aug 29 '20 16:08 chrisallenlane

Thx. I have another idea about this:

# structure in cheat directory
golang/golang
golang/loop
cheat golang/golang   # open golang/golang
cheat golang/loop     # open golang/loop
cheat golang          # open golang/golang by default

I have implemented it in https://github.com/cheat/cheat/pull/586

lengyijun avatar Aug 30 '20 01:08 lengyijun

Both ideas are good. But, I think, first variant is easier to implement. @chrisallenlane, are you need to help with realization? I don't write on Go, but I think it not a very hard in this case. Or we can request help in community.

SinRoot avatar Sep 25 '20 05:09 SinRoot

An update to this enhancement: Recursive going deep. I mean:

cheat golang 		# open golang/index
cheat golang/loop 	# open golang/loop if this a file
# if golang/loop is directory open golang/loop/index

In this case we can create a tree of cheatsheets. Example:

cheat tar/create/compressed
cheat tar/create/bz2

SinRoot avatar Sep 25 '20 06:09 SinRoot

@chrisallenlane, are you need to help with realization? I don't write on Go, but I think it not a very hard in this case. Or we can request help in community.

I don't think there's a huge amount of work here. It needs to be considered alongside #548, though, so I'll probably implement both of those features simultaneously.

I should be able to handle this solo, but I appreciate the offer to marshal some help. I'm just a bit time-crunched at present. I should be able to get to this sometime around mid-October. I'll update this thread as I make progress.

chrisallenlane avatar Oct 06 '20 11:10 chrisallenlane

This sounds like an interesting idea. @chrisallenlane if you're still time-crunched can I step in to work on this issue?

srafi1 avatar Oct 23 '20 02:10 srafi1

@srafi1, thanks for the offer, but I should be able to get to this this week. It's probably best that I take this on myself - we have like 3 open tickets that are all going to impact each other. :slightly_smiling_face:

chrisallenlane avatar Oct 26 '20 12:10 chrisallenlane

Hi there, sorry for the bump but any plans for this feature? Right now it feels a bit weird to have to choose between having subdirectories or a single big sheet.

To complete OP's examples, if you have a bunch of Bash cheats, you may want to put them in in bash directory so that you can split between cheat bash/getopts, cheat bash/arrays, cheat bash/dicts, whatever, but it becomes awkward to put general bash cheats such as special arguments $*, $@, or last command tokens !!, !$ in dedicated named sheet like cheat bash/arguments and cheat bash/tokens, where it would feel more natural to get them with cheat bash.

Unfortunately I don't know Go and wouldn't know how to write the MR 😭

By the way thank you for this neat little tool, been using it daily since 2019 now, aliased it to c.

dece avatar Mar 12 '24 08:03 dece