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 input from stdin via pipe instead of editor #582

Open
8go opened this issue Aug 23, 2020 · 0 comments
Open

allow input from stdin via pipe instead of editor #582

8go opened this issue Aug 23, 2020 · 0 comments

Comments

@8go
Copy link

8go commented Aug 23, 2020

Is your feature request related to a problem? Please describe.
No problem. Just an idea for a new feature.

Describe the solution you'd like
Currently stdin input is not supported:
$ echo -e "# example\nfoo -bar" | cheat -e somecommand
Too many errors from stdin
Buffer written to ~/.config/cheat/cheatsheets/personal/somecommand.save
failed to edit cheatsheet: exit status 1

$ cheat -e somecommand < echo "snippet"
Too many errors from stdin
Buffer written to ~/.config/cheat/cheatsheets/personal/somecommand.save.1
failed to edit cheatsheet: exit status 1

It would be nice on some occasions to avoid the editor and pipe some
text directly to cheat via a pipe. In other words it would be nice if

  • $ echo -e "# example\nfoo -bar" | cheat -e somecommand
  • cheat -e somecommand < echo "snippet"
    worked.

I know I could do this:

  • $ echo -e "# example\nfoo -bar" >> ~/.config/cheat/cheatsheets/personal/somecommand
  • $ cat "snippet" >> ~/.config/cheat/cheatsheets/personal/somecommand
    The above feature could do the same, check if there is input on stdin, if so avoid
    the editor and append the stdin input directly to the end of the cheatsheet.

Additional context
Would enable some automation. Scripts could be written that autogenerate cheatsheets,
but I guess scripts can be written that autogenerate cheatsheets directly without cheat.

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