forked from crowdbotics/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
30 lines (23 loc) · 691 Bytes
/
utils.js
File metadata and controls
30 lines (23 loc) · 691 Bytes
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
export const generateCommand = (str) => str.join(" ");
const VALID_MARK = "\u2705";
const INVALID_MARK = "\u274C";
const WARNING_MARK = "\u26A0";
export const valid = (...args) => {
console.log(VALID_MARK, ...args);
};
export const invalid = (...args) => {
console.error(INVALID_MARK, ...args);
process.exit(1);
};
export const warn = (...args) => {
console.log(WARNING_MARK, ...args);
};
export const section = (...args) => {
console.log("");
console.log(">", ...args);
};
export const isNameValid = (name) => {
const pattern = /^[a-zA-Z][a-zA-Z0-9_-]*$/;
return pattern.test(name);
};
export const isUserEnvironment = !process?.env?.CI && !process?.env?.CIRCLE_JOB;