-
Notifications
You must be signed in to change notification settings - Fork 521
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
Don't include ">" in bash scripts #460
Conversation
We could use a $ sign but please check out through the whole guide because there are tons of "```bash" pieces and we would need to update them all. |
I don't quite understand. Even if I replace
Okay, I am going to apply the changes to all of them now.... |
Yeah, I just meant that would be a bit more obvious that you don't need to copy if you have |
But the "copy to clipboard* button will copy the entire text, including the |
FWIW, it's generally incorrect to use |
Sorry because I may be having hard time to express my idea :). I feel like in these blocks we should have just the thing that needs to be run, in this case Also what @shepmaster says is true. I'm not sure what would be the best solution /cc @mark-i-m |
I myself use prompt characters only when including command output (for easy visual separation), otherwise I do not add it for copy-paste convenience. |
@tshepang That seems like a reasonable rule to me |
So in order to make progress with this my suggestion is ...
|
@spastorino I don't know how to do #2 in mdbook, but it sounds good to me. |
@hbina Thanks for the PR! Are you still interested in working on this? If so, could you remove all the |
Uh oh, I guess I better start finish reading the book. Sure, I can work on them. I only know how to do the first one tho, I am not entirely knowledgeable in CSS styling stuff |
@hbina going over the first one is good enough for now :) |
I think we can leave CSS for a follow-up pr. For now, perhaps we can start by just removing the characters? |
My latest commit removes a bunch of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you did you added some of the $
but seems opposed what we are trying to do.
To be honest unsure how to best fix this without doing the css styling idea.
@mark-i-m do you have any other idea?.
@@ -260,7 +260,7 @@ usually also want to give `--tree-min-percent` or | |||
`--tree-max-depth`. The result looks like this: | |||
|
|||
```bash | |||
> perf focus '{do_mir_borrowck}' --tree-callees --tree-min-percent 3 | |||
$ perf focus '{do_mir_borrowck}' --tree-callees --tree-min-percent 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
@@ -232,7 +232,7 @@ Perhaps we'd like to know how much time MIR borrowck spends in the | |||
trait checker. We can ask this using a more complex regex: | |||
|
|||
```bash | |||
> perf focus '{do_mir_borrowck}..{^rustc::traits}' | |||
$ perf focus '{do_mir_borrowck}..{^rustc::traits}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
@@ -191,7 +191,7 @@ function of the MIR borrowck is called `do_mir_borrowck`, so we can do | |||
this command: | |||
|
|||
```bash | |||
> perf focus '{do_mir_borrowck}' | |||
$ perf focus '{do_mir_borrowck}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the text below this are meant to show an example of what will be displayed? In this case, the "copy to clipboard" button is meaningless regardless. So thats why I thought adding $
is okay to convey what would appear in a console. My original PR was really about "texts that are meant to be executed, should be executable from what is copied to the clipboard".
src/how-to-build-and-run.md
Outdated
@@ -385,7 +385,7 @@ should see a version number ending in `-dev`, indicating a build from | |||
your local environment: | |||
|
|||
```bash | |||
> rustc +stage1 -vV | |||
$ rustc +stage1 -vV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I see why you added $ there but I'm not sure what to think about this.
cc @mark-i-m
@@ -311,7 +311,7 @@ could get our percentages relative to the borrowck itself | |||
like so: | |||
|
|||
```bash | |||
> perf focus '{do_mir_borrowck}' --tree-callees --relative --tree-max-depth 1 --tree-min-percent 5 | |||
$ perf focus '{do_mir_borrowck}' --tree-callees --relative --tree-max-depth 1 --tree-min-percent 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
@spastorino Personally, I think this is ok. One would not copy/paste the whole block anyway in these cases, and I think having the prompt will improve the syntax highlighting of mdbook... IMHO, we should just merge... |
@hbina I've just approved the changes and I was going to merge them but there are some conflicts now, do you mind rebasing?. Sorry for not merging it before and hitting this new conflicts. |
Umm... looks like rebase went wrong? |
Oh...that's really bad... |
Specifically, `> $1` causes it to write into the file $1 if it exist And `> ./x.py` is particularly bad because it overwrite the script with empty spaces...
Should be okay now? |
Yeah, I'm not really sure why that happens. Occasionally I do that too. For whatever reason, |
Yep, that looks much better :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This looks good to me. We can do more discussion on zulip or in an issue I think.
This code blocks should not be marked as |
|
This makes copying inconvenient as
> ./x.py build -i --stage 1 src/libstd
will actually render yourx.py
file empty...