Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #48 from dart-lang/kw-cmdline
Browse files Browse the repository at this point in the history
Update cmdline examples to 2.1
  • Loading branch information
kwalrath authored May 4, 2019
2 parents 8a8ddc8 + 794cfa2 commit 7e51aa2
Show file tree
Hide file tree
Showing 7 changed files with 201 additions and 66 deletions.
11 changes: 11 additions & 0 deletions cmdline/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Files and directories created by pub
.dart_tool/
.packages
# Remove the following pattern if you wish to check in your lock file
pubspec.lock

# Conventional directory for build outputs
build/

# Directory created by dartdoc
doc/api/
14 changes: 14 additions & 0 deletions cmdline/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Defines a default set of lint rules enforced for
# projects at Google. For details and rationale,
# see https://github.com/dart-lang/pedantic#enabled-lints.
include: package:pedantic/analysis_options.yaml

# For lint rules and documentation, see http://dart-lang.github.io/linter/lints.
# Uncomment to specify additional rules.
# linter:
# rules:
# - camel_case_types

analyzer:
# exclude:
# - path/to/excluded/files/**
5 changes: 2 additions & 3 deletions cmdline/bin/dcat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ library dcat;

import 'dart:convert';
import 'dart:io';
import 'dart:async';

import 'package:args/args.dart';

Expand Down Expand Up @@ -38,7 +37,7 @@ void main(List<String> arguments) {
Future dcat(List<String> paths, bool showLineNumbers) async {
if (paths.isEmpty) {
// No files provided as arguments. Read from stdin and print each line.
stdin.pipe(stdout);
await stdin.pipe(stdout);
} else {
for (var path in paths) {
int lineNumber = 1;
Expand All @@ -54,7 +53,7 @@ Future dcat(List<String> paths, bool showLineNumbers) async {
stdout.writeln(line);
}
} catch (_) {
_handleError(path);
await _handleError(path);
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions cmdline/bin/dgrep.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ library dgrep;

import 'dart:io';
import 'package:args/args.dart';
import 'dart:async';

const usage = 'usage: dart dgrep.dart [-rnS] patterns file_or_directory';
const recursive = 'recursive';
Expand Down Expand Up @@ -62,9 +61,9 @@ Future main(List<String> arguments) async {
recursive: argResults[recursive],
followLinks: argResults[followLinks])) {
if (entity is File) {
searchFile(entity, searchTerms);
await searchFile(entity, searchTerms);
} else {
searchFile(new File(searchPath), searchTerms);
await searchFile(new File(searchPath), searchTerms);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions cmdline/bin/helloworld42.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
void main() {
int fortyTwo = 'Hello, World'; // Type mismatch
print(fortyTwo);
// int fortyTwo = 'Hello, World'; // Type mismatch
// print(fortyTwo);
}
Loading

0 comments on commit 7e51aa2

Please sign in to comment.