Skip to content

Commit a7fd3e9

Browse files
authored
Add const usage example; highlighting (#39)
1 parent ba1d005 commit a7fd3e9

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,27 @@ julia> run(`$(git()) clone https://github.com/JuliaRegistries/General`)
2424

2525
This can equivalently be written with explicitly split arguments as
2626

27-
```
27+
```julia
2828
julia> run(git(["clone", "https://github.com/JuliaRegistries/General"]))
2929
```
3030

31-
to bypass the parsing of the command string.
31+
to bypass the parsing of the command string. Of course, one can also do
3232

33-
To read a single line of output from a git command you can use `readchomp`,
33+
```julia
34+
julia> import Git
35+
36+
julia> const git = Git.git()
3437

38+
julia> run(`$git clone https://github.com/JuliaRegistries/General`)
3539
```
40+
41+
This is thread-safe since `Cmd` objects are not stateful. However, note that the
42+
`git` command object won't notice any changes to environmental variables
43+
(like `GIT_CURL_VERBOSE` for example) since it was created.
44+
45+
To read a single line of output from a git command you can use `readchomp`,
46+
47+
```julia
3648
julia> cd("General")
3749

3850
julia> readchomp(`$(git()) remote get-url origin`)
@@ -41,7 +53,7 @@ julia> readchomp(`$(git()) remote get-url origin`)
4153

4254
and `readlines` for multiple lines.
4355

44-
```
56+
```julia
4557
julia> readlines(`$(git()) log`)
4658
```
4759

0 commit comments

Comments
 (0)