FLUTTER ECOSYSTEM

maks/dolumns

テキスト出力をカラム形式にフォーマットするためのライブラリ。

列 のプロジェクト画像
Stars
14
Forks
0
最終プッシュ(UTC)
2023/05/05
プロジェクト状態
公開中
Maksim Lin GitHub avatar
GITHUB User

Maksim Lin ↗

Flutter GDE ex. Android Developer

ManichordAustralia
言語Dart

このリポジトリが公開するパッケージ

使用している依存関係

依存関係一覧 2 件
  • pedantic開発用^1.11.1
  • test開発用^1.24.2

元の README

以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。

README を開く / 閉じる

A library for formatting text output into columns.

Dart CI

Usage

A simple usage example:

import 'package:dolumns/dolumns.dart';

main() {
  final columns = dolumnify([
    ['provider', '4.0.2'],
    ['http', '0.12.0+4'],
    ['shared_preferences', '0.5.6+1'],
    ['sentry', '3.0.1'],
  ]);
  print(columns);
}

will output:

provider            4.0.2   
http                0.12.0+4
shared_preferences  0.5.6+1 
sentry              3.0.1   

You can also supply a custom column splitter, (...], columnSplitter: ' | '); will give:

provider           | 4.0.2   
http               | 0.12.0+4
shared_preferences | 0.5.6+1 
sentry             | 3.0.1 

Columns with headers are possible with a custom header separator, provide the header in the first list item:

import 'package:dolumns/dolumns.dart';

main() {
  final columns = dolumnify([
    ['PACKAGES', 'VERSION'],
    ['provider', '4.0.2'],
    ['http', '0.12.0+4'],
    ['shared_preferences', '0.5.6+1'],
    ['sentry', '3.0.1'],
  ], columnSplitter: ' | ', headerIncluded: true, headerSeparator: '=');
  print(columns);
}

will output:

PACKAGES           | VERSION 
=============================
provider           | 4.0.2   
http               | 0.12.0+4
shared_preferences | 0.5.6+1 
sentry             | 3.0.1   

see dolumns_example.dart example file for full details.

Note you can pass in objects of any type, dolumn will call toString() on every object passed in.

API inspired by the columinfy npm package.

Features and bugs

Please file feature requests and bugs at the issue tracker.