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

allow cheat files to have extension #625

Open
guoqiao opened this issue May 12, 2021 · 0 comments
Open

allow cheat files to have extension #625

guoqiao opened this issue May 12, 2021 · 0 comments

Comments

@guoqiao
Copy link

guoqiao commented May 12, 2021

Problem

Currently the cheat files can not have extension, this caused 2 problems:

  1. although optional, I need to specify special headers in file, e.g.:
---
syntax: javascript
tags: [ array, map ]
---

This is a bit memory burden, and make cheat files not generic.

  1. without extension, syntax highlight won't work directly in editors.

I like to use markdown format in vscode.
However, when I open a cheat file such as mysql with vscode, It can not detect the correct type.
This also applies to bash, javascript syntax types.

Suggestion

I would like this tool can support file extensions.

For example, if I want to create a cheat file with markdown syntax, I just save it as tcpdump.md.
This is a valid/generic markdown file, which means users can write a cheat file without learning anything.
In file top, I don't need to begin with the special header.
And, when I edit in editor, I get correct syntax highlighting.

What's more interesting, I can also create cheat files for other syntax, such as requests.py, awk.sh, jquery.js.
I can even run it to verify it's working, although that may lead to some problems, such as you have sudo rm / in your script.
But there are many ways to avoid such things, and it's not mandatory to make it really valid.

From the cheat code, that means, cheat mysql will not only search for a file with exact name mysql, it will try to match any files with basename mysql, such as mysql.txt, mysql.sh, mysql.md, and mysql.
That change won't break current function.
And when there are multiple ones, we can ask user to choose which version, or show all.

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

1 participant