Skip to content

Commit 4453755

Browse files
committed
wip
1 parent 79c3a92 commit 4453755

File tree

1 file changed

+223
-5
lines changed

1 file changed

+223
-5
lines changed

src/popups/conventional_commit.rs

Lines changed: 223 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ enum MoreInfoCommit {
6060
Feature,
6161
// 📝
6262
Documentation,
63-
// 💄:lipstick:
63+
// 💄
6464
UI,
6565
// 🎉
6666
Initial,
67-
// ✅:white_check_mark:
67+
// ✅
6868
TestsPassing,
69-
// ➕Add
69+
// ➕
7070
Add,
71-
// ➖Remove
71+
// ➖
7272
Remove,
7373
// 🔒️
7474
Security,
@@ -100,7 +100,7 @@ enum MoreInfoCommit {
100100
ExternalDependencyChange,
101101
// 🚚
102102
RenameResources,
103-
// ♿️:wheelchair:
103+
// ♿️
104104
Accessibility,
105105
// 📜
106106
Readme,
@@ -144,6 +144,224 @@ enum MoreInfoCommit {
144144
Validation,
145145
}
146146

147+
impl MoreInfoCommit {
148+
fn strings(&self) -> (&'static str, &'static str, &'static str) {
149+
match *self {
150+
MoreInfoCommit::UI => ("💄", "UI", "UI related"),
151+
MoreInfoCommit::CodeStyle => {
152+
("🎨", "style", "Style of the code")
153+
}
154+
MoreInfoCommit::Performance => ("⚡️", "", "Performance"),
155+
MoreInfoCommit::Bug => ("🐛", "bug", "Normal bug"),
156+
MoreInfoCommit::CriticalBug => {
157+
("🚑️", "critical bug", "Critical Bug")
158+
}
159+
MoreInfoCommit::Feature => ("✨", "", "Feature"),
160+
MoreInfoCommit::Documentation => {
161+
("📝", "", "Documentation")
162+
}
163+
MoreInfoCommit::Initial => ("🎉", "", "Initial commit!"),
164+
MoreInfoCommit::TestsPassing => {
165+
("✅", "passing", "Test are now passing!")
166+
}
167+
MoreInfoCommit::Add => ("➕", "add", "Added"),
168+
MoreInfoCommit::Remove => ("➖", "remove", "Removed"),
169+
MoreInfoCommit::Security => {
170+
("🔒️", "security", "Secutiry related")
171+
}
172+
MoreInfoCommit::Release => {
173+
("🔖", "release", "A new relase")
174+
}
175+
MoreInfoCommit::Warning => ("⚠️", "warning", "Warning"),
176+
MoreInfoCommit::Wip => ("🚧", "", "WIP"),
177+
MoreInfoCommit::Down => ("⬇️", "downgrade", "Down"),
178+
MoreInfoCommit::Up => ("⬆️", "upgrade", "Up"),
179+
MoreInfoCommit::CI => ("👷", "", "CI related"),
180+
MoreInfoCommit::Refactor => ("♻️", "", "Refactor related"),
181+
MoreInfoCommit::TrackCode => {
182+
("📈", "track", "Tracking code")
183+
}
184+
MoreInfoCommit::Typo => ("✏️", "typo", "Typo"),
185+
MoreInfoCommit::Internationalization => {
186+
("🌐", "i18n", "Internationalization")
187+
}
188+
MoreInfoCommit::Revert => ("⏪️", "", "Revert"),
189+
MoreInfoCommit::Package => ("📦️", "", "Package related"),
190+
MoreInfoCommit::ExternalDependencyChange => (
191+
"👽️",
192+
"change due to external dep update",
193+
"Code related to change of ext dep",
194+
),
195+
MoreInfoCommit::RenameResources => {
196+
("🚚", "rename", "Rename some resources")
197+
}
198+
MoreInfoCommit::Accessibility => {
199+
("♿️", "accessibility", "Improved accessibility")
200+
}
201+
MoreInfoCommit::Readme => ("📜", "README", "README"),
202+
MoreInfoCommit::License => ("⚖️", "LICENSE", "LICENSE"),
203+
MoreInfoCommit::TextLiteral => {
204+
("💬", "raw value", "Modified literal value")
205+
}
206+
MoreInfoCommit::DatabaseRelated => {
207+
("⛃", "db", "Database related")
208+
}
209+
MoreInfoCommit::AddLogs => ("🔊", "add logs", "Add logs"),
210+
MoreInfoCommit::RemoveLogs => {
211+
("🔇", "remove logs", "Remove logs")
212+
}
213+
MoreInfoCommit::ImproveExperience => {
214+
("🚸", "experience", "Improve experience")
215+
}
216+
MoreInfoCommit::ArchitecturalChanges => {
217+
("🏗️", "architecture", "Architectural Changes")
218+
}
219+
MoreInfoCommit::WrittingReallyBadCode => (
220+
"🤡",
221+
"really bad code",
222+
"This is some REALLY bad code",
223+
),
224+
MoreInfoCommit::GitIgnore => {
225+
("🙈", "gitignore", "GitIgnore")
226+
}
227+
MoreInfoCommit::Experimentations => {
228+
("⚗️", "experimentations", "Experimentations")
229+
}
230+
MoreInfoCommit::Flag => ("🚩", "flag", "Flag"),
231+
MoreInfoCommit::Trash => ("🗑️", "", "Trash"),
232+
MoreInfoCommit::Authorization => {
233+
("🛂", "authorization", "Authorization")
234+
}
235+
MoreInfoCommit::QuickFix => {
236+
("🩹", "quick-fix", "QuickFix")
237+
}
238+
MoreInfoCommit::RemoveDeadCode => {
239+
("⚰️", "remove dead code", "RemoveDeadCode")
240+
}
241+
MoreInfoCommit::Business => {
242+
("👔", "business", "Business related")
243+
}
244+
MoreInfoCommit::HealthCheck => {
245+
("🩺", "healthcheck", "HealthCheck")
246+
}
247+
MoreInfoCommit::Infra => ("🧱", "infra", "Infra"),
248+
MoreInfoCommit::Validation => {
249+
("🦺", "validation", "Validation")
250+
}
251+
}
252+
}
253+
}
254+
255+
impl CommitType {
256+
fn more_info(&self) -> Vec<MoreInfoCommit> {
257+
match *self {
258+
CommitType::Fix => {
259+
vec![
260+
MoreInfoCommit::Bug,
261+
MoreInfoCommit::CriticalBug,
262+
MoreInfoCommit::Security,
263+
MoreInfoCommit::Warning,
264+
MoreInfoCommit::TrackCode,
265+
MoreInfoCommit::Typo,
266+
MoreInfoCommit::TextLiteral,
267+
MoreInfoCommit::ExternalDependencyChange,
268+
MoreInfoCommit::DatabaseRelated,
269+
MoreInfoCommit::Authorization,
270+
MoreInfoCommit::QuickFix,
271+
MoreInfoCommit::HealthCheck,
272+
MoreInfoCommit::Business,
273+
MoreInfoCommit::Infra,
274+
]
275+
}
276+
CommitType::Feature => vec![
277+
MoreInfoCommit::Feature,
278+
MoreInfoCommit::Security,
279+
MoreInfoCommit::TrackCode,
280+
MoreInfoCommit::Internationalization,
281+
MoreInfoCommit::Package,
282+
MoreInfoCommit::Accessibility,
283+
MoreInfoCommit::Readme,
284+
MoreInfoCommit::License,
285+
MoreInfoCommit::DatabaseRelated,
286+
MoreInfoCommit::Flag,
287+
MoreInfoCommit::Authorization,
288+
MoreInfoCommit::Business,
289+
MoreInfoCommit::Validation,
290+
],
291+
CommitType::Chore | CommitType::Refactor => vec![
292+
MoreInfoCommit::Security,
293+
MoreInfoCommit::Refactor,
294+
MoreInfoCommit::TrackCode,
295+
MoreInfoCommit::Internationalization,
296+
MoreInfoCommit::RenameResources,
297+
MoreInfoCommit::Accessibility,
298+
MoreInfoCommit::Readme,
299+
MoreInfoCommit::License,
300+
MoreInfoCommit::TextLiteral,
301+
MoreInfoCommit::DatabaseRelated,
302+
MoreInfoCommit::RemoveLogs,
303+
MoreInfoCommit::ImproveExperience,
304+
MoreInfoCommit::ArchitecturalChanges,
305+
MoreInfoCommit::GitIgnore,
306+
MoreInfoCommit::Flag,
307+
MoreInfoCommit::Trash,
308+
MoreInfoCommit::Authorization,
309+
MoreInfoCommit::RemoveDeadCode,
310+
MoreInfoCommit::Business,
311+
MoreInfoCommit::Infra,
312+
MoreInfoCommit::Validation,
313+
],
314+
CommitType::CI => vec![MoreInfoCommit::CI],
315+
CommitType::Initial => vec![MoreInfoCommit::Initial],
316+
CommitType::Performance => {
317+
vec![
318+
MoreInfoCommit::Performance,
319+
MoreInfoCommit::DatabaseRelated,
320+
]
321+
}
322+
CommitType::Wip => vec![
323+
MoreInfoCommit::Wip,
324+
MoreInfoCommit::WrittingReallyBadCode,
325+
MoreInfoCommit::Experimentations,
326+
],
327+
CommitType::Docs => vec![MoreInfoCommit::Documentation],
328+
CommitType::Test => vec![
329+
MoreInfoCommit::TestsPassing,
330+
MoreInfoCommit::Add,
331+
MoreInfoCommit::Remove,
332+
MoreInfoCommit::Experimentations,
333+
MoreInfoCommit::HealthCheck,
334+
MoreInfoCommit::Validation,
335+
],
336+
CommitType::Bump => {
337+
vec![
338+
MoreInfoCommit::Add,
339+
MoreInfoCommit::Remove,
340+
MoreInfoCommit::Down,
341+
MoreInfoCommit::Up,
342+
MoreInfoCommit::Release,
343+
MoreInfoCommit::Package,
344+
]
345+
}
346+
CommitType::Style => {
347+
vec![
348+
MoreInfoCommit::CodeStyle,
349+
MoreInfoCommit::UI,
350+
MoreInfoCommit::ImproveExperience,
351+
]
352+
}
353+
CommitType::Build => vec![MoreInfoCommit::CI],
354+
CommitType::Debug => vec![
355+
MoreInfoCommit::TrackCode,
356+
MoreInfoCommit::AddLogs,
357+
MoreInfoCommit::HealthCheck,
358+
MoreInfoCommit::RemoveLogs,
359+
],
360+
CommitType::Revert => vec![MoreInfoCommit::Revert],
361+
}
362+
}
363+
}
364+
147365
pub struct ConventionalCommitPopup {
148366
key_config: SharedKeyConfig,
149367
is_visible: bool,

0 commit comments

Comments
 (0)