Buscar pacotes, repositórios e categorias de apps

Detalhes do pacotev0.0.2

cli_badges

Imprima badges no terminal. Sim, aqueles pequenos itens úteis que usamos em READMEs, mas para aplicativos de linha de comando.

AndroidiOSWebmacOSWindowsLinux
Downloads em 30 dias
38,1 mil
Curtidas
10
Pontos Pub
130

Instalar pacote

flutter pub add cli_badges

Visão geral do pacote

Orientação gerada a partir de informações públicas. Apenas para referência.

Um pacote Dart que permite aplicativos de linha de comando imprimir badges coloridos e estilizados diretamente no terminal — semelhantes aos vistos em arquivos README. É ideal para melhorar a saída da linha de comando com indicadores visuais como status, versão ou informações de compilação. O pacote é compatível com múltiplas plataformas e se integra perfeitamente a ferramentas CLI do Flutter e Dart. Com configuração mínima, desenvolvedores podem adicionar badges com aparência profissional aos logs do console, melhorando a legibilidade e a experiência do usuário em fluxos de trabalho baseados em terminal.

Casos de uso

  • Melhorando a saída do CLI com indicadores visuais de status
  • Exibindo informações de versão e compilação em terminais
  • Melhorando a legibilidade do log nas ferramentas de desenvolvedor
  • Adicionando badges com marca a aplicativos de linha de comando
  • Criando painéis CLI interativos

Principais recursos

  • Renderização de insígnia terminal
  • Suporte multiplataforma
  • API simples para criação de insígnias
  • Crachás coloridos e personalizáveis
  • Leve e fácil de integrar

Indicado para

  • Desenvolvedores de ferramentas CLI
  • DevOps e scripts de automação
  • Extensões do CLI do Flutter
  • Melhorias na experiência do desenvolvedor (DX)
  • mantenedores de aplicativos de linha de comando

Considerações

  • Limitado à saída do terminal apenas
  • Sem suporte para ambientes não-textuais
  • Depende das capacidades de cor do terminal
  • Pode não ser renderizado de forma consistente em todos os tipos de terminal
  • Mais adequado para terminais modernos com suporte a ANSI

README original

Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.

Quirky little dart library for generating badges for your cli apps.

Pub Version


Print badges to the terminal. Yup, those nifty little thingies we use on readmes, but for CLI apps.

Features

  • Easy to use
  • Inbuilt themes
  • Customizable

This is what it can do:

var failedBadge  = Badge(label: 'failed', message: '2', theme: BadgeTheme.red);
var successBadge = Badge(label: 'success', message: '2').green();
var skippedBadge = Badge.yellow(label: 'skipped',  message: '2');

print(
    Badge.inline([
        failedBadge, 
        skippedBadge, 
        successBadge
    ]),
);

The above would output something similar to the terminal:

Usage

Usage is simple, import the package and start creating Badges!

import 'package:cli_badges/cli_badges.dart';

var failedBadge = Badge(label: 'failed', message: '2', theme: BadgeTheme.red);

print(failedBadge);
Some more examples:

You could create a donate badge:

var donateBadge = Badge.cyan(label: '❤️ donate', message: 'please?');

print(donateBadge);

You can also only show the label:

var onlyLabel = Badge(
    label: '❤️ donate', 
    labelColorCode: 169
);

print(onlyLabel);
Example output is a mock, console output will vary slightly from terminal to terminal.

Badge Structure

A badge is conformed of a label and a message <label>:<message>. Each segment can be customized, by changing bg color, text color and style.

Themes

Themes are a way to store badge configuration for repeated use.

blue theme-blue cyan theme-cyan
green theme-green magenta theme-magenta
red theme-red yellow theme-yellow

You can also swap all themes, this means properties from label will be applied to message and vice versa.

Inbuilt themes
  • red : Red Message Background
  • green : Green Message Background
  • blue : Blue Message Background
  • yellow : Black Colored Message on yellow Background
  • cyan : Black Colored Message on cyan Background
  • magenta : Black Colored Message on magenta Background
  • success : ('Success') Message on green Background
  • failed : ('Failed') Message on red Background
  • warning : ('Failed') Message on yellow Background
  • info : ('Info') Message on blue Background
Colors

This is the list of all available colors:

  • red
  • black
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • brightRed
  • brightBlack
  • brightGreen
  • brightYellow
  • brightBlue
  • brightMagenta
  • brightCyan
  • brightWhite
Using themes

There are 3 main ways to create a themed badge:

1 - Passing in the theme directly to the Badge constructor:
Badge(
    label: 'failed', 
    message: '2', 
    theme: BadgeTheme.red,
);
2 - Using named constructors:
Badge.red(
    label: 'failed', 
    message: '2', 
);
3 - Or by calling the predefined theme methods:
Badge(...).red();

Additional info

There is a complete example here

If you encounter any problems or fancy a feature to be added please head over to the GitHub repository and drop an issue.

Want badges for some other environment or language?

cli-badges is also available in other languages:

Support the project

I tend to open source anything I can, and love to help people that might need help with the project.

However, if you are using this project and are happy with it or just want to encourage me to continue creating stuff, there are few ways you can do so:

  • Starring and sharing the project 🚀
  • Reporting bugs 🐛
  • Sending feedback
  • Or even coding :P

Thanks! ❤️

Categorias

Repositório-fonte

Projetos que usam este pacote

Ainda não há dados.