summaryrefslogtreecommitdiffstats
path: root/bin/import-statements
diff options
context:
space:
mode:
Diffstat (limited to 'bin/import-statements')
-rwxr-xr-xbin/import-statements10
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/import-statements b/bin/import-statements
new file mode 100755
index 000000000..12c887970
--- /dev/null
+++ b/bin/import-statements
@@ -0,0 +1,10 @@
+#! /bin/sh
+# import-statements : lines (path ":" string) |> lines (path ":" relpath)
+set -euf
+sed -n '
+ s@^\([^:]\+:\)\('"$(bre-invert-word import)"'\)*\<import\s\+@\1@
+ t1;d
+ :1; s@^\([^:]\+:\)\(\.*/\S*\)@\1\2\n@
+ t2;d
+ :2; P;D
+'