Skip to content

Commit 6e04159

Browse files
committed
Improve markdown for crane code snippets
Before this change, code snippets in the README were hard to copy since they contained a leading `$ ` and mixed shell commands with console output. This change aims to improve the syntax so pure shell code snippets are easier to copy and so console output is marked as such (so GitHub can properly distinguish between command and output when rendering it). Also adds correct code fence for a YAML snippet.
1 parent 59a4b85 commit 6e04159

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

cmd/crane/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,29 @@ A collection of useful things you can do with `crane` is [here](recipes.md).
1414
1. Get the [latest release](https://github.com/google/go-containerregistry/releases/latest) version.
1515

1616
```sh
17-
$ VERSION=$(curl -s "https://api.github.com/repos/google/go-containerregistry/releases/latest" | jq -r '.tag_name')
17+
VERSION=$(curl -s "https://api.github.com/repos/google/go-containerregistry/releases/latest" | jq -r '.tag_name')
1818
```
1919

2020
or set a specific version:
2121

2222
```sh
23-
$ VERSION=vX.Y.Z # Version number with a leading v
23+
VERSION=vX.Y.Z # Version number with a leading v
2424
```
2525

2626
1. Download the release.
2727

2828
```sh
29-
$ OS=Linux # or Darwin, Windows
30-
$ ARCH=x86_64 # or arm64, x86_64, armv6, i386, s390x
31-
$ curl -sL "https://github.com/google/go-containerregistry/releases/download/${VERSION}/go-containerregistry_${OS}_${ARCH}.tar.gz" > go-containerregistry.tar.gz
29+
OS=Linux # or Darwin, Windows
30+
ARCH=x86_64 # or arm64, x86_64, armv6, i386, s390x
31+
curl -sL "https://github.com/google/go-containerregistry/releases/download/${VERSION}/go-containerregistry_${OS}_${ARCH}.tar.gz" > go-containerregistry.tar.gz
3232
```
3333

3434
1. Verify the signature. We generate [SLSA 3 provenance](https://slsa.dev) using
3535
the OpenSSF's [slsa-framework/slsa-github-generator](https://github.com/slsa-framework/slsa-github-generator).
3636
To verify our release, install the verification tool from [slsa-framework/slsa-verifier#installation](https://github.com/slsa-framework/slsa-verifier#installation)
3737
and verify as follows:
3838

39-
```sh
39+
```console
4040
$ curl -sL https://github.com/google/go-containerregistry/releases/download/${VERSION}/multiple.intoto.jsonl > provenance.intoto.jsonl
4141
$ # NOTE: You may be using a different architecture.
4242
$ slsa-verifier-linux-amd64 verify-artifact go-containerregistry.tar.gz --provenance-path provenance.intoto.jsonl --source-uri github.com/google/go-containerregistry --source-tag "${VERSION}"
@@ -46,7 +46,7 @@ A collection of useful things you can do with `crane` is [here](recipes.md).
4646
1. Unpack it in the PATH.
4747

4848
```sh
49-
$ tar -zxvf go-containerregistry.tar.gz -C /usr/local/bin/ crane
49+
tar -zxvf go-containerregistry.tar.gz -C /usr/local/bin/ crane
5050
```
5151

5252
### Install manually
@@ -62,15 +62,15 @@ go install github.com/google/go-containerregistry/cmd/crane@latest
6262
If you're macOS user and using [Homebrew](https://brew.sh/), you can install via brew command:
6363

6464
```sh
65-
$ brew install crane
65+
brew install crane
6666
```
6767

6868
### Install on Arch Linux
6969

7070
If you're an Arch Linux user you can install via pacman command:
7171

7272
```sh
73-
$ pacman -S crane
73+
pacman -S crane
7474
```
7575

7676
### Setup on GitHub Actions
@@ -79,7 +79,7 @@ You can use the [`setup-crane`](https://github.com/imjasonh/setup-crane) action
7979
to install `crane` and setup auth to [GitHub Container
8080
Registry](https://github.com/features/packages) in a GitHub Action workflow:
8181

82-
```
82+
```yaml
8383
steps:
8484
- uses: imjasonh/[email protected]
8585
```
@@ -88,7 +88,7 @@ steps:
8888
8989
You can also use crane as docker image
9090
91-
```sh
91+
```console
9292
$ docker run --rm gcr.io/go-containerregistry/crane ls ubuntu
9393
10.04
9494
12.04.5

0 commit comments

Comments
 (0)