Skip to content

Do not add $ preceeding bash command on code examples #99

@bidoubiwa

Description

@bidoubiwa

We have a consistent manner to add a dollar sign in front of each bash command on our getting started.

These have already been changed in the documentation as they were copied when using the clipboard plugin. I have given a bit of thought on the subject and based on my experience of having to remove manually the $ sign from my copies multiple times a week, I was wondering how our competitors might approach this.

I could not find examples of basic bash commands with a $ sign but I found some when the output of the bash command is explicitly shown:

I have looked at more than 15 repos here are some well known

Example twilio

Screenshot 2021-02-23 at 14 08 05

Example instantsearch

Screenshot 2021-02-23 at 14 07 13

Example Commander (cli tool)

Commander when explicit output is shown:
Screenshot 2021-02-23 at 14 09 37

It is really hard to find example of multiples cmd in the same code block. I found one in mongo installation, but most of the commands are in a separate code block

Example Mongo Installation

Screenshot 2021-02-23 at 14 18 12

Screenshot 2021-02-23 at 14 19 53

Example Strip ruby

Screenshot 2021-02-23 at 14 11 31

Conclusion

What I conclude from that is, if we think the user might want to copy/paste every command, then we should put them all in a separate code block. If the commands are just a showcase that will mostly not be copy/paster, we add them in the same code-block.

  • Break down code block with multiple important commands into multiple code block without a preceding $
  • Leave $ on bash examples with a clear intention of showing the output of the code block
  • No specific rules for $ when multiple non-important command lines are written one after the other. We could say yes by default. But again this limits the user that wants to copy/paste in a bash script.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions