-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1660 from dart-lang/merge-term_glyph-package
Merge `package:term_glyph`
- Loading branch information
Showing
19 changed files
with
1,461 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
name: "package:term_glyph" | ||
about: "Create a bug or file a feature request against package:term_glyph." | ||
labels: "package:term_glyph" | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: package:term_glyph | ||
|
||
on: | ||
# Run on PRs and pushes to the default branch. | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- '.github/workflows/term_glyph.yaml' | ||
- 'pkgs/term_glyph/**' | ||
pull_request: | ||
branches: [ main ] | ||
paths: | ||
- '.github/workflows/term_glyph.yaml' | ||
- 'pkgs/term_glyph/**' | ||
schedule: | ||
- cron: "0 0 * * 0" | ||
|
||
env: | ||
PUB_ENVIRONMENT: bot.github | ||
|
||
|
||
defaults: | ||
run: | ||
working-directory: pkgs/term_glyph/ | ||
|
||
jobs: | ||
# Check code formatting and static analysis on a single OS (linux) | ||
# against Dart dev. | ||
analyze: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
sdk: [dev] | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | ||
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 | ||
with: | ||
sdk: ${{ matrix.sdk }} | ||
- id: install | ||
name: Install dependencies | ||
run: dart pub get | ||
- name: Check formatting | ||
run: dart format --output=none --set-exit-if-changed . | ||
if: always() && steps.install.outcome == 'success' | ||
- name: Analyze code | ||
run: dart analyze --fatal-infos | ||
if: always() && steps.install.outcome == 'success' | ||
|
||
# Run tests on a matrix consisting of two dimensions: | ||
# 1. OS: ubuntu-latest, (macos-latest, windows-latest) | ||
# 2. release channel: dev | ||
test: | ||
needs: analyze | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# Add macos-latest and/or windows-latest if relevant for this package. | ||
os: [ubuntu-latest] | ||
sdk: [3.1, dev] | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | ||
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 | ||
with: | ||
sdk: ${{ matrix.sdk }} | ||
- id: install | ||
name: Install dependencies | ||
run: dart pub get | ||
- name: Run VM tests | ||
run: dart test --platform vm | ||
if: always() && steps.install.outcome == 'success' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.dart_tool/ | ||
.pub/ | ||
.packages | ||
pubspec.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Below is a list of people and organizations that have contributed | ||
# to the project. Names should be added to the list like so: | ||
# | ||
# Name/Organization <email address> | ||
|
||
Google Inc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
## 1.2.2 | ||
|
||
* Require Dart 3.1 | ||
* Move to `dart-lang/tools` monorepo. | ||
|
||
## 1.2.1 | ||
|
||
* Migrate to `package:lints`. | ||
* Populate the pubspec `repository` field. | ||
|
||
## 1.2.0 | ||
|
||
* Stable release for null safety. | ||
* Update SDK constraints to `>=2.12.0-0 <3.0.0` based on beta release | ||
guidelines. | ||
|
||
## 1.1.0 | ||
|
||
* Add a `GlyphSet` class that can be used to easily choose which set of glyphs | ||
to use for a particular chunk of code. | ||
|
||
* Add `asciiGlyphs`, `unicodeGlyphs`, and `glyphs` getters that provide access | ||
to `GlyphSet`s. | ||
|
||
## 1.0.1 | ||
|
||
* Set max SDK version to `<3.0.0`. | ||
|
||
## 1.0.0 | ||
|
||
* Initial version. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Copyright 2017, the Dart project authors. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are | ||
met: | ||
|
||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above | ||
copyright notice, this list of conditions and the following | ||
disclaimer in the documentation and/or other materials provided | ||
with the distribution. | ||
* Neither the name of Google LLC nor the names of its | ||
contributors may be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
[![Build Status](https://github.com/dart-lang/tools/actions/workflows/term_glyph.yaml/badge.svg)](https://github.com/dart-lang/tools/actions/workflows/term_glyph.yaml) | ||
[![pub package](https://img.shields.io/pub/v/term_glyph.svg)](https://pub.dev/packages/term_glyph) | ||
[![package publisher](https://img.shields.io/pub/publisher/term_glyph.svg)](https://pub.dev/packages/term_glyph/publisher) | ||
|
||
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: | ||
|
||
```dart | ||
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][ascii]. 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: | ||
|
||
[ascii]: https://pub.dev/documentation/term_glyph/latest/term_glyph/ascii.html | ||
|
||
```dart | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# https://dart.dev/guides/language/analysis-options | ||
include: package:dart_flutter_team_lints/analysis_options.yaml | ||
|
||
analyzer: | ||
language: | ||
strict-casts: true | ||
strict-inference: true | ||
strict-raw-types: true | ||
|
||
linter: | ||
rules: | ||
- avoid_bool_literals_in_conditional_expressions | ||
- avoid_classes_with_only_static_members | ||
- avoid_private_typedef_functions | ||
- avoid_redundant_argument_values | ||
- avoid_returning_this | ||
- avoid_unused_constructor_parameters | ||
- avoid_void_async | ||
- cancel_subscriptions | ||
- join_return_with_assignment | ||
- literal_only_boolean_expressions | ||
- missing_whitespace_between_adjacent_strings | ||
- no_adjacent_strings_in_list | ||
- no_runtimeType_toString | ||
- prefer_const_declarations | ||
- prefer_expression_function_bodies | ||
- prefer_final_locals | ||
- unnecessary_await_in_return | ||
- unnecessary_breaks | ||
- use_if_null_to_convert_nulls_to_bools | ||
- use_raw_strings | ||
- use_string_buffers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Miscellaneous | ||
bullet,•,*,A bullet point. | ||
|
||
# Arrows | ||
leftArrow,←,<,"A left-pointing arrow. | ||
|
||
Note that the Unicode arrow glyphs may overlap with adjacent characters in some | ||
terminal fonts, and should generally be surrounding by spaces." | ||
rightArrow,→,>,"A right-pointing arrow. | ||
|
||
Note that the Unicode arrow glyphs may overlap with adjacent characters in some | ||
terminal fonts, and should generally be surrounding by spaces." | ||
upArrow,↑,^,An upwards-pointing arrow. | ||
downArrow,↓,v,A downwards-pointing arrow. | ||
longLeftArrow,◀━,<=,A two-character left-pointing arrow. | ||
longRightArrow,━▶,=>,A two-character right-pointing arrow. | ||
|
||
# Box drawing characters | ||
|
||
## Normal | ||
horizontalLine,─,-,A horizontal line that can be used to draw a box. | ||
verticalLine,│,|,A vertical line that can be used to draw a box. | ||
topLeftCorner,┌,",",The upper left-hand corner of a box. | ||
topRightCorner,┐,",",The upper right-hand corner of a box. | ||
bottomLeftCorner,└,',The lower left-hand corner of a box. | ||
bottomRightCorner,┘,',The lower right-hand corner of a box. | ||
cross,┼,+,An intersection of vertical and horizontal box lines. | ||
teeUp,┴,+,A horizontal box line with a vertical line going up from the middle. | ||
teeDown,┬,+,A horizontal box line with a vertical line going down from the middle. | ||
teeLeft,┤,+,A vertical box line with a horizontal line going left from the middle. | ||
teeRight,├,+,A vertical box line with a horizontal line going right from the middle. | ||
upEnd,╵,',The top half of a vertical box line. | ||
downEnd,╷,",",The bottom half of a vertical box line. | ||
leftEnd,╴,-,The left half of a horizontal box line. | ||
rightEnd,╶,-,The right half of a horizontal box line. | ||
|
||
## Bold | ||
horizontalLineBold,━,=,A bold horizontal line that can be used to draw a box. | ||
verticalLineBold,┃,|,A bold vertical line that can be used to draw a box. | ||
topLeftCornerBold,┏,",",The bold upper left-hand corner of a box. | ||
topRightCornerBold,┓,",",The bold upper right-hand corner of a box. | ||
bottomLeftCornerBold,┗,',The bold lower left-hand corner of a box. | ||
bottomRightCornerBold,┛,',The bold lower right-hand corner of a box. | ||
crossBold,╋,+,An intersection of bold vertical and horizontal box lines. | ||
teeUpBold,┻,+,A bold horizontal box line with a vertical line going up from the middle. | ||
teeDownBold,┳,+,A bold horizontal box line with a vertical line going down from the middle. | ||
teeLeftBold,┫,+,A bold vertical box line with a horizontal line going left from the middle. | ||
teeRightBold,┣,+,A bold vertical box line with a horizontal line going right from the middle. | ||
upEndBold,╹,',The top half of a bold vertical box line. | ||
downEndBold,╻,",",The bottom half of a bold vertical box line. | ||
leftEndBold,╸,-,The left half of a bold horizontal box line. | ||
rightEndBold,╺,-,The right half of a bold horizontal box line. | ||
|
||
## Double | ||
horizontalLineDouble,═,=,A double horizontal line that can be used to draw a box. | ||
verticalLineDouble,║,|,A double vertical line that can be used to draw a box. | ||
topLeftCornerDouble,╔,",",The double upper left-hand corner of a box. | ||
topRightCornerDouble,╗,",",The double upper right-hand corner of a box. | ||
bottomLeftCornerDouble,╚,"""",The double lower left-hand corner of a box. | ||
bottomRightCornerDouble,╝,"""",The double lower right-hand corner of a box. | ||
crossDouble,╬,+,An intersection of double vertical and horizontal box lines. | ||
teeUpDouble,╩,+,A double horizontal box line with a vertical line going up from the middle. | ||
teeDownDouble,╦,+,A double horizontal box line with a vertical line going down from the middle. | ||
teeLeftDouble,╣,+,A double vertical box line with a horizontal line going left from the middle. | ||
teeRightDouble,╠,+,A double vertical box line with a horizontal line going right from the middle. | ||
|
||
## Dashed | ||
|
||
### Double | ||
horizontalLineDoubleDash,╌,-,A dashed horizontal line that can be used to draw a box. | ||
horizontalLineDoubleDashBold,╍,-,A bold dashed horizontal line that can be used to draw a box. | ||
verticalLineDoubleDash,╎,|,A dashed vertical line that can be used to draw a box. | ||
verticalLineDoubleDashBold,╏,|,A bold dashed vertical line that can be used to draw a box. | ||
|
||
### Triple | ||
horizontalLineTripleDash,┄,-,A dashed horizontal line that can be used to draw a box. | ||
horizontalLineTripleDashBold,┅,-,A bold dashed horizontal line that can be used to draw a box. | ||
verticalLineTripleDash,┆,|,A dashed vertical line that can be used to draw a box. | ||
verticalLineTripleDashBold,┇,|,A bold dashed vertical line that can be used to draw a box. | ||
|
||
### Quadruple | ||
horizontalLineQuadrupleDash,┈,-,A dashed horizontal line that can be used to draw a box. | ||
horizontalLineQuadrupleDashBold,┉,-,A bold dashed horizontal line that can be used to draw a box. | ||
verticalLineQuadrupleDash,┊,|,A dashed vertical line that can be used to draw a box. | ||
verticalLineQuadrupleDashBold,┋,|,A bold dashed vertical line that can be used to draw a box. |
Oops, something went wrong.