Skip to content

Commit 0725454

Browse files
committed
feat(main): colorize messages
1 parent bfde2eb commit 0725454

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

git-consistent

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,19 @@ const templateFileName = '.gitcommit_template'
1212
const definitionsFileName = '.git_consistent'
1313
const projectRoot = execSync(`git rev-parse --show-toplevel 2> /dev/null`).toString().trim()
1414

15-
const red = '\u001b[31m'
16-
const green = '\u001b[32m'
17-
const reset = '\u001b[0m'
15+
const black = '\u001b[30m'
16+
const red = '\u001b[31m'
17+
const green = '\u001b[32m'
18+
const yellow = '\u001b[33m'
19+
const blue = '\u001b[34m'
20+
const magenta = '\u001b[35m'
21+
const cyan = '\u001b[36m'
22+
const white = '\u001b[37m'
23+
const reset = '\u001b[0m'
24+
25+
const messageColor = cyan
26+
const warningColor = yellow
27+
const errorColor = red
1828

1929
const version = '0.2.0'
2030

@@ -58,11 +68,11 @@ const select = (term, definition) => {
5868
}
5969

6070
const inputString = (term, _definition) => {
61-
return prompt(`Enter ${term}: `)
71+
return prompt(`${messageColor}Enter ${term}: ${reset}`)
6272
}
6373

6474
const inputText = (term, _definition) => {
65-
console.log(`Enter ${term} multiline:`)
75+
console.log(`${messageColor}Enter ${term} multiline:${reset}`)
6676
let values = []
6777
let value = ""
6878

@@ -120,7 +130,7 @@ const replaceTerm = (program, template, definition, term) => {
120130
value = ''
121131
}
122132
while (definition.required && _.isEmpty(value)) {
123-
console.log(`${term} is required`)
133+
console.log(`${warningColor}${term} is required${reset}`)
124134
value = input(term, definition)
125135
}
126136
}
@@ -165,5 +175,5 @@ try {
165175

166176
main(createProgram(program, definitions, terms), template, definitions, terms)
167177
} catch (e) {
168-
console.error(`${red}${e.message}${reset}`)
178+
console.error(`${errorColor}${e.message}${reset}`)
169179
}

0 commit comments

Comments
 (0)