Code Monkey home page Code Monkey logo

cowmand's People

Contributors

marconneves avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

cowmand's Issues

Terminal: terminal.select

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:

  • title: User see this title
  • value: Response of function with await
  • key: User can digit this key in keyboard to select *optional

User can select with arrow keys

Terminal: terminal.file/files

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.

Terminal: terminal.table

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:

  • Can customize color of items in header
  • Can customize text, type define bold to header items

Implement a option to active fotter

  • Define option to footer with operations
    • Sum itens in array to column
    • Average of items in array, considering null items
    • Count items in array

Table options

  • Change lines in table
    • Option of table utf8 lines to box or table: utf8-table
  • Change color of lines in table

Why roles use in eslint?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.