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

Change $ in example bash commands #118

Closed
eseiver opened this issue Jan 7, 2015 · 8 comments
Closed

Change $ in example bash commands #118

eseiver opened this issue Jan 7, 2015 · 8 comments

Comments

@eseiver
Copy link

eseiver commented Jan 7, 2015

Make it so that people can directly copy and paste the bash commands from the text box. The '$' is still a useful placeholder, so place it to the left of the box.

@rgaiacs
Copy link
Contributor

rgaiacs commented Jan 7, 2015

@eseiver Thanks for the feedback. I'm -1 to remove the $ because it make easy to read. For example, when reading

$ foo
$ bar

I know that I should first type foo follow by ENTER and after get the output of it type bar follow by ENTER. Instead, when reading

foo
bar

I didn't know if it is one command with one argument or two commands.

so place it to the left of the box.

Could you provide one example? Maybe with it you can persuaded me.

@gvwilson
Copy link
Contributor

gvwilson commented Jan 8, 2015

I agree with this change, I just don't know how to implement it in
Markdown - if we were using an HTML table, we could put the $ for input
lines in column 1, and the command in column 2 (with the output below
it, also in column 2). Elizabeth, can you think of a way to Markdown
our way to paradise?
Cheers,
G

@rgaiacs
Copy link
Contributor

rgaiacs commented Jan 9, 2015

I thought to use

~~~{.bash}
foo
~~~
~~~{.bash}
bar
~~~

and CSS to add $ before the commands. The side effect is that the $ will be only visible when viewing the HTML page locally, from GitHub Pages or from Software Carpentry website, i.e., not visible at https://github.com/swcarpentry/workshop-template/blob/gh-pages/README.md.

@gdevenyi
Copy link
Contributor

gdevenyi commented Jan 9, 2015

I agree with @r-gaia-cs that the solution is to manage with the CSS layout, however. I'm not sure I agree with making it easier to copy-paste commands.

Part of the point is to follow along interactively and enabling copy and paste behavior could reduce that.

@wking
Copy link
Contributor

wking commented Jan 9, 2015

On Fri, Jan 09, 2015 at 10:47:23AM -0800, Gabriel A. Devenyi wrote:

I'm not sure I agree with making it easier to copy-paste commands.

I don't think that the presence or absence of a leading $ has much
impact on copy-paste-ability. The think that makes that hard is the
line-continuation prompt (PS2):

$ echo \

hi
there

That's a silly example, but I often use line-continuation for pipes:

$ echo hi there |

sed s/hi/hello/ |
wc

since that reads more easily than cramming a bunch of long commands
onto one line.

I agree that making it easy to copy-paste does not need to be a
priority for us, although I wouldn't go out of my way to make it
harder. I don't have strong preferences here, but I'm maybe -0.5,
since leaving the $ in the source makes for simpler parsing (were we
going to get CSS for PS2 as well?) and more readable GitHub rendering
1.

@gvwilson
Copy link
Contributor

gvwilson commented Jan 9, 2015

Whatever is implemented should also be applied to Python lessons where
we show interactive use, and ditto R and SQL - anything with a prompt.

@rgaiacs
Copy link
Contributor

rgaiacs commented Jan 9, 2015

I think that @eseiver as talking about the README.md from this repository and not about our lessons. In many text editors if you triple click one line it will select the hole line and you can copy and paste it easily other than click-hold, select, drop, copy and past to avoid the $. I'm OK to replace

~~~
$ foo
$ bar
~~~

for

~~~{.bash}
foo
~~~
~~~{.bash}
bar
~~~

on README.md only although I prefer keep it as it is since is the "default" way to write shell commands for others.

@gvwilson
Copy link
Contributor

See also swcarpentry/git-novice#108

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

5 participants