Remove leading '>'
This change removes all leading '>' characters of console commands in order to be able to copy them from the tutorial.
First, you'll need to download [gir]:
```console
-> git clone https://github.com/gtk-rs/gir
-> cd gir
-> cargo install --path . # so we can use gir binary directly
+git clone https://github.com/gtk-rs/gir
+cd gir
+cargo install --path . # so we can use gir binary directly
```
Then the `.gir` files (luckily for you, we have a repository which contains all the ones you need for sourceview!):
```console
-> git clone https://github.com/gtk-rs/gir-files
+git clone https://github.com/gtk-rs/gir-files
```
If you look into `gir-files`, you'll see a file named `GtkSource-3.0.gir`. That's the one for sourceview.
@@ -19,14 +19,14 @@ If you look into `gir-files`, you'll see a file named `GtkSource-3.0.gir`. That'
Now let's create a new project for our `sourceview` crate:
```console
-> cargo new sourceview --lib
+cargo new sourceview --lib
```
Then let's create a folder inside the newly created `sourceview` folder for the `sys` part:
```console
-> cd sourceview
-> cargo new sourceview-sys --lib
+cd sourceview
+cargo new sourceview-sys --lib
```
To indicate to [gir] what to generate, we'll need a `Gir.toml` file (inside the `sourceview-sys` folder) containing:
@@ -65,9 +65,9 @@ sourceview/
Let's generate the `sys` crate now:
```console
-> cd sourceview-sys
-> # Run gir in "sys" mode (the "-m" option). We give the gir files path (the "-d" option) and output path (the "-o" option).
-> gir -m sys -d ../../gir-files/ -o .
+cd sourceview-sys
+# Run gir in "sys" mode (the "-m" option). We give the gir files path (the "-d" option) and output path (the "-o" option).
+gir -m sys -d ../../gir-files/ -o .
```
(In case a failure happens at this point, and you can't figure out what's going on, don't hesitate to reach us so we can give you a hand!)
@@ -82,7 +82,7 @@ You should now see new files (and a new folder):
Now let's try to build it:
```console
-> cargo build
+cargo build
```
Surprise! It doesn't build at all and you should see a loooooot of errors. Well, that was expected. We need to add some dependencies (you can find which ones in the `.gir` files) in order to make it work. Let's update our `Gir.toml` file to make it look like this:
@@ -108,9 +108,9 @@ external_libraries = [
Now we regenerate it then rebuild it:
```console
-> rm Cargo.* # we remove Cargo files
-> gir -m sys -d ../../gir-files/ -o .
-> cargo build
+rm Cargo.* # we remove Cargo files
+gir -m sys -d ../../gir-files/ -o .
+cargo build
```
Should work just fine!
@@ -140,13 +140,13 @@ external_libraries = [
Now, if you want to regenerate, just run:
```console
-> gir -o .
+gir -o .
```
Now we have a working `sys` containing all functions and objects definition. Just to be sure everything was correctly generated, we can run some tests (graciously generated by [gir] as well):
```console
-> cargo test
+cargo test
```
Normally, all tests passed. If you get an error when running those tests, it's very likely that the `sys` generation is invalid and/or incomplete.
