term_glyph
有用的字形和 Windows 兼容的替代字符
- 星标
- 16
- 复刻
- 11
- 最近推送(UTC)
- 2024年12月17日
- 项目状态
- 已归档
原始 README
以下为英文项目原文快照,最新内容请访问 GitHub。
[!IMPORTANT]
This repo has moved to https://github.com/dart-lang/tools/tree/main/pkgs/term_glyph
This library contains getters for useful Unicode glyphs as well as plain ASCII alternatives. It's intended to be used in command-line applications that may run in places where Unicode isn't well-supported and libraries that may be used by those applications.
We recommend that you import this library with the prefix "glyph". For example:
import 'package:term_glyph/term_glyph.dart' as glyph;
/// Formats [items] into a bulleted list, with one item per line.
String bulletedList(List<String> items) =>
items.map((item) => "${glyph.bullet} $item").join("\n");
ASCII Mode
Some shells are unable to display Unicode characters, so this package is able to
transparently switch its glyphs to ASCII alternatives by setting the ascii
attribute. When this attribute is true, all glyphs use ASCII
characters instead. It currently defaults to false, although in the future it
may default to true for applications running on the Dart VM on Windows. For
example:
import 'dart:io';
import 'package:term_glyph/term_glyph.dart' as glyph;
void main() {
glyph.ascii = Platform.isWindows;
// Prints "Unicode => ASCII" on Windows, "Unicode ━▶ ASCII" everywhere else.
print("Unicode ${glyph.rightArrow} ASCII");
}
All ASCII glyphs are guaranteed to be the same number of characters as the corresponding Unicode glyphs, so that they line up properly when printed on a terminal. The specific ASCII text for a given Unicode glyph may change over time; this is not considered a breaking change.
使用的依赖
依赖清单 4 项
- csv开发依赖
^6.0.0 - dart_flutter_team_lints开发依赖
^3.0.0 - dart_style开发依赖
^2.0.0 - test开发依赖
^1.16.6
如何选择适合项目的代码仓?
先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
- 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
- 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
- 使用前在 GitHub 核对 README、许可证与 Issues。
来源与维护
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗