Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use the terminal width for the line length #2333

Merged
merged 1 commit into from
Sep 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/src/dartdoc_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
library dartdoc.dartdoc_options;

import 'dart:async';
import 'dart:io' show Platform;
import 'dart:io' show Platform, stdout;

import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/file_system/file_system.dart';
Expand All @@ -39,6 +39,8 @@ const int _kIntVal = 0;
const double _kDoubleVal = 0.0;
const bool _kBoolVal = true;

int get _usageLineLength => stdout.hasTerminal ? stdout.terminalColumns : null;

typedef ConvertYamlToType<T> = T Function(YamlMap, String, ResourceProvider);

class DartdocOptionError extends DartdocFailure {
Expand Down Expand Up @@ -555,7 +557,7 @@ abstract class DartdocOption<T> {
Map<String, _YamlFileData> get _yamlAtCanonicalPathCache =>
root.__yamlAtCanonicalPathCache;

final ArgParser __argParser = ArgParser(usageLineLength: 80);
final ArgParser __argParser = ArgParser(usageLineLength: _usageLineLength);

ArgParser get argParser => root.__argParser;

Expand Down Expand Up @@ -1546,7 +1548,7 @@ Future<List<DartdocOption<Object>>> createDartdocOptions(
'dart.html',
'dart.indexed_db',
'dart.io',
'dart.lisolate',
'dart.isolate',
'dart.js',
'dart.js_util',
'dart.math',
Expand Down