File: fmt

package info (click to toggle)
addchain 0.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,396 kB
  • sloc: sh: 428; makefile: 8
file content (23 lines) | stat: -rwxr-xr-x 541 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bash

set -exuo pipefail

repo="github.com/mmcloughlin/addchain"

# Find files.
mapfile -t files < <(find . -name '*.go' -print0 | xargs -0 grep -L '// Code generated')

# Go formatting.
sed -i.fmtbackup '/^import (/,/)/ { /^$$/ d; }' "${files[@]}"
find . -name '*.fmtbackup' -delete

gofumports -w -local "${repo}" "${files[@]}"

# Math formatting.
mathfmt -w "${files[@]}"

# Bibliography references.
bib process -bib doc/references.bib -w "${files[@]}"

# Format the bibliography itself.
bib fmt -bib doc/references.bib -w