-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Seems like `lake exe mk_all` has some hiccups.
- Loading branch information
1 parent
0341996
commit 441a6c7
Showing
1 changed file
with
26 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,26 @@ | ||
#!/usr/bin/env bash | ||
# Usage: mk_all.sh [subdirectory] | ||
# | ||
# Examples: | ||
# ./scripts/mk_all.sh | ||
# ./scripts/mk_all.sh data/real | ||
# ./scripts/mk_all.sh ../archive | ||
# | ||
# Makes a $directory/../$directory.lean file importing all files inside $directory. | ||
# If $directory is omitted, creates `LeanCamCombi.lean`. | ||
|
||
cd "$( dirname "${BASH_SOURCE[0]}" )"/../LeanCamCombi | ||
if [[ $# = 1 ]]; then | ||
dir="${1%/}" # remove trailing slash if present | ||
else | ||
dir="." | ||
fi | ||
|
||
# remove an initial `./` | ||
# replace an initial `../test/` with just `.` (similarly for `roadmap`/`archive`/...) | ||
# replace all `/` with `».«` | ||
# replace the `.lean` suffix with `»` | ||
# prepend `import «` | ||
find "$dir" -name \*.lean -not -name LeanCamCombi.lean \ | ||
| sed 's,^\./,,;s,^\.\./[^/]*,,;s,/,.,g;s,\.lean$,,;s,^,import LeanCamCombi.,' \ | ||
| sort >"$dir"/../LeanCamCombi.lean |