404: Something's gone wrong :-(
- -You've tried to visit a page that doesn't exist. Luckily this site - has other pages.
-If you were looking for something specific, try searching: -
- - -diff --git a/doc/api/__404error.html b/doc/api/__404error.html deleted file mode 100644 index 8b4d127..0000000 --- a/doc/api/__404error.html +++ /dev/null @@ -1,103 +0,0 @@ - - -
- - - - - -You've tried to visit a page that doesn't exist. Luckily this site - has other pages.
-If you were looking for something specific, try searching: -
- - -true
if the exitCode is exitFailure.
- true
if the exitCode is exitSuccess.
- CatResult();
-Add a message with an optional path.
-void addMessage(String message, {String? path}) {
- exitCode = exitFailure;
- if (path != null && path.isNotEmpty) {
- messages.add('$path: $message');
- } else {
- messages.add(message);
- }
-}
-The exit code.
-int exitCode = exitSuccess;
-
-
-Returns true
if the exitCode is exitFailure.
bool get isFailure => exitCode == exitFailure;
-Returns true
if the exitCode is exitSuccess.
bool get isSuccess => exitCode == exitSuccess;
-The error messages.
-final List<String> messages = [];
-
-
-Concatenates files in paths
to the standard output or a file.
output
should be an IOSink such as stdout or File.openWrite.input
can be stdin.The remaining optional parameters are similar to the GNU cat utility.
-Future<CatResult> cat(List<String> paths, IOSink output,
- {Stream<List<int>>? input,
- bool numberNonBlank = false,
- bool showEnds = false,
- bool showLineNumbers = false,
- bool showNonPrinting = false,
- bool showTabs = false,
- bool squeezeBlank = false}) async {
- final result = CatResult();
- final lastLine = _LastLine();
-
- if (paths.isEmpty) {
- if (input != null) {
- try {
- await _copyStream(input, lastLine, output, numberNonBlank, showEnds,
- showLineNumbers, showNonPrinting, showTabs, squeezeBlank);
- } catch (e) {
- result.addMessage(_getErrorMessage(e));
- }
- }
- } else {
- for (final path in paths) {
- try {
- final Stream<List<int>> stream;
- if (path == '-' && input != null) {
- stream = input;
- } else {
- stream = File(path).openRead();
- }
- await _copyStream(stream, lastLine, output, numberNonBlank, showEnds,
- showLineNumbers, showNonPrinting, showTabs, squeezeBlank);
- } catch (e) {
- result.addMessage(_getErrorMessage(e), path: path);
- }
- }
- }
- return result;
-}
-A library to concatenate files to standard output or file.
-1
- 0
- paths
to the standard output or a file. [...]
-
-
-Failure exit code.
-const exitFailure = 1;
-Success exit code.
-const exitSuccess = 0;
-A cat command-line and library implementation in Dart, inspired by the Write command-line apps sample code.
-dcat copies each file, or standard input if none are given, to standard output or file.
-dcat --help
-
-Usage: dcat [OPTION]... [FILE]...
-Concatenate FILE(s) to standard output.
-
-With no FILE, or when FILE is -, read standard input.
-
- -A, --show-all equivalent to -vET
- -b, --number-nonblank number nonempty output lines, overrides -n
- -e, --show-nonprinting-ends equivalent to -vE
- -E, --show-ends display $ at end of each line
- -h, --help display this help and exit
- -n, --number number all output lines
- -t, --show-nonprinting-tabs equivalent to -vT
- -T, --show-tabs display TAB characters as ^I
- -s, --squeeze-blank suppress repeated empty output lines
- --version output version information and exit
- -v, --show-nonprinting use ^ and M- notation, except for LFD and TAB
-
-Examples:
- dcat f - g Output f's contents, then standard input, then g's contents.
- dcat Copy standard input to standard output.
-
-dart compile exe -o bin/dcat bin/dcat.dart
-
-dart compile exe bin/dcat.dart
-
-import 'package:dcat/dcat.dart';
-
-final result = await cat(['path/to/file', 'path/to/otherfile]'],
- File('path/to/outfile').openWrite());
-if (result.isFailure) {
- for (final message in result.messages) {
- print("Error: $message");
- }
-}
-
-The cat
function supports the following parameters:
Parameter | Description | Type |
---|---|---|
paths | The file paths. | String[] |
output | The standard output or file. | IOSink |
input | The standard input. | Stream |
showEnds | Same as -e | bool |
numberNonBlank | Same as -b | bool |
showLineNumbers | Same as -n | bool |
showTabs | Same as -T | bool |
squeezeBlank | Same as -s | bool |
showNonPrinting | Same as -v | bool |
paths
and output
are required.output
should be an IOSink such as stdout
or a File stream.input
can be stdin.The remaining optional parameters are similar to the GNU cat utility.
-A CatResult
object is returned which contains the exitCode
(exitSuccess
or exitFailure
) and error messages
if any:
final result = await cat(['path/to/file'], stdout);
-if (result.exitCode == exitSuccess) {
- ...
-} else {
- for (final message in result.messages) {
- stderr.writeln("Error: $message");
- }
-}
-
-