feat: init
This commit is contained in:
16
src/commands/greet.ts
Normal file
16
src/commands/greet.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { logger } from "../utils/logger.js";
|
||||
|
||||
interface GreetOptions {
|
||||
uppercase?: boolean;
|
||||
count?: string;
|
||||
}
|
||||
|
||||
export function greet(name: string, options: GreetOptions) {
|
||||
const message = `Hello, ${name}!`;
|
||||
const output = options.uppercase ? message.toUpperCase() : message;
|
||||
const count = Math.max(1, parseInt(options.count ?? "1", 10));
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
logger.success(output);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user