@@ -16,14 +16,18 @@ defmodule GitPair.Actions do
1616
1717 def init ( ) do
1818 File . mkdir_p! ( Path . dirname ( @ commit_msg_hook_path ) )
19+
1920 case File . write ( @ commit_msg_hook_path , @ commit_msg_hook_content ) do
2021 :ok ->
2122 File . chmod ( @ commit_msg_hook_path , 0o755 )
2223 { :ok , "Initialize with success" }
24+
2325 { :error , :enotdir } ->
2426 { :error , "You must initialize in a git repository" }
27+
2528 { :error , :enoent } ->
2629 { :error , "File does not exist" }
30+
2731 _ ->
2832 { :error , "Failed to initialize git-pair for this repository" }
2933 end
@@ -42,7 +46,7 @@ defmodule GitPair.Actions do
4246 end
4347
4448 def status ( ) do
45- "Pairing with: \n \n " <> Enum . join ( collaborators , "\n " )
49+ ( "Pairing with: \n \n " <> Enum . join ( collaborators , "\n " ) )
4650 |> output ( )
4751 end
4852
@@ -66,16 +70,19 @@ defmodule GitPair.Actions do
6670 case command ( "--get-all" ) do
6771 { collaborators , 0 } ->
6872 String . split ( collaborators , "\n " )
69- |> ( & ( List . delete_at ( & 1 , length ( & 1 ) - 1 ) ) ) . ( )
73+ |> ( & List . delete_at ( & 1 , length ( & 1 ) - 1 ) ) . ( )
74+
7075 _ ->
7176 [ ]
7277 end
7378 end
7479
7580 defp make_co_authored_by ( ) do
76- "\n " <> ( Enum . map ( collaborators , fn collaborator ->
77- "Co-authored-by: #{ collaborator } <#{ collaborator } @users.noreply.github.com>"
78- end ) |> Enum . join ( "\n " ) )
81+ "\n " <>
82+ ( Enum . map ( collaborators , fn collaborator ->
83+ "Co-authored-by: #{ collaborator } <#{ collaborator } @users.noreply.github.com>"
84+ end )
85+ |> Enum . join ( "\n " ) )
7986 end
8087
8188 defp output ( { "" , @ success_exit_status } , message ) do
0 commit comments