Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.7.0

- Increase dependency range of args
- Implement strong mode

## 0.6.2

- Add `name` parameter to `Option` and `Flag` ( #102 )
Expand Down
27 changes: 27 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
analyzer:
strong-mode: true

linter:
rules:
- annotate_overrides
- avoid_empty_else
- avoid_return_types_on_setters
- await_only_futures
- cancel_subscriptions
- close_sinks
- control_flow_in_finally
- empty_statements
- hash_and_equals
- implementation_imports
- invariant_booleans
- iterable_contains_unrelated_type
- list_remove_unrelated_type
- literal_only_boolean_expressions
- no_adjacent_strings_in_list
- no_duplicate_case_values
- only_throw_errors
- test_types_in_equals
- throw_in_finally
- unnecessary_statements
- unrelated_type_equality_checks
- valid_regexps
2 changes: 1 addition & 1 deletion lib/src/invocation_maker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ abstract class InvocationMaker {
return invocationMirror.reflectee;
}

_passThrough(passThroughMirror);
_passThrough(InstanceMirror passThroughMirror);
}

class _GetterInvocationMaker extends InvocationMaker {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/plugins/completion/completion.dart
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Iterable<String> _filterCompletions(String partialWord, Iterable<String>

String _COMPLETION = 'completion';

var _installationNames = _installationNamesHelp.keys;
List<String> _installationNames = _installationNamesHelp.keys;
// TODO: Replace this with an enum.
var _installationNamesHelp = {
'print': 'Print completion script to stdout.',
Expand Down
4 changes: 2 additions & 2 deletions lib/src/plugins/help/option_help.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ class OptionHelp {
return help.splitMapJoin(
',',
onMatch: (match) => textPen(match.group(0)),
onNonMatch: optionPen);
onNonMatch: (String nonMatch) => optionPen(nonMatch));
}

static String helpFormatter(String help) {
return help.splitMapJoin(
new RegExp(r'<[^>]+>'),
onMatch: (match) => optionPen(match.group(0)),
onNonMatch: textPen);
onNonMatch: (String nonMatch) => textPen(nonMatch));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/src/string_codecs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class CamelCaseEncoder extends Converter<List<String>, String> {
}
}

final dashesToCamelCase = new SeparatorCodec("-", splitter: new RegExp(r'[_-]'))
final Codec dashesToCamelCase = new SeparatorCodec("-", splitter: new RegExp(r'[_-]'))
.inverted
.fuse(new CamelCaseCodec(false));

Expand Down
2 changes: 1 addition & 1 deletion lib/src/usage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ CommandInvocation applyUsageToCommandInvocation(Usage usage, CommandInvocation i
}

List zipParsedArgs(args, parsers, names) {
return new IterableZip([args, parsers, names])
return new IterableZip([args, parsers, names] as Iterable<Iterable>)
.map((parts) => parseArg(parts[1], parts[0], parts[2]))
.toList();
}
Expand Down
16 changes: 8 additions & 8 deletions lib/src/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'dart:collection';
import 'dart:mirrors';
import 'dart:io';

import 'package:args/args.dart' show ArgParser, ArgResults;
import 'package:args/args.dart' show ArgParser;
import 'package:collection/iterable_zip.dart';
import 'package:mockable_filesystem/filesystem.dart' as filesystem;

Expand Down Expand Up @@ -221,7 +221,7 @@ Usage getUsageFromFunction(MethodMirror methodMirror, DeclarationScript script,
getParserFromType(TypeMirror typeMirror) {
if(typeMirror is ClassMirror &&
typeMirror.declarations.values.any((d) =>
d.isStatic && d.simpleName == #parse)) {
d is MethodMirror && d.isStatic && d.simpleName == #parse)) {
return (String item) => typeMirror.invoke(#parse, [item]).reflectee;
}
return null;
Expand Down Expand Up @@ -360,8 +360,8 @@ getRestParameterIndex(MethodMirror methodMirror) {
}

MethodMirror getUnnamedConstructor(ClassMirror classMirror) {
var constructors = classMirror.declarations.values
.where((d) => d is MethodMirror && d.isConstructor);
Iterable<MethodMirror> constructors = new List<MethodMirror>.from(
classMirror.declarations.values.where((d) => d is MethodMirror && d.isConstructor));

return constructors.firstWhere((constructor) =>
constructor.constructorName == const Symbol(''), orElse: () => null);
Expand Down Expand Up @@ -487,12 +487,12 @@ String formatColumns(

formatters = formatters.map((f) => f == null ? (x) => x : f);
var widths = new IterableZip(cells).map((column) =>
column.isEmpty ? null : column.map((s) => s.length).reduce((a, b) => Comparable.compare(a, b) > 0 ? a : b)).toList();
column.isEmpty ? null : column.map((s) => s.length).reduce((a, b) => Comparable.compare(a, b) > 0 ? a : b));
var cellsWithMetadata = cells.map((line) => new IterableZip([line, widths, formatters]));
var formattedCells = cellsWithMetadata.map((lineCells) => lineCells.map((cellWithMetadata) {
var cell = cellWithMetadata[0];
var width = cellWithMetadata[1];
var formatter = cellWithMetadata[2];
String cell = cellWithMetadata[0];
int width = cellWithMetadata[1];
Function formatter = cellWithMetadata[2];
return formatter(cell) + (' ' * ((width - cell.length) + separateBy));
}));

Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name: unscripted
version: 0.6.2
version: 0.7.0
author: Sean Eagan <seaneagan1@gmail.com>
description: Declarative command-line interface programming.
homepage: http://github.com/seaneagan/unscripted
dependencies:
ansicolor: '>=0.0.9 <0.1.0'
args: '>=0.11.0 <0.14.0'
args: '>=0.11.0 <2.0.0'
collection: '>=1.1.0 <2.0.0'
mockable_filesystem: '>=0.0.3 <0.1.0'
path: '>=1.3.3 <2.0.0'
supports_color: '>=0.1.1 <0.2.0'
dev_dependencies:
grinder: '>=0.7.1+3'
test: '>=0.12.1 <0.12.2'
test: '^0.12.32+1'