패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.0.2

cli_badges

터미널에 배지를 출력합니다. 네, README에서 사용하는 그런 편리한 작은 것들인데, CLI 앱용으로요.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
3.8만
좋아요
10
Pub 점수
130

패키지 설치

flutter pub add cli_badges

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

CLI 애플리케이션에서 터미널에 색다르고 스타일리시한 배지(버튼)를 직접 출력할 수 있게 해주는 Dart 패키지입니다. README 파일에 자주 보이는 배지와 유사합니다. 상태, 버전, 빌드 정보 등의 시각적 표시를 통해 명령줄 출력을 강화하는 데 이상적입니다. 여러 플랫폼을 지원하며, Flutter 및 Dart CLI 도구와 원활하게 통합됩니다. 최소한의 설정으로 개발자는 콘솔 로그에 전문적인 디자인의 배지를 추가할 수 있어, 터미널 기반 워크플로우의 가독성과 사용자 경험을 향상시킬 수 있습니다.

사용 사례

  • 시각적 상태 표시기로 CLI 출력 향상
  • 터미널에서 버전 및 빌드 정보 표시
  • 개발자 도구에서 로그 가독성 향상
  • 명령줄 앱에 브랜드 배지 추가하기
  • 인터랙티브 CLI 대시보드 만들기

주요 기능

  • 터미널 배지 렌더링
  • 크로스 플랫폼 지원
  • 배지 생성을 위한 간단한 API
  • 색상이 풍부하고 사용자 정의 가능한 배지
  • 경량이며 통합이 쉬움

적합한 대상

  • CLI 도구 개발자
  • DevOps 및 자동화 스크립트
  • Flutter CLI 확장
  • 개발자 경험(DX) 향상
  • 명령줄 애플리케이션 유지보수자

고려 사항

  • 터미널 출력만 제한
  • 비텍스트 환경에 대한 지원 없음
  • 터미널 색상 기능에 따라 다름
  • 모든 터미널 유형에서 일관되게 렌더링되지 않을 수 있습니다
  • 최신의 ANSI 호환 터미널에 가장 적합

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

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! ❤️

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.