style: code style
This commit is contained in:
@@ -154,19 +154,19 @@ fn install_commit_msg(force: bool) {
|
|||||||
}
|
}
|
||||||
let git_hooks_commit_msg = git_hooks.join("commit-msg");
|
let git_hooks_commit_msg = git_hooks.join("commit-msg");
|
||||||
if git_hooks_commit_msg.exists() && !force {
|
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));
|
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| {
|
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));
|
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| {
|
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));
|
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| {
|
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));
|
exit_with_error_message(&format!("Apply executable permission on file: {:?}, failed: {}", git_hooks_commit_msg, e))
|
||||||
});
|
);
|
||||||
|
|
||||||
print_ok("Install commit-msg to repo successed!");
|
print_ok("Install commit-msg to repo successed!");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user