diff --git a/scripts/commit-msg.crs b/scripts/commit-msg.crs index cbf28d7..a432ef5 100755 --- a/scripts/commit-msg.crs +++ b/scripts/commit-msg.crs @@ -154,19 +154,19 @@ fn install_commit_msg(force: bool) { } let git_hooks_commit_msg = git_hooks.join("commit-msg"); if git_hooks_commit_msg.exists() && !force { - exit_with_error_message(&format!("File {:?} exists! or try forceinstall.", git_hooks_commit_msg)); + exit_with_error_message(&format!("File {:?} exists! or try {}forceinstall{}.", git_hooks_commit_msg, BOLD, END)); } print_info(&format!("Copy file: {:?} to: {:?}", commig_msg_exec_file, git_hooks_commit_msg)); - let commig_msg_exec_file_content = fs::read(&commig_msg_exec_file).unwrap_or_else(|e| { - exit_with_error_message(&format!("Read file: {:?} failed: {}.", commig_msg_exec_file, e)); - }); - fs::write(&git_hooks_commit_msg, commig_msg_exec_file_content).unwrap_or_else(|e| { - exit_with_error_message(&format!("Write file: {:?} failed: {}.", git_hooks_commit_msg, e)); - }); - fs::set_permissions(&git_hooks_commit_msg, PermissionsExt::from_mode(0o755)).unwrap_or_else(|e| { - exit_with_error_message(&format!("Apply executable permission on file: {:?} failed: {}.", git_hooks_commit_msg, e)); - }); + let commig_msg_exec_file_content = fs::read(&commig_msg_exec_file).unwrap_or_else(|e| + exit_with_error_message(&format!("Read file: {:?}, failed: {}", commig_msg_exec_file, e)) + ); + fs::write(&git_hooks_commit_msg, commig_msg_exec_file_content).unwrap_or_else(|e| + exit_with_error_message(&format!("Write file: {:?}, failed: {}", git_hooks_commit_msg, e)) + ); + fs::set_permissions(&git_hooks_commit_msg, PermissionsExt::from_mode(0o755)).unwrap_or_else(|e| + exit_with_error_message(&format!("Apply executable permission on file: {:?}, failed: {}", git_hooks_commit_msg, e)) + ); print_ok("Install commit-msg to repo successed!"); }