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

Fix command line examples to follow guidelines #28205

Merged
merged 4 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,13 @@ This will make it easier to submit a pull request for your changes.
3. Check for errors by clicking `Show flaws` on each previewed page.
You may be able to fix flaws by running:

```sh
```bash
yarn content flaws <page_slug>
```

4. Commit your changes to the branch (our example is using the `fix-typo` branch) and push the changes to your fork's remote:

```sh
```bash
# Adding all files to the commit
git add .
# Making a commit with a message describing the changes
Expand Down Expand Up @@ -241,7 +241,7 @@ There are a few things to keep in mind:
Moving one or more documents (or an entire tree of documents) is made easier with the `yarn content move` command.
This command moves the file and fixes up redirects automatically. You can use this command as shown below:

```sh
```bash
yarn content move <from-slug> <to-slug> [locale]
```

Expand All @@ -257,7 +257,7 @@ Let's say you want to move the entire `/en-US/Learn/Accessibility` tree to `/en-

1. Starting from a fresh branch:

```sh
```bash
cd ~/repos/content
# Fetch the latest changes from the main branch on mdn/content
git fetch upstream
Expand All @@ -270,13 +270,13 @@ Let's say you want to move the entire `/en-US/Learn/Accessibility` tree to `/en-
2. Move files with `yarn content move`.
This will delete and modify existing files, as well as create new files.

```sh
```bash
yarn content move Learn/Accessibility Learn/A11y
```

3. Commit all of the changes and push your branch to the remote:

```sh
```bash
git add .
git commit -m "Move Learn/Accessibility to Learn/A11y"
git push
Expand All @@ -292,14 +292,14 @@ Similar to moving files, you can delete documents or a tree of documents easily

You can use this command as shown below:

```sh
```bash
yarn content delete <document-slug> [locale] --redirect <redirect-slug-or-url>
```

To use `yarn content delete`, provide the slug of the document you'd like to delete (e.g., `Learn/Accessibility`), and the locale as an optional second argument (this defaults to `en-US`).
If the slug of the page you wish to delete contains special characters, include it in quotes. For example:

```sh
```bash
yarn content delete "Glossary/Round_Trip_Time_(RTT)" --redirect Glossary/Latency
```

Expand All @@ -308,7 +308,7 @@ Say you want to delete the entire `/en-US/Learn/Accessibility` tree and redirect

1. Start from a fresh branch.

```sh
```bash
cd ~/repos/content
# Fetch the latest changes from the main branch on mdn/content
git fetch upstream
Expand All @@ -320,7 +320,7 @@ Say you want to delete the entire `/en-US/Learn/Accessibility` tree and redirect

2. Run the `yarn content delete` command and redirect all deleted documents.

```sh
```bash
yarn content delete Learn/Accessibility --recursive --redirect Web/Accessibility
```

Expand All @@ -330,7 +330,7 @@ Say you want to delete the entire `/en-US/Learn/Accessibility` tree and redirect

3. Commit all of the changes and push your branch to the remote.

```sh
```bash
git add .
git commit -m "Delete Learn/Accessibility pages"
git push
Expand All @@ -346,7 +346,7 @@ You may do this by using the `yarn content add-redirect` command.

1. Start a fresh branch to work in:

```sh
```bash
cd ~/repos/content
# Fetch the latest changes from the main branch on mdn/content
git fetch upstream
Expand All @@ -358,13 +358,13 @@ You may do this by using the `yarn content add-redirect` command.

2. Add a redirect with `yarn content add-redirect`. The target page can be a page on MDN or an external URL:

```sh
```bash
yarn content add-redirect /en-US/path/of/deleted/page /en-US/path/of/target/page
```

3. Commit all of the changed files and pushing your branch to your fork:

```sh
```bash
git add .
git commit -m "Adding redirect after deleting Learn/Accessibility pages"
git push
Expand Down
7 changes: 6 additions & 1 deletion files/en-us/glossary/round_trip_time/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ page-type: glossary-definition
**Round Trip Time (RTT)** is the length time it takes for a data packet to be sent to a destination plus the time it takes for an acknowledgment of that packet to be received back at the origin. The RTT between a network and server can be determined by using the `ping` command.

```bash
$ ping example.com
ping example.com
```

This will output something like:

```plain
PING example.com (216.58.194.174): 56 data bytes
64 bytes from 216.58.194.174: icmp_seq=0 ttl=55 time=25.050 ms
64 bytes from 216.58.194.174: icmp_seq=1 ttl=55 time=23.781 ms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ To find out whether a given domain name is available,
- Alternatively, if you use a system with a built-in shell, type a `whois` command into it, as shown here for `mozilla.org`:

```bash
$ whois mozilla.org
whois mozilla.org
```

This will output the following:

```plain
Domain Name:MOZILLA.ORG
Domain ID: D1409563-LROR
Creation Date: 1998-01-24T05:00:00Z
Expand Down Expand Up @@ -119,11 +124,16 @@ As you can see, I can't register `mozilla.org` because the Mozilla Foundation ha
On the other hand, let's see if I could register `afunkydomainname.org`:

```bash
$ whois afunkydomainname.org
whois afunkydomainname.org
```

This will output the following (at the time of writing):

```plain
NOT FOUND
```

As you can see, the domain does not exist in the `whois` database (at the time of writing), so we could ask to register it. Good to know!
As you can see, the domain does not exist in the `whois` database, so we could ask to register it. Good to know!

#### Getting a domain name

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ You can confirm this by running the following command in the bash terminal:

```bash
python3 -V
Python 3.8.10
# Output: Python 3.8.10
```

However, the Python Package Index tool (_pip3_) you'll need to install packages for Python 3 (including Django) is **not** available by default.
Expand All @@ -127,13 +127,14 @@ sudo apt install python3-pip
### macOS

macOS does not include Python 3 by default (Python 2 is included on older versions).
You can confirm this by running the following commands in the zsh or bash terminal:
You can confirm this by running the following command in the terminal:

```bash
$ python3 -V
python3: command not found
python3 -V
```

This will either display the Python version number, which indicates that Python 3 is installed, or `python3: command not found`, which indicates Python 3 was not found.

You can easily install Python 3 (along with the _pip3_ tool) from [python.org](https://www.python.org/):

1. Download the required installer:
Expand All @@ -144,12 +145,7 @@ You can easily install Python 3 (along with the _pip3_ tool) from [python.org](h

2. Locate the file using _Finder_, and double-click the package file. Following the installation prompts.

You can now confirm successful installation by checking for the _Python 3_ version as shown below:

```bash
python3 -V
Python 3.10.2
```
You can now confirm successful installation by running `python3 -V` again and checking for the Python version number.

You can similarly check that _pip3_ is installed by listing the available packages:

Expand All @@ -174,7 +170,6 @@ You can then verify that Python 3 was installed by entering the following text i

```bash
py -3 -V
Python 3.10.2
```

The Windows installer incorporates _pip3_ (the Python package manager) by default.
Expand All @@ -195,29 +190,21 @@ You will note that in the previous sections we use different commands to call Py
If you only have Python 3 installed (and not Python 2), the bare commands `python` and `pip` can generally be used to run Python and pip on any operating system.
If this is allowed on your system you will get a version "3" string when you run `-V` with the bare commands, as shown:

```
> python -V
Python 3.10.2
> pip -V
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
```bash
python -V
pip -V
```

If Python 2 is installed then to use version 3 you should prefix commands with `python3` and `pip3` on Linux/macOS, and `py -3` and `py -3 -m pip` on Windows:

```bash
# Linux/macOS
python3 -V
pip3 -V

# Windows
py -3 -V
Python 3.10.2

py -3 -m pip list

# Linux/macOS
$ python3 -V
Python 3.10.2

$ pip3 -V
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
```

The instructions below show the platform specific commands as they work on more systems.
Expand Down Expand Up @@ -341,8 +328,12 @@ Once you've installed _virtualenvwrapper_ or _virtualenvwrapper-win_ then workin
Now you can create a new virtual environment with the `mkvirtualenv` command. As this command runs you'll see the environment being set up (what you see is slightly platform-specific). When the command completes the new virtual environment will be active — you can see this because the start of the prompt will be the name of the environment in brackets (below we show this for Ubuntu, but the final line is similar for Windows/macOS).
```bash
$ mkvirtualenv my_django_environment
mkvirtualenv my_django_environment
```
You should see output similar to the following:
```plain
Running virtualenv with interpreter /usr/bin/python3
# …
virtualenvwrapper.user_scripts creating /home/ubuntu/.virtualenvs/t_env7/bin/get_env_details
Expand Down Expand Up @@ -379,11 +370,9 @@ You can test that Django is installed by running the following command (this jus
```bash
# Linux/macOS
python3 -m django --version
4.0.10
# Windows
py -3 -m django --version
4.0.10
```
> **Note:** If the above Windows command does not show a django module present, try:
Expand Down Expand Up @@ -424,22 +413,14 @@ cd mytestsite
We can run the _development web server_ from within this folder using **manage.py** and the `runserver` command, as shown.
```bash
$ python3 manage.py runserver
Watching for file changes with StatReloader
Performing system checks…
System check identified no issues (0 silenced).
You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
March 01, 2022 - 01:19:16
Django version 4.0.10, using settings 'mytestsite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
# Linux/macOS
python3 manage.py runserver
# Windows
py -3 manage.py runserver
```
> **Note:** The above command shows the Linux/macOS command.
> You can ignore the warnings about "18 unapplied migration(s)" at this point!
> **Note:** You can ignore the warnings about "18 unapplied migration(s)" at this point!
Once the server is running you can view the site by navigating to the following URL on your local web browser: `http://127.0.0.1:8000/`. You should see a site that looks like this:
Expand Down
11 changes: 1 addition & 10 deletions files/en-us/learn/server-side/django/skeleton_website/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,16 +337,7 @@ During development, you can serve the website first using the _development web s
Run the _development web server_ by calling the `runserver` command (in the same directory as **manage.py**):
```bash
$ python3 manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
March 01, 2022 - 04:08:45
Django version 4.0.2, using settings 'locallibrary.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
python3 manage.py runserver
```
Once the server is running, you can view the site by navigating to `http://127.0.0.1:8000/` in your local web browser. You should see a site error page that looks like this:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,10 @@ The final step is to copy your application source files into the repo folder, an
It should look a bit like the listing below.

```bash
> git status
git status
```

```plain
On branch main
Your branch is up-to-date with 'origin/main'.
Changes to be committed:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,12 @@ As a slightly more exciting test let's create a very basic "pure node" server th
2. Start the server by navigating into the same directory as your `hellonode.js` file in your command prompt, and calling `node` along with the script name, like so:

```bash
>node hellonode.js
node hellonode.js
```

Once the server starts, you will see console output indicating the IP address the server is running on:

```plain
Server running at http://127.0.0.1:3000/
```

Expand Down Expand Up @@ -260,7 +265,12 @@ The following steps show how you can use npm to download a package, save it into
5. You can start the server by calling node with the script in your command prompt:
```bash
>node index.js
node index.js
```

You will see the following console output:

```plain
Example app listening on port 3000
```

Expand Down
Loading