A tiny CLI in TypeScript
Placeholder tutorial post, to show code blocks.
Placeholder introduction for a tutorial post.
Setup
Run this command to create the project:
npm init -y && npm install tsx
The code
#!/usr/bin/env tsx
const [, , name = 'world'] = process.argv;
function greet(who: string): string {
return `Hello, ${who}!`;
}
console.log(greet(name));
Placeholder paragraph. Inline code looks like greet('you').
Next steps
- Add argument parsing.
- Add tests.
- Publish to npm.