-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: checkout bar repo and do some magic
- Loading branch information
0 parents
commit b4f75cb
Showing
6 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.DS_Store | ||
.idea | ||
*.log | ||
tmp/ | ||
.direnv | ||
bar-repo |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
inputs = { | ||
utils.url = "github:numtide/flake-utils"; | ||
}; | ||
outputs = { | ||
self, | ||
nixpkgs, | ||
utils, | ||
}: | ||
utils.lib.eachDefaultSystem ( | ||
system: let | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
in { | ||
devShell = pkgs.mkShell { | ||
buildInputs = with pkgs; [ | ||
just | ||
lua | ||
lua54Packages.dkjson | ||
jq | ||
]; | ||
}; | ||
} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
init: | ||
#!/usr/bin/env bash | ||
git clone --filter=blob:none --no-checkout --depth 1 --sparse [email protected]:beyond-all-reason/Beyond-All-Reason.git bar-repo | ||
cd bar-repo | ||
git sparse-checkout set --no-cone "units" "language/en" | ||
git sparse-checkout list | ||
git checkout | ||
find-by-name name: | ||
cat bar-repo/language/en/units.json | jq '.units.names | to_entries | .[] | select(.value=="{{name}}") | .key'\ | ||
|
||
file key: | ||
find bar-repo/units -name "{{key}}.lua"; | ||
|
||
data key: | ||
cat `just file {{key}}` | ||
|
||
data-json key: | ||
lua tojson.lua `just file {{key}} | sed 's/.lua//'` | ||
|
||
data-json-by-name name: | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
key=`just find-by-name {{name}}` | ||
lua tojson.lua `just file $key | sed 's/.lua//'` | jq '.[] | { metalcost: .metalcost, energycost: .energycost, buildtime: (.buildtime/100) }' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
local json = require ("dkjson") | ||
|
||
local data = require(arg[1]) | ||
|
||
local str = json.encode (data, { indent = true }) | ||
|
||
print(str) |