You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+57-1
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ and help execute tests locally via their favorite programming language.
10
10
- There are two ways for installing egor.
11
11
12
12
### Download compiled binary
13
-
- You can download the binary that corresponds to your operating system and add it to your `PATH` variable, you can find the binaries in the [releases](https://github.com/chermehdi/go-egor/releases) page.
13
+
- You can download the binary corresponding to your operating system and add it to your `PATH` variable, you can find the binaries in the [releases](https://github.com/chermehdi/go-egor/releases) page.
14
14
- For people running Mac OSX Catalina, this won't work and you will be forced to go with the Build from source solution.
15
15
16
16
### Build from source
@@ -68,6 +68,62 @@ $ egor config set cpp.lib.location
68
68
$ ls /home/directory/include
69
69
kratos
70
70
```
71
+
72
+
## Custom templates
73
+
74
+
- Egor also support the use of custom templates per each language, powered by the golang template engine. to take full advantage of it you can
75
+
take a look at all the details in the official [documentation](https://golang.org/pkg/text/template/).
76
+
77
+
- A typical configuration for a template, is the following:
78
+
```
79
+
//
80
+
// {{ if .Problem}} {{ .Problem }} {{ end }} {{ if .Url }} {{ .Url }} {{ end }}
81
+
{{- if .Author }}
82
+
// @author {{ .Author }}
83
+
// created {{ .Time }}
84
+
{{- end }}
85
+
//
86
+
#include <iostream>
87
+
#include <vector>
88
+
#include <set>
89
+
#include <algorithm>
90
+
#include <map>
91
+
92
+
using namespace std;
93
+
{{ if .MultipleTestCases }}
94
+
void solve() {
95
+
}
96
+
{{ end }}
97
+
98
+
int main() {
99
+
{{- if .FastIO }}
100
+
ios_base::sync_with_stdio(false);
101
+
cin.tie(0);
102
+
{{- end}}
103
+
104
+
{{- if .MultipleTestCases }}
105
+
int t; cin >> t;
106
+
while(t--) {
107
+
solve();
108
+
}
109
+
{{- end}}
110
+
}
111
+
```
112
+
Each template is provided by a model containing some basic information about the task that is going to be generated
113
+
to help create dynamic templates, the model reference is
114
+
```go
115
+
typeTemplateContextstruct {
116
+
Authorstring
117
+
Timestring
118
+
MultipleTestCasesbool
119
+
Interactivebool
120
+
FastIObool
121
+
Problemstring
122
+
Urlstring
123
+
}
124
+
```
125
+
You can access any of the model fields in the template, and make changes accordingly dependending on your preferences.
126
+
- Running the command `egor config set config.templates.{lang} /path/to/template/file` will register the given template and will use it for the given language for future tasks.
71
127
## Contribution
72
128
73
129
- Contribution to the project can be done in multiple ways, you can report bugs and issues or you can discuss new features that you like being added in future versions by creating a new issue
0 commit comments