Skip to content

Commit dd861b2

Browse files
authored
Merge pull request #44 from virtualroot/feat/lastUpdated
feat: add last updated
2 parents 04e908e + 98029cf commit dd861b2

6 files changed

Lines changed: 35 additions & 8 deletions

File tree

data/tools.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"lastUpdated": "2026-03-18",
23
"opentofu": {
34
"version": "1.11",
45
"versionURL": "https://github.com/opentofu/opentofu/releases/latest",

layouts/_default/baseof.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
<meta name="twitter:url" content="https://cani.tf/">
1919
<meta name="twitter:title" content="cani.tf — Compare OpenTofu vs Terraform Feature Support">
2020
<meta name="twitter:description" content="Quickly compare OpenTofu and Terraform feature support. Find out which features are available, planned, or missing as the two continue to diverge.">
21+
22+
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
2123
<!-- Place this tag in your head or just before your close body tag. -->
2224
<script async defer src="https://buttons.github.io/buttons.js"></script>
2325
<style type="text/css">
@@ -118,6 +120,11 @@
118120
background: darkgreen;
119121
}
120122

123+
.updated {
124+
text-align: center;
125+
font-size: 1rem;
126+
color: #555;
127+
}
121128
</style>
122129

123130
</head>

layouts/_default/home.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,23 @@ <h1><a href="https://cani.tf/">Can I TF</a></h1>
2424
{{- /* Loop through Version */ -}}
2525
<tr>
2626
<td>Version</td>
27-
{{ range $toolName, $toolData := .Site.Data.tools }}
27+
{{ range $toolName, $toolData := .Site.Data.tools }}{{ if ne $toolName "lastUpdated" }}
2828
<td><a href="{{ $toolData.versionURL }}">{{ $toolData.version }}</a></td>
29-
{{- end }}
29+
{{- end }}{{ end }}
3030
</tr>
3131
{{- /* Loop through License */ -}}
3232
<tr>
3333
<td>License</td>
34-
{{ range $toolName, $toolData := .Site.Data.tools }}
34+
{{ range $toolName, $toolData := .Site.Data.tools }}{{ if ne $toolName "lastUpdated" }}
3535
<td><a href="{{ $toolData.licenseURL }}">{{ $toolData.license }}</a></td>
36-
{{- end }}
36+
{{- end }}{{ end }}
3737
</tr>
3838
{{- /* Loop through Registry */ -}}
3939
<tr>
4040
<td>Registry</td>
41-
{{ range $toolName, $toolData := .Site.Data.tools }}
41+
{{ range $toolName, $toolData := .Site.Data.tools }}{{ if ne $toolName "lastUpdated" }}
4242
<td><a href="{{ $toolData.registry }}">{{ $toolName }}</a></td>
43-
{{- end }}
43+
{{- end }}{{ end }}
4444
</tr>
4545

4646
{{- /* Loop through OpenTofu features */ -}}
@@ -104,6 +104,7 @@ <h1><a href="https://cani.tf/">Can I TF</a></h1>
104104
</table>
105105
</div>
106106
</main>
107+
<p class="updated">Last updated: {{ .Site.Data.tools.lastUpdated }}</p>
107108
<footer>
108109
<h2>About</h2>
109110
<p class="description">As time passes, OpenTofu and Terraform become more distant from each other. <a

main.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"encoding/json"
66
"fmt"
77
"os"
8+
"time"
89

910
"github.com/qri-io/jsonschema"
1011
"gopkg.in/yaml.v3"
@@ -157,13 +158,24 @@ func main() {
157158
os.Exit(1)
158159
}
159160

161+
output := make(map[string]interface{}, len(tools)+1)
162+
for k, v := range tools {
163+
output[k] = v
164+
}
165+
output["lastUpdated"] = time.Now().UTC().Format("2006-01-02")
166+
167+
outputJSON, err := json.MarshalIndent(output, "", " ")
168+
if err != nil {
169+
panic("marshal output: " + err.Error())
170+
}
171+
160172
// File for Hugo to template the table
161-
if err := os.WriteFile("data/tools.json", toolsJSON, 0644); err != nil {
173+
if err := os.WriteFile("data/tools.json", outputJSON, 0644); err != nil {
162174
panic(err)
163175
}
164176

165177
// allow access to https://cani.tf/tools.json
166-
if err := os.WriteFile("static/tools.json", toolsJSON, 0644); err != nil {
178+
if err := os.WriteFile("static/tools.json", outputJSON, 0644); err != nil {
167179
panic(err)
168180
}
169181
}

static/favicon.svg

Lines changed: 5 additions & 0 deletions
Loading

static/tools.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"lastUpdated": "2026-03-18",
23
"opentofu": {
34
"version": "1.11",
45
"versionURL": "https://github.com/opentofu/opentofu/releases/latest",

0 commit comments

Comments
 (0)