marconneves / cowmand Goto Github PK
View Code? Open in Web Editor NEW_๐ฎ Cowmand - Fast helper to create a cli.
Home Page: https://npmjs.com/package/cowmand
License: MIT License
_๐ฎ Cowmand - Fast helper to create a cli.
Home Page: https://npmjs.com/package/cowmand
License: MIT License
Function to select a item of list in terminal, interactive and with option to digit a key.
Examples:
const color = await terminal.ask('Qual cor voce prefere?', [
{
title: 'โค๏ธ Vermelho',
value: 'red',
key?: 'r'
},
{
title: '๐งก Laranja',
value: 'orange',
key?: 'o'
},
{
title: '๐ Verde',
value: 'green',
key?: 'g'
}
]);
Options:
User can select with arrow keys
Validate a execution of handle, match of Middleware
Create a file or multiples files with content in array.
For create a unique file, exemple
await terminal.file({
path: 'modules/accounts/repositories/IAccountRepository.ts',
content: `
interface IAccountRepository {
delete(accountId: number): Promise<void>
}
`
})
or multiples files:
await terminal.files([
{
path: 'modules/accounts/useCases/deleteUser/DeleteUserUseCase.ts',
content: `import { injectable } from 'tsyringe';
@injectable()
class DeleteUserUseCase {
execute(accountId: number): Promise<vois> {
console.log('userDeleted')
}
}
export { DeleteUserUseCase };
`
},
{
path: 'modules/accounts/useCases/deleteUser/DeleteUserController.ts',
content: `import { Request, Response } from 'express';
import { container } from 'tsyringe';
import { DeleteUserUseCase } from './DeleteUserUseCase';
class DeleteUserController {
async handle(request: Request, response: Response): Promise<vois> {
const { accountId } = request.params;
const deleteUserUseCase = container.resolve(DeleteUserUseCase);
await deleteUserUseCase(Number(accountId));
return response.status(204);
}
}
`
}
])
Is good idea create a script with use prettier to format de file before or after create, to create good tabs info.
Exemple:
await terminal.files([], {
editorConfig: {
indent_style: space,
indentSize: 2,
endOfLine: 'lf'
},
prettier: {
singleQuote: true,
trailingComma: 'all',
arrowParens: 'avoid',
}
})
or setting path of files with configurations.
Now terminal.table is a instance of console.table, not can customize and base is a number key of data in array.
Implement a options to you define header table:
Implement a option to active fotter
Table options
Can create a file with multiples routes, and import on route base. And use in application.
Now is only basic roles, all is turn on. If a think need off, try before change de code. Only in last possibility turn off a rule.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.