Skip to content

Commit f036faa

Browse files
committed
Merge package:term_glyph into the tools monorepo
2 parents 5590447 + da99c5c commit f036faa

18 files changed

+1487
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Dependabot configuration file.
2+
# See https://docs.github.com/en/code-security/dependabot/dependabot-version-updates
3+
version: 2
4+
5+
updates:
6+
- package-ecosystem: github-actions
7+
directory: /
8+
schedule:
9+
interval: monthly
10+
labels:
11+
- autosubmit
12+
groups:
13+
github-actions:
14+
patterns:
15+
- "*"
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Dart CI
2+
3+
on:
4+
# Run on PRs and pushes to the default branch.
5+
push:
6+
branches: [ master ]
7+
pull_request:
8+
branches: [ master ]
9+
schedule:
10+
- cron: "0 0 * * 0"
11+
12+
env:
13+
PUB_ENVIRONMENT: bot.github
14+
15+
jobs:
16+
# Check code formatting and static analysis on a single OS (linux)
17+
# against Dart dev.
18+
analyze:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
sdk: [dev]
24+
steps:
25+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
26+
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
27+
with:
28+
sdk: ${{ matrix.sdk }}
29+
- id: install
30+
name: Install dependencies
31+
run: dart pub get
32+
- name: Check formatting
33+
run: dart format --output=none --set-exit-if-changed .
34+
if: always() && steps.install.outcome == 'success'
35+
- name: Analyze code
36+
run: dart analyze --fatal-infos
37+
if: always() && steps.install.outcome == 'success'
38+
39+
# Run tests on a matrix consisting of two dimensions:
40+
# 1. OS: ubuntu-latest, (macos-latest, windows-latest)
41+
# 2. release channel: dev
42+
test:
43+
needs: analyze
44+
runs-on: ${{ matrix.os }}
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
# Add macos-latest and/or windows-latest if relevant for this package.
49+
os: [ubuntu-latest]
50+
sdk: [3.1, dev]
51+
steps:
52+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
53+
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
54+
with:
55+
sdk: ${{ matrix.sdk }}
56+
- id: install
57+
name: Install dependencies
58+
run: dart pub get
59+
- name: Run VM tests
60+
run: dart test --platform vm
61+
if: always() && steps.install.outcome == 'success'

pkgs/term_glyph/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.dart_tool/
2+
.pub/
3+
.packages
4+
pubspec.lock

pkgs/term_glyph/AUTHORS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Below is a list of people and organizations that have contributed
2+
# to the project. Names should be added to the list like so:
3+
#
4+
# Name/Organization <email address>
5+
6+
Google Inc.

pkgs/term_glyph/CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
## 1.2.2-wip
2+
3+
* Require Dart 3.1
4+
5+
## 1.2.1
6+
7+
* Migrate to `package:lints`.
8+
* Populate the pubspec `repository` field.
9+
10+
## 1.2.0
11+
12+
* Stable release for null safety.
13+
* Update SDK constraints to `>=2.12.0-0 <3.0.0` based on beta release
14+
guidelines.
15+
16+
## 1.1.0
17+
18+
* Add a `GlyphSet` class that can be used to easily choose which set of glyphs
19+
to use for a particular chunk of code.
20+
21+
* Add `asciiGlyphs`, `unicodeGlyphs`, and `glyphs` getters that provide access
22+
to `GlyphSet`s.
23+
24+
## 1.0.1
25+
26+
* Set max SDK version to `<3.0.0`.
27+
28+
## 1.0.0
29+
30+
* Initial version.

pkgs/term_glyph/CONTRIBUTING.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Want to contribute? Great! First, read this page (including the small print at
2+
the end).
3+
4+
### Before you contribute
5+
Before we can use your code, you must sign the
6+
[Google Individual Contributor License Agreement](https://cla.developers.google.com/about/google-individual)
7+
(CLA), which you can do online. The CLA is necessary mainly because you own the
8+
copyright to your changes, even after your contribution becomes part of our
9+
codebase, so we need your permission to use and distribute your code. We also
10+
need to be sure of various other things—for instance that you'll tell us if you
11+
know that your code infringes on other people's patents. You don't have to sign
12+
the CLA until after you've submitted your code for review and a member has
13+
approved it, but you must do it before we can put your code into our codebase.
14+
15+
Before you start working on a larger contribution, you should get in touch with
16+
us first through the issue tracker with your idea so that we can help out and
17+
possibly guide you. Coordinating up front makes it much easier to avoid
18+
frustration later on.
19+
20+
### Code reviews
21+
All submissions, including submissions by project members, require review.
22+
23+
### File headers
24+
All files in the project must start with the following header.
25+
26+
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
27+
// for details. All rights reserved. Use of this source code is governed by a
28+
// BSD-style license that can be found in the LICENSE file.
29+
30+
### The small print
31+
Contributions made by corporations are covered by a different agreement than the
32+
one above, the
33+
[Software Grant and Corporate Contributor License Agreement](https://developers.google.com/open-source/cla/corporate).

pkgs/term_glyph/LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright 2017, the Dart project authors.
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are
5+
met:
6+
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above
10+
copyright notice, this list of conditions and the following
11+
disclaimer in the documentation and/or other materials provided
12+
with the distribution.
13+
* Neither the name of Google LLC nor the names of its
14+
contributors may be used to endorse or promote products derived
15+
from this software without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

pkgs/term_glyph/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[![Dart CI](https://github.com/dart-lang/term_glyph/actions/workflows/test-package.yml/badge.svg)](https://github.com/dart-lang/term_glyph/actions/workflows/test-package.yml)
2+
[![pub package](https://img.shields.io/pub/v/term_glyph.svg)](https://pub.dev/packages/term_glyph)
3+
[![package publisher](https://img.shields.io/pub/publisher/term_glyph.svg)](https://pub.dev/packages/term_glyph/publisher)
4+
5+
This library contains getters for useful Unicode glyphs as well as plain ASCII
6+
alternatives. It's intended to be used in command-line applications that may run
7+
in places where Unicode isn't well-supported and libraries that may be used by
8+
those applications.
9+
10+
We recommend that you import this library with the prefix "glyph". For example:
11+
12+
```dart
13+
import 'package:term_glyph/term_glyph.dart' as glyph;
14+
15+
/// Formats [items] into a bulleted list, with one item per line.
16+
String bulletedList(List<String> items) =>
17+
items.map((item) => "${glyph.bullet} $item").join("\n");
18+
```
19+
20+
## ASCII Mode
21+
22+
Some shells are unable to display Unicode characters, so this package is able to
23+
transparently switch its glyphs to ASCII alternatives by setting [the `ascii`
24+
attribute][ascii]. When this attribute is `true`, all glyphs use ASCII
25+
characters instead. It currently defaults to `false`, although in the future it
26+
may default to `true` for applications running on the Dart VM on Windows. For
27+
example:
28+
29+
[ascii]: https://pub.dev/documentation/term_glyph/latest/term_glyph/ascii.html
30+
31+
```dart
32+
import 'dart:io';
33+
34+
import 'package:term_glyph/term_glyph.dart' as glyph;
35+
36+
void main() {
37+
glyph.ascii = Platform.isWindows;
38+
39+
// Prints "Unicode => ASCII" on Windows, "Unicode ━▶ ASCII" everywhere else.
40+
print("Unicode ${glyph.rightArrow} ASCII");
41+
}
42+
```
43+
44+
All ASCII glyphs are guaranteed to be the same number of characters as the
45+
corresponding Unicode glyphs, so that they line up properly when printed on a
46+
terminal. The specific ASCII text for a given Unicode glyph may change over
47+
time; this is not considered a breaking change.

pkgs/term_glyph/analysis_options.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# https://dart.dev/guides/language/analysis-options
2+
include: package:dart_flutter_team_lints/analysis_options.yaml
3+
4+
analyzer:
5+
language:
6+
strict-casts: true
7+
strict-inference: true
8+
strict-raw-types: true
9+
10+
linter:
11+
rules:
12+
- avoid_bool_literals_in_conditional_expressions
13+
- avoid_classes_with_only_static_members
14+
- avoid_private_typedef_functions
15+
- avoid_redundant_argument_values
16+
- avoid_returning_this
17+
- avoid_unused_constructor_parameters
18+
- avoid_void_async
19+
- cancel_subscriptions
20+
- join_return_with_assignment
21+
- literal_only_boolean_expressions
22+
- missing_whitespace_between_adjacent_strings
23+
- no_adjacent_strings_in_list
24+
- no_runtimeType_toString
25+
- prefer_const_declarations
26+
- prefer_expression_function_bodies
27+
- prefer_final_locals
28+
- unnecessary_await_in_return
29+
- unnecessary_breaks
30+
- use_if_null_to_convert_nulls_to_bools
31+
- use_raw_strings
32+
- use_string_buffers

pkgs/term_glyph/data.csv

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Miscellaneous
2+
bullet,•,*,A bullet point.
3+
4+
# Arrows
5+
leftArrow,←,<,"A left-pointing arrow.
6+
7+
Note that the Unicode arrow glyphs may overlap with adjacent characters in some
8+
terminal fonts, and should generally be surrounding by spaces."
9+
rightArrow,→,>,"A right-pointing arrow.
10+
11+
Note that the Unicode arrow glyphs may overlap with adjacent characters in some
12+
terminal fonts, and should generally be surrounding by spaces."
13+
upArrow,↑,^,An upwards-pointing arrow.
14+
downArrow,↓,v,A downwards-pointing arrow.
15+
longLeftArrow,◀━,<=,A two-character left-pointing arrow.
16+
longRightArrow,━▶,=>,A two-character right-pointing arrow.
17+
18+
# Box drawing characters
19+
20+
## Normal
21+
horizontalLine,─,-,A horizontal line that can be used to draw a box.
22+
verticalLine,│,|,A vertical line that can be used to draw a box.
23+
topLeftCorner,┌,",",The upper left-hand corner of a box.
24+
topRightCorner,┐,",",The upper right-hand corner of a box.
25+
bottomLeftCorner,└,',The lower left-hand corner of a box.
26+
bottomRightCorner,┘,',The lower right-hand corner of a box.
27+
cross,┼,+,An intersection of vertical and horizontal box lines.
28+
teeUp,┴,+,A horizontal box line with a vertical line going up from the middle.
29+
teeDown,┬,+,A horizontal box line with a vertical line going down from the middle.
30+
teeLeft,┤,+,A vertical box line with a horizontal line going left from the middle.
31+
teeRight,├,+,A vertical box line with a horizontal line going right from the middle.
32+
upEnd,╵,',The top half of a vertical box line.
33+
downEnd,╷,",",The bottom half of a vertical box line.
34+
leftEnd,╴,-,The left half of a horizontal box line.
35+
rightEnd,╶,-,The right half of a horizontal box line.
36+
37+
## Bold
38+
horizontalLineBold,━,=,A bold horizontal line that can be used to draw a box.
39+
verticalLineBold,┃,|,A bold vertical line that can be used to draw a box.
40+
topLeftCornerBold,┏,",",The bold upper left-hand corner of a box.
41+
topRightCornerBold,┓,",",The bold upper right-hand corner of a box.
42+
bottomLeftCornerBold,┗,',The bold lower left-hand corner of a box.
43+
bottomRightCornerBold,┛,',The bold lower right-hand corner of a box.
44+
crossBold,╋,+,An intersection of bold vertical and horizontal box lines.
45+
teeUpBold,┻,+,A bold horizontal box line with a vertical line going up from the middle.
46+
teeDownBold,┳,+,A bold horizontal box line with a vertical line going down from the middle.
47+
teeLeftBold,┫,+,A bold vertical box line with a horizontal line going left from the middle.
48+
teeRightBold,┣,+,A bold vertical box line with a horizontal line going right from the middle.
49+
upEndBold,╹,',The top half of a bold vertical box line.
50+
downEndBold,╻,",",The bottom half of a bold vertical box line.
51+
leftEndBold,╸,-,The left half of a bold horizontal box line.
52+
rightEndBold,╺,-,The right half of a bold horizontal box line.
53+
54+
## Double
55+
horizontalLineDouble,═,=,A double horizontal line that can be used to draw a box.
56+
verticalLineDouble,║,|,A double vertical line that can be used to draw a box.
57+
topLeftCornerDouble,╔,",",The double upper left-hand corner of a box.
58+
topRightCornerDouble,╗,",",The double upper right-hand corner of a box.
59+
bottomLeftCornerDouble,╚,"""",The double lower left-hand corner of a box.
60+
bottomRightCornerDouble,╝,"""",The double lower right-hand corner of a box.
61+
crossDouble,╬,+,An intersection of double vertical and horizontal box lines.
62+
teeUpDouble,╩,+,A double horizontal box line with a vertical line going up from the middle.
63+
teeDownDouble,╦,+,A double horizontal box line with a vertical line going down from the middle.
64+
teeLeftDouble,╣,+,A double vertical box line with a horizontal line going left from the middle.
65+
teeRightDouble,╠,+,A double vertical box line with a horizontal line going right from the middle.
66+
67+
## Dashed
68+
69+
### Double
70+
horizontalLineDoubleDash,╌,-,A dashed horizontal line that can be used to draw a box.
71+
horizontalLineDoubleDashBold,╍,-,A bold dashed horizontal line that can be used to draw a box.
72+
verticalLineDoubleDash,╎,|,A dashed vertical line that can be used to draw a box.
73+
verticalLineDoubleDashBold,╏,|,A bold dashed vertical line that can be used to draw a box.
74+
75+
### Triple
76+
horizontalLineTripleDash,┄,-,A dashed horizontal line that can be used to draw a box.
77+
horizontalLineTripleDashBold,┅,-,A bold dashed horizontal line that can be used to draw a box.
78+
verticalLineTripleDash,┆,|,A dashed vertical line that can be used to draw a box.
79+
verticalLineTripleDashBold,┇,|,A bold dashed vertical line that can be used to draw a box.
80+
81+
### Quadruple
82+
horizontalLineQuadrupleDash,┈,-,A dashed horizontal line that can be used to draw a box.
83+
horizontalLineQuadrupleDashBold,┉,-,A bold dashed horizontal line that can be used to draw a box.
84+
verticalLineQuadrupleDash,┊,|,A dashed vertical line that can be used to draw a box.
85+
verticalLineQuadrupleDashBold,┋,|,A bold dashed vertical line that can be used to draw a box.

0 commit comments

Comments
 (0)