Skip to content

Commit

Permalink
[term_glyph] Drop dart_style dep (#1956)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo authored Jan 2, 2025
1 parent f65dde0 commit b412ba4
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 50 deletions.
2 changes: 2 additions & 0 deletions pkgs/term_glyph/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 1.2.3-wip

## 1.2.2

* Require Dart 3.1
Expand Down
2 changes: 2 additions & 0 deletions pkgs/term_glyph/lib/src/generated/ascii_glyph_set.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

// Don't modify this file by hand! It's generated by tool/generate.dart.

// ignore_for_file: lines_longer_than_80_chars

import 'glyph_set.dart';

/// A [GlyphSet] that includes only ASCII glyphs.
Expand Down
31 changes: 13 additions & 18 deletions pkgs/term_glyph/lib/src/generated/glyph_set.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

// Don't modify this file by hand! It's generated by tool/generate.dart.

// ignore_for_file: lines_longer_than_80_chars

/// A class that provides access to every configurable glyph.
///
/// This is provided as a class so that individual chunks of code can choose
Expand Down Expand Up @@ -37,14 +39,14 @@ abstract class GlyphSet {

/// 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.
/// Note that the Unicode arrow glyphs may overlap with adjacent characters in some
/// terminal fonts, and should generally be surrounding by spaces.
String get leftArrow;

/// 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.
/// Note that the Unicode arrow glyphs may overlap with adjacent characters in some
/// terminal fonts, and should generally be surrounding by spaces.
String get rightArrow;

/// An upwards-pointing arrow.
Expand Down Expand Up @@ -128,16 +130,13 @@ abstract class GlyphSet {
/// A bold horizontal box line with a vertical line going up from the middle.
String get teeUpBold;

/// A bold horizontal box line with a vertical line going down from the
/// middle.
/// A bold horizontal box line with a vertical line going down from the middle.
String get teeDownBold;

/// A bold vertical box line with a horizontal line going left from the
/// middle.
/// A bold vertical box line with a horizontal line going left from the middle.
String get teeLeftBold;

/// A bold vertical box line with a horizontal line going right from the
/// middle.
/// A bold vertical box line with a horizontal line going right from the middle.
String get teeRightBold;

/// The top half of a bold vertical box line.
Expand Down Expand Up @@ -173,20 +172,16 @@ abstract class GlyphSet {
/// An intersection of double vertical and horizontal box lines.
String get crossDouble;

/// A double horizontal box line with a vertical line going up from the
/// middle.
/// A double horizontal box line with a vertical line going up from the middle.
String get teeUpDouble;

/// A double horizontal box line with a vertical line going down from the
/// middle.
/// A double horizontal box line with a vertical line going down from the middle.
String get teeDownDouble;

/// A double vertical box line with a horizontal line going left from the
/// middle.
/// A double vertical box line with a horizontal line going left from the middle.
String get teeLeftDouble;

/// A double vertical box line with a horizontal line going right from the
/// middle.
/// A double vertical box line with a horizontal line going right from the middle.
String get teeRightDouble;

/// A dashed horizontal line that can be used to draw a box.
Expand Down
19 changes: 9 additions & 10 deletions pkgs/term_glyph/lib/src/generated/top_level.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

// Don't modify this file by hand! It's generated by tool/generate.dart.

// ignore_for_file: lines_longer_than_80_chars

import '../../term_glyph.dart' as glyph;

/// A bullet point.
Expand All @@ -14,17 +16,17 @@ String get bullet => glyph.glyphs.bullet;

/// 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.
/// Note that the Unicode arrow glyphs may overlap with adjacent characters in some
/// terminal fonts, and should generally be surrounding by spaces.
///
/// If [glyph.ascii] is `false`, this is "←". If it's `true`, this is
/// "<" instead.
String get leftArrow => glyph.glyphs.leftArrow;

/// 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.
/// Note that the Unicode arrow glyphs may overlap with adjacent characters in some
/// terminal fonts, and should generally be surrounding by spaces.
///
/// If [glyph.ascii] is `false`, this is "→". If it's `true`, this is
/// ">" instead.
Expand Down Expand Up @@ -282,22 +284,19 @@ String get crossDouble => glyph.glyphs.crossDouble;
/// "+" instead.
String get teeUpDouble => glyph.glyphs.teeUpDouble;

/// A double horizontal box line with a vertical line going down from the
/// middle.
/// A double horizontal box line with a vertical line going down from the middle.
///
/// If [glyph.ascii] is `false`, this is "╦". If it's `true`, this is
/// "+" instead.
String get teeDownDouble => glyph.glyphs.teeDownDouble;

/// A double vertical box line with a horizontal line going left from the
/// middle.
/// A double vertical box line with a horizontal line going left from the middle.
///
/// If [glyph.ascii] is `false`, this is "╣". If it's `true`, this is
/// "+" instead.
String get teeLeftDouble => glyph.glyphs.teeLeftDouble;

/// A double vertical box line with a horizontal line going right from the
/// middle.
/// A double vertical box line with a horizontal line going right from the middle.
///
/// If [glyph.ascii] is `false`, this is "╠". If it's `true`, this is
/// "+" instead.
Expand Down
2 changes: 2 additions & 0 deletions pkgs/term_glyph/lib/src/generated/unicode_glyph_set.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

// Don't modify this file by hand! It's generated by tool/generate.dart.

// ignore_for_file: lines_longer_than_80_chars

import 'glyph_set.dart';

/// A [GlyphSet] that includes only Unicode glyphs.
Expand Down
3 changes: 1 addition & 2 deletions pkgs/term_glyph/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: term_glyph
version: 1.2.2
version: 1.2.3-wip
description: Useful Unicode glyphs and ASCII substitutes.
repository: https://github.com/dart-lang/tools/tree/main/pkgs/term_glyph

Expand All @@ -9,5 +9,4 @@ environment:
dev_dependencies:
csv: ^6.0.0
dart_flutter_team_lints: ^3.0.0
dart_style: ^2.0.0
test: ^1.16.6
43 changes: 23 additions & 20 deletions pkgs/term_glyph/tool/generate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,29 @@ void main() {
// Remove comments and empty lines.
data.removeWhere((row) => row.length < 3);

Directory('lib/src/generated').createSync(recursive: true);
Directory(_generatedDir).createSync(recursive: true);

_writeGlyphSetInterface(data);
_writeGlyphSet(data, ascii: false);
_writeGlyphSet(data, ascii: true);
_writeTopLevel(data);

final result = Process.runSync(
'pub', ['run', 'dart_style:format', '-w', 'lib/src/generated']);
final result = Process.runSync(Platform.resolvedExecutable, [
'format',
_generatedDir,
]);
print(result.stderr);
exit(result.exitCode);
}

const _generatedDir = 'lib/src/generated';

/// Writes `lib/src/generated/glyph_set.dart`.
void _writeGlyphSetInterface(List<List<dynamic>> data) {
final file =
File('lib/src/generated/glyph_set.dart').openSync(mode: FileMode.write);
File('$_generatedDir/glyph_set.dart').openSync(mode: FileMode.write);
file.writeStringSync(_header);
file.writeStringSync(r'''
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Don't modify this file by hand! It's generated by tool/generate.dart.
/// A class that provides access to every configurable glyph.
///
Expand Down Expand Up @@ -84,16 +84,13 @@ void _writeGlyphSetInterface(List<List<dynamic>> data) {
/// the Unicode glyph set.
void _writeGlyphSet(List<List<dynamic>> data, {required bool ascii}) {
final file =
File('lib/src/generated/${ascii ? "ascii" : "unicode"}_glyph_set.dart')
File('$_generatedDir/${ascii ? "ascii" : "unicode"}_glyph_set.dart')
.openSync(mode: FileMode.write);

final className = '${ascii ? "Ascii" : "Unicode"}GlyphSet';
file.writeStringSync('''
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
$_header
// Don't modify this file by hand! It's generated by tool/generate.dart.
import 'glyph_set.dart';
Expand Down Expand Up @@ -122,14 +119,10 @@ void _writeGlyphSet(List<List<dynamic>> data, {required bool ascii}) {
/// Writes `lib/src/generated/top_level.dart`.
void _writeTopLevel(List<List<dynamic>> data) {
final file =
File('lib/src/generated/top_level.dart').openSync(mode: FileMode.write);
File('$_generatedDir/top_level.dart').openSync(mode: FileMode.write);

file.writeStringSync('''
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Don't modify this file by hand! It's generated by tool/generate.dart.
$_header
import '../../term_glyph.dart' as glyph;
''');
Expand All @@ -151,3 +144,13 @@ void _writeTopLevel(List<List<dynamic>> data) {
}

String _quote(String input) => input.contains("'") ? '"$input"' : "'$input'";

const _header = '''
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Don't modify this file by hand! It's generated by tool/generate.dart.
// ignore_for_file: lines_longer_than_80_chars
''';

0 comments on commit b412ba4

Please sign in to comment.