1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
use SystemTime;
use crate::;
// use inquire::Select;
use ;
use Colorize;
// fn commit_conventional_commit_standard(commit_options: &Commit) -> String {
// let commit_type_options = &[
// "feat:\tA new feature",
// "fix:\tA bug fix",
// "docs:\tDocumentation only changes",
// "style:\tChanges that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)",
// "refactor:\tA code change that neither fixes a bug nor adds a feature",
// "perf:\tA code change that improves performance",
// "test:\tAdding missing tests or correcting existing tests",
// "build:\tChanges that affect the build system or external dependencies (example scons, gulp, grunt, broccoli, npm, etc.)",
// "ci:\tChanges to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs, etc.)",
// "chore:\tOther changes that don't modify src/bin files",
// "revert:\tReverts a previous commit",
// ];
// let selected_commit_type = FuzzySelect::with_theme(&ColorfulTheme::default())
// .with_prompt("Select the type of change that you're committing:")
// .default(0)
// .items(&commit_type_options[..])
// .interact()
// .unwrap();
// let commit_type = commit_type_options[selected_commit_type].split(":").next().unwrap();
// let scope: String = Input::new()
// .with_prompt(
// format!("{}{}:{}", "What is the scope of this change ", "(e.g. component or file name)".yellow().bold(), " (press enter to skip)".black().bold())
// )
// .default("".into())
// .interact_text().unwrap();
// println!("scope: {}", scope);
// let remaining_subject_length = get_remaining_subject_length(commit_type, &scope);
// let subject: String = Input::new()
// .with_prompt(
// format!("{}{}{}{}:", "Write a short, imperative tense description of the change ", "(max ".yellow().bold(), remaining_subject_length.to_string().yellow().bold(), " chars)".yellow().bold())
// )
// .validate_with(|input: &String| -> Result<(), &str> {
// if input.len() <= remaining_subject_length {
// Ok(())
// } else {
// Err(
// // TODO: look into refactoring using thiserror
// // format!("{}{}\n{}{}{}{}\n\n", "Error:".red().bold(), "Provided subject exceeds character limit", "Expected: ".yellow().bold(), "at most ", remaining_subject_length, " characters")
// // .to_string().as_str()
// "Provided subject exceeds character limit"
// )
// }
// })
// .default("".into())
// .interact_text().unwrap();
// println!("subject: {}", subject);
// let body: String = Input::new()
// .with_prompt(
// format!("{}:{}", "Provide a longer description of the change", " (press enter to skip)".black().bold())
// )
// .default("".into())
// .interact_text().unwrap();
// let commit_message =
// match scope.len() {
// 0 => format!("{}: {}\n\n{}", commit_type, subject, body),
// _ => format!("{}({}): {}\n\n{}", commit_type, scope, subject, body)
// };
// println!("{}", commit_message);
// commit_message
// }
// fn commit_angular_commit_standard(commit_options: &Commit) -> String {
// // let commit_message = format!(
// // "{} {} {} {}",
// // commit_options.message.trim(),
// // commit_options.scope.trim(),
// // commit_options.type_of_change.trim(),
// // commit_options.subject.trim()
// // );
// // commit_message
// "angular message".to_string()
// }
// fn commit_none(commit_options: &Commit) -> String {
// // let commit_message = format!(
// // "{} {} {} {}",
// // commit_options.message.trim(),
// // commit_options.scope.trim(),
// // commit_options.type_of_change.trim(),
// // commit_options.subject.trim()
// // );
// // commit_message
// "none message".to_string()
// }
// // all message options support fuzzy select for user input allowing for
// // enhanced user experience
// // TODO
// // Linting for your commit messages baked-in, but you can also extend
// // them / add your own.
// // Will also run a lint over your commit message to ensure it follows the commit standard similar to the JavaScript tool, commitlint.
// // TODO look into git trailer format
// // https://git-scm.com/docs/git-interpret-trailers