mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 21:23:07 +00:00
refactor: clean up whitespace and improve prompt formatting in port management
- Removed unnecessary whitespace in the init.mjs file for better readability. - Enhanced the formatting of user prompts to improve clarity during port conflict resolution.
This commit is contained in:
19
init.mjs
19
init.mjs
@@ -389,7 +389,9 @@ async function main() {
|
|||||||
console.log('');
|
console.log('');
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
const choice = await prompt('What would you like to do? (k)ill processes, (u)se different ports, or (c)ancel: ');
|
const choice = await prompt(
|
||||||
|
'What would you like to do? (k)ill processes, (u)se different ports, or (c)ancel: '
|
||||||
|
);
|
||||||
const lowerChoice = choice.toLowerCase();
|
const lowerChoice = choice.toLowerCase();
|
||||||
|
|
||||||
if (lowerChoice === 'k' || lowerChoice === 'kill') {
|
if (lowerChoice === 'k' || lowerChoice === 'kill') {
|
||||||
@@ -417,7 +419,10 @@ async function main() {
|
|||||||
|
|
||||||
if (isPortInUse(parsedWebPort)) {
|
if (isPortInUse(parsedWebPort)) {
|
||||||
const pids = getProcessesOnPort(parsedWebPort);
|
const pids = getProcessesOnPort(parsedWebPort);
|
||||||
log(`Port ${parsedWebPort} is already in use by process(es): ${pids.join(', ')}`, 'red');
|
log(
|
||||||
|
`Port ${parsedWebPort} is already in use by process(es): ${pids.join(', ')}`,
|
||||||
|
'red'
|
||||||
|
);
|
||||||
const useAnyway = await prompt('Use this port anyway? (y/n): ');
|
const useAnyway = await prompt('Use this port anyway? (y/n): ');
|
||||||
if (useAnyway.toLowerCase() !== 'y' && useAnyway.toLowerCase() !== 'yes') {
|
if (useAnyway.toLowerCase() !== 'y' && useAnyway.toLowerCase() !== 'yes') {
|
||||||
continue;
|
continue;
|
||||||
@@ -444,7 +449,10 @@ async function main() {
|
|||||||
|
|
||||||
if (isPortInUse(parsedServerPort)) {
|
if (isPortInUse(parsedServerPort)) {
|
||||||
const pids = getProcessesOnPort(parsedServerPort);
|
const pids = getProcessesOnPort(parsedServerPort);
|
||||||
log(`Port ${parsedServerPort} is already in use by process(es): ${pids.join(', ')}`, 'red');
|
log(
|
||||||
|
`Port ${parsedServerPort} is already in use by process(es): ${pids.join(', ')}`,
|
||||||
|
'red'
|
||||||
|
);
|
||||||
const useAnyway = await prompt('Use this port anyway? (y/n): ');
|
const useAnyway = await prompt('Use this port anyway? (y/n): ');
|
||||||
if (useAnyway.toLowerCase() !== 'y' && useAnyway.toLowerCase() !== 'yes') {
|
if (useAnyway.toLowerCase() !== 'y' && useAnyway.toLowerCase() !== 'yes') {
|
||||||
continue;
|
continue;
|
||||||
@@ -461,7 +469,10 @@ async function main() {
|
|||||||
log('Cancelled.', 'yellow');
|
log('Cancelled.', 'yellow');
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
} else {
|
} else {
|
||||||
log('Invalid choice. Please enter k (kill), u (use different ports), or c (cancel).', 'red');
|
log(
|
||||||
|
'Invalid choice. Please enter k (kill), u (use different ports), or c (cancel).',
|
||||||
|
'red'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user