diff --git a/lib/header/c.ex b/lib/header/c.ex
index b58399a..8c35d78 100644
--- a/lib/header/c.ex
+++ b/lib/header/c.ex
@@ -1,5 +1,5 @@
## update_header
-## Copyright 2022 kmx.io <contact@kmx.io>
+## Copyright 2022, 2023 kmx.io <contact@kmx.io>
defmodule Header.C do
def split(src) do
diff --git a/lib/header/cli.ex b/lib/header/cli.ex
deleted file mode 100644
index 8d2dae0..0000000
--- a/lib/header/cli.ex
+++ /dev/null
@@ -1,3 +0,0 @@
-## update_header
-## Copyright 2022 kmx.io <contact@kmx.io>
-
diff --git a/lib/header/common_lisp.ex b/lib/header/common_lisp.ex
new file mode 100644
index 0000000..53ac62d
--- /dev/null
+++ b/lib/header/common_lisp.ex
@@ -0,0 +1,38 @@
+## update_header
+## Copyright 2022, 2023 kmx.io <contact@kmx.io>
+
+defmodule Header.CommonLisp do
+ def split(src) do
+ split(src, [])
+ end
+
+ def split([line = (";" <> _) | rest], acc) do
+ split(rest, [line | acc])
+ end
+ def split([line | rest], acc) do
+ case Regex.run(~r/^\s*$/, line) do
+ [_] -> split(rest, acc)
+ _ ->
+ acc = Enum.reverse(acc) |> Enum.join("\n")
+ rest = [line | rest] |> Enum.join("\n")
+ {acc, rest}
+ end
+ end
+ def split([], acc) do
+ acc = Enum.reverse(acc) |> Enum.join("\n")
+ {acc, ""}
+ end
+
+ def main([src_path | dest_paths]) do
+ {:ok, src} = File.read(src_path)
+ src_lines = String.split(src, "\n")
+ {header, _} = split(src_lines)
+ Enum.each dest_paths, fn dest_path ->
+ {:ok, dest} = File.read(dest_path)
+ dest_lines = String.split(dest, "\n")
+ {_, rest} = split(dest_lines)
+ result = header <> "\n\n" <> rest
+ File.write(dest_path, result)
+ end
+ end
+end
diff --git a/lib/header/make.ex b/lib/header/make.ex
index 5804d28..d757076 100644
--- a/lib/header/make.ex
+++ b/lib/header/make.ex
@@ -1,5 +1,5 @@
## update_header
-## Copyright 2022 kmx.io <contact@kmx.io>
+## Copyright 2022, 2023 kmx.io <contact@kmx.io>
defmodule Header.Make do
def split(src) do
diff --git a/lib/mix/tasks/licence.ex b/lib/mix/tasks/licence.ex
index aec0405..331fbb5 100644
--- a/lib/mix/tasks/licence.ex
+++ b/lib/mix/tasks/licence.ex
@@ -1,5 +1,5 @@
## update_header
-## Copyright 2022 kmx.io <contact@kmx.io>
+## Copyright 2022, 2023 kmx.io <contact@kmx.io>
defmodule Mix.Tasks.Licence do
use Mix.Task
diff --git a/lib/update_header.ex b/lib/update_header.ex
index 01c70b4..00fc120 100644
--- a/lib/update_header.ex
+++ b/lib/update_header.ex
@@ -1,5 +1,5 @@
## update_header
-## Copyright 2022 kmx.io <contact@kmx.io>
+## Copyright 2022, 2023 kmx.io <contact@kmx.io>
defmodule UpdateHeader do
@@ -25,7 +25,11 @@ defmodule UpdateHeader do
_ ->
case Regex.run(~r/[.]exs?$/, src_path) do
[_] -> Header.Make
- _ -> raise "error"
+ _ ->
+ case Regex.run(~r/[.]asd$/, src_path) do
+ [_] -> Header.CommonLisp
+ _ -> raise "unknown source file"
+ end
end
end
end
diff --git a/mix.exs b/mix.exs
index 9436308..af8538d 100644
--- a/mix.exs
+++ b/mix.exs
@@ -1,5 +1,5 @@
## update_header
-## Copyright 2022 kmx.io <contact@kmx.io>
+## Copyright 2022, 2023 kmx.io <contact@kmx.io>
defmodule UpdateHeader.MixProject do
use Mix.Project