Skip to content

Commit

Permalink
Restore mk_all.sh
Browse files Browse the repository at this point in the history
Seems like `lake exe mk_all` has some hiccups.
  • Loading branch information
YaelDillies committed Jun 14, 2024
1 parent 0341996 commit 441a6c7
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions scripts/mk_all.sh
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

0 comments on commit 441a6c7

Please sign in to comment.