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

Pull request: Cheat with multiline comment and multiline command #11

Open
QiangF opened this issue Sep 29, 2016 · 1 comment
Open

Pull request: Cheat with multiline comment and multiline command #11

QiangF opened this issue Sep 29, 2016 · 1 comment

Comments

@QiangF
Copy link

QiangF commented Sep 29, 2016

Hello sir,
Sorry I don't have time to learn to create a pull request. I've made a small improvement over your cheat. Except what said in the title, it will also put the cheat and user input into the bash history, also added a command sucheat. With it you can run command like the embed cheat, which I can't get to work in one line.
I am still trying to get the default value for a variable to work.
My cheat.sh is at https://gist.github.com/QiangF/565102ba3b6123942b9bf6b897c05f87

The format for a cheat is:
comment

command

variables

more comment

@QiangF QiangF closed this as completed Nov 10, 2016
@lucaswerkmeister
Copy link
Owner

No, wait, don’t close this! I was going to look at this, only I couldn’t find the time and it got pushed back further and further on my agenda… sorry :(

  • I don’t really like the multiline format with explicit separator lines. However, multi-line support in general is probably a good thing. What if we use read instead of read -r? Then you can use a backslash to continue the current line:

    Force (unreachable NFS) Lazy unmount:\
     Detach the filesystem from the filesystem hierarchy now, and cleanup all\
     references to the filesystem as soon as it is not busy anymore.
    umount -f -l "$mounting_point"
    mounting_point:mounting point
    

    (Note that the line breaks won’t appear in the read content.)

  • Adding the cheat to history sounds like a good idea, but why do you also add the cheat $* line to history? As far as I can tell, that should already be present in the history since that’s the command you just ran.

  • I don’t really see the need for sucheat. Your embed example can, I think, be written in one command as:

    sudo DISPLAY=:0 Xephyr :1 -fullscreen -reset -terminate & export DISPLAY=:1

lucaswerkmeister added a commit that referenced this issue Nov 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants