Updated documentation.

This commit is contained in:
Erik C. Thauvin 2021-10-16 00:54:50 -07:00
parent 4ee7ec2127
commit fd3661b21b
14 changed files with 441 additions and 125 deletions

View file

@ -53,8 +53,9 @@ dart compile exe bin/dcat.dart
```dart
import 'package:dcat/dcat.dart';
final result = await cat(['path/to/file', 'path/to/otherfile]'], File('path/to/outfile'));
if (result.exitCode == exitFailure) {
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");
}
@ -66,9 +67,8 @@ The `cat` function supports the following parameters:
Parameter | Description | Type
:--------------- |:----------------------------- | :-------------------
paths | The file paths. | String[]
output | The standard output or file. | IOSink or File
output | The standard output or file. | [IOSink](https://api.dart.dev/dart-io/IOSink-class.html)
input | The standard input. | Stream<List\<int\>\>?
log | The log for debugging. | List\<String\>?
showEnds | Same as `-e` | bool
numberNonBlank | Same as `-b` | bool
showLineNumbers | Same as `-n` | bool
@ -77,9 +77,8 @@ squeezeBlank | Same as `-s` | bool
showNonPrinting | Same as `-v` | bool
* `paths` and `output` are required.
* `output` should be an `IOSink` like `stdout` or a `File`.
* `input` can be `stdin`.
* `log` is used for debugging/testing purposes.
* `output` should be an [IOSink](https://api.dart.dev/dart-io/IOSink-class.html) like `stdout` or a [File](https://api.dart.dev/dart-io/File/openWrite.html) stream.
* `input` can be [stdin](https://api.dart.dev/dart-io/Stdin-class.html).
The remaining optional parameters are similar to the [GNU cat](https://www.gnu.org/software/coreutils/manual/html_node/cat-invocation.html#cat-invocation) utility.
@ -89,11 +88,13 @@ A `CatResult` object is returned which contains the `exitCode` (`exitSuccess` or
final result = await cat(['path/to/file'], stdout);
if (result.exitCode == exitSuccess) {
...
} else {
for (final message in result.messages) {
stderr.writeln("Error: $message");
}
}
```
## Differences from [GNU cat](https://www.gnu.org/software/coreutils/manual/html_node/cat-invocation.html#cat-invocation)
- No binary file support.
- A line is considered terminated by either a `CR` (carriage return), a `LF` (line feed), a `CR+LF` sequence (DOS line ending).
- A line ending is automatically appended to the last line of any read file.
- The `U+` notation is used instead of `M-` for non-printing characters.
- The [U+](https://en.wikipedia.org/wiki/Unicode) notation is used instead of `M-` for non-printing characters.

View file

@ -75,7 +75,7 @@
<dl class="properties">
<dt id="exitCode" class="property">
<span class="name"><a href="../dcat/CatResult/exitCode.html">exitCode</a></span>
<span class="signature">&#8596; <a href="https://api.dart.dev/stable/2.14.3/dart-core/int-class.html">int</a></span>
<span class="signature">&#8596; <a href="https://api.dart.dev/stable/2.14.4/dart-core/int-class.html">int</a></span>
</dt>
<dd>
@ -85,19 +85,41 @@
</dd>
<dt id="hashCode" class="property inherited">
<span class="name"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/hashCode.html">hashCode</a></span>
<span class="signature">&#8594; <a href="https://api.dart.dev/stable/2.14.3/dart-core/int-class.html">int</a></span>
<span class="name"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/hashCode.html">hashCode</a></span>
<span class="signature">&#8594; <a href="https://api.dart.dev/stable/2.14.4/dart-core/int-class.html">int</a></span>
</dt>
<dd class="inherited">
The hash code for this object. <a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/hashCode.html">[...]</a>
The hash code for this object. <a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/hashCode.html">[...]</a>
<div class="features">read-only, inherited</div>
</dd>
<dt id="isFailure" class="property">
<span class="name"><a href="../dcat/CatResult/isFailure.html">isFailure</a></span>
<span class="signature">&#8594; <a href="https://api.dart.dev/stable/2.14.4/dart-core/bool-class.html">bool</a></span>
</dt>
<dd>
Returns <code>true</code> if the <a href="../dcat/CatResult/exitCode.html">exitCode</a> is <a href="../dcat/exitFailure-constant.html">exitFailure</a>.
<div class="features">read-only</div>
</dd>
<dt id="isSuccess" class="property">
<span class="name"><a href="../dcat/CatResult/isSuccess.html">isSuccess</a></span>
<span class="signature">&#8594; <a href="https://api.dart.dev/stable/2.14.4/dart-core/bool-class.html">bool</a></span>
</dt>
<dd>
Returns <code>true</code> if the <a href="../dcat/CatResult/exitCode.html">exitCode</a> is <a href="../dcat/exitSuccess-constant.html">exitSuccess</a>.
<div class="features">read-only</div>
</dd>
<dt id="messages" class="property">
<span class="name"><a href="../dcat/CatResult/messages.html">messages</a></span>
<span class="signature">&#8594; <a href="https://api.dart.dev/stable/2.14.3/dart-core/List-class.html">List</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="https://api.dart.dev/stable/2.14.3/dart-core/String-class.html">String</a></span>&gt;</span></span>
<span class="signature">&#8594; <a href="https://api.dart.dev/stable/2.14.4/dart-core/List-class.html">List</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="https://api.dart.dev/stable/2.14.4/dart-core/String-class.html">String</a></span>&gt;</span></span>
</dt>
<dd>
@ -107,8 +129,8 @@
</dd>
<dt id="runtimeType" class="property inherited">
<span class="name"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/runtimeType.html">runtimeType</a></span>
<span class="signature">&#8594; <a href="https://api.dart.dev/stable/2.14.3/dart-core/Type-class.html">Type</a></span>
<span class="name"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/runtimeType.html">runtimeType</a></span>
<span class="signature">&#8594; <a href="https://api.dart.dev/stable/2.14.4/dart-core/Type-class.html">Type</a></span>
</dt>
<dd class="inherited">
@ -124,40 +146,40 @@
<h2>Methods</h2>
<dl class="callables">
<dt id="addMessage" class="callable">
<span class="name"><a href="../dcat/CatResult/addMessage.html">addMessage</a></span><span class="signature">(<wbr><span class="parameter" id="addMessage-param-exitCode"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/int-class.html">int</a></span> <span class="parameter-name">exitCode</span>, </span><span class="parameter" id="addMessage-param-message"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/String-class.html">String</a></span> <span class="parameter-name">message</span>, </span><span class="parameter" id="addMessage-param-path">{<span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/String-class.html">String</a>?</span> <span class="parameter-name">path</span>}</span>)
<span class="name"><a href="../dcat/CatResult/addMessage.html">addMessage</a></span><span class="signature">(<wbr><span class="parameter" id="addMessage-param-exitCode"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/int-class.html">int</a></span> <span class="parameter-name">exitCode</span>, </span><span class="parameter" id="addMessage-param-message"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/String-class.html">String</a></span> <span class="parameter-name">message</span>, </span><span class="parameter" id="addMessage-param-path">{<span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/String-class.html">String</a>?</span> <span class="parameter-name">path</span>}</span>)
<span class="returntype parameter">&#8594; void</span>
</span>
</dt>
<dd>
Add a message.
Add a message with an optional path.
</dd>
<dt id="noSuchMethod" class="callable inherited">
<span class="name"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/noSuchMethod.html">noSuchMethod</a></span><span class="signature">(<wbr><span class="parameter" id="noSuchMethod-param-invocation"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Invocation-class.html">Invocation</a></span> <span class="parameter-name">invocation</span></span>)
<span class="name"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/noSuchMethod.html">noSuchMethod</a></span><span class="signature">(<wbr><span class="parameter" id="noSuchMethod-param-invocation"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Invocation-class.html">Invocation</a></span> <span class="parameter-name">invocation</span></span>)
<span class="returntype parameter">&#8594; dynamic</span>
</span>
</dt>
<dd class="inherited">
Invoked when a non-existent method or property is accessed. <a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/noSuchMethod.html">[...]</a>
Invoked when a non-existent method or property is accessed. <a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/noSuchMethod.html">[...]</a>
<div class="features">inherited</div>
</dd>
<dt id="toString" class="callable inherited">
<span class="name"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/toString.html">toString</a></span><span class="signature">(<wbr>)
<span class="returntype parameter">&#8594; <a href="https://api.dart.dev/stable/2.14.3/dart-core/String-class.html">String</a></span>
<span class="name"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/toString.html">toString</a></span><span class="signature">(<wbr>)
<span class="returntype parameter">&#8594; <a href="https://api.dart.dev/stable/2.14.4/dart-core/String-class.html">String</a></span>
</span>
</dt>
<dd class="inherited">
A string representation of this object. <a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/toString.html">[...]</a>
A string representation of this object. <a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/toString.html">[...]</a>
<div class="features">inherited</div>
</dd>
@ -169,14 +191,14 @@
<h2>Operators</h2>
<dl class="callables">
<dt id="operator ==" class="callable inherited">
<span class="name"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/operator_equals.html">operator ==</a></span><span class="signature">(<wbr><span class="parameter" id="==-param-other"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object-class.html">Object</a></span> <span class="parameter-name">other</span></span>)
<span class="returntype parameter">&#8594; <a href="https://api.dart.dev/stable/2.14.3/dart-core/bool-class.html">bool</a></span>
<span class="name"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/operator_equals.html">operator ==</a></span><span class="signature">(<wbr><span class="parameter" id="==-param-other"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object-class.html">Object</a></span> <span class="parameter-name">other</span></span>)
<span class="returntype parameter">&#8594; <a href="https://api.dart.dev/stable/2.14.4/dart-core/bool-class.html">bool</a></span>
</span>
</dt>
<dd class="inherited">
The equality operator. <a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/operator_equals.html">[...]</a>
The equality operator. <a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/operator_equals.html">[...]</a>
<div class="features">inherited</div>
</dd>
@ -235,17 +257,19 @@
<a href="../dcat/CatResult-class.html#instance-properties">Properties</a>
</li>
<li><a href="../dcat/CatResult/exitCode.html">exitCode</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/hashCode.html">hashCode</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/hashCode.html">hashCode</a></li>
<li><a href="../dcat/CatResult/isFailure.html">isFailure</a></li>
<li><a href="../dcat/CatResult/isSuccess.html">isSuccess</a></li>
<li><a href="../dcat/CatResult/messages.html">messages</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/runtimeType.html">runtimeType</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/runtimeType.html">runtimeType</a></li>
<li class="section-title"><a href="../dcat/CatResult-class.html#instance-methods">Methods</a></li>
<li><a href="../dcat/CatResult/addMessage.html">addMessage</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/toString.html">toString</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/toString.html">toString</a></li>
<li class="section-title inherited"><a href="../dcat/CatResult-class.html#operators">Operators</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/operator_equals.html">operator ==</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/operator_equals.html">operator ==</a></li>

View file

@ -91,17 +91,19 @@
<a href="../../dcat/CatResult-class.html#instance-properties">Properties</a>
</li>
<li><a href="../../dcat/CatResult/exitCode.html">exitCode</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/hashCode.html">hashCode</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/hashCode.html">hashCode</a></li>
<li><a href="../../dcat/CatResult/isFailure.html">isFailure</a></li>
<li><a href="../../dcat/CatResult/isSuccess.html">isSuccess</a></li>
<li><a href="../../dcat/CatResult/messages.html">messages</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/runtimeType.html">runtimeType</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/runtimeType.html">runtimeType</a></li>
<li class="section-title"><a href="../../dcat/CatResult-class.html#instance-methods">Methods</a></li>
<li><a href="../../dcat/CatResult/addMessage.html">addMessage</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/toString.html">toString</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/toString.html">toString</a></li>
<li class="section-title inherited"><a href="../../dcat/CatResult-class.html#operators">Operators</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/operator_equals.html">operator ==</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/operator_equals.html">operator ==</a></li>

View file

@ -53,9 +53,9 @@
<span class="returntype">void</span>
<span class="name ">addMessage</span>(<wbr><ol class="parameter-list"><li><span class="parameter" id="addMessage-param-exitCode"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/int-class.html">int</a></span> <span class="parameter-name">exitCode</span>, </span></li>
<li><span class="parameter" id="addMessage-param-message"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/String-class.html">String</a></span> <span class="parameter-name">message</span>, </span></li>
<li><span class="parameter" id="addMessage-param-path">{<span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/String-class.html">String</a>?</span> <span class="parameter-name">path</span>}</span></li>
<span class="name ">addMessage</span>(<wbr><ol class="parameter-list"><li><span class="parameter" id="addMessage-param-exitCode"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/int-class.html">int</a></span> <span class="parameter-name">exitCode</span>, </span></li>
<li><span class="parameter" id="addMessage-param-message"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/String-class.html">String</a></span> <span class="parameter-name">message</span>, </span></li>
<li><span class="parameter" id="addMessage-param-path">{<span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/String-class.html">String</a>?</span> <span class="parameter-name">path</span>}</span></li>
</ol>)
@ -63,7 +63,7 @@
</section>
<section class="desc markdown">
<p>Add a message.</p>
<p>Add a message with an optional path.</p>
</section>
@ -109,17 +109,19 @@
<a href="../../dcat/CatResult-class.html#instance-properties">Properties</a>
</li>
<li><a href="../../dcat/CatResult/exitCode.html">exitCode</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/hashCode.html">hashCode</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/hashCode.html">hashCode</a></li>
<li><a href="../../dcat/CatResult/isFailure.html">isFailure</a></li>
<li><a href="../../dcat/CatResult/isSuccess.html">isSuccess</a></li>
<li><a href="../../dcat/CatResult/messages.html">messages</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/runtimeType.html">runtimeType</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/runtimeType.html">runtimeType</a></li>
<li class="section-title"><a href="../../dcat/CatResult-class.html#instance-methods">Methods</a></li>
<li><a href="../../dcat/CatResult/addMessage.html">addMessage</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/toString.html">toString</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/toString.html">toString</a></li>
<li class="section-title inherited"><a href="../../dcat/CatResult-class.html#operators">Operators</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/operator_equals.html">operator ==</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/operator_equals.html">operator ==</a></li>

View file

@ -50,7 +50,7 @@
</h1></div>
<section class="multi-line-signature">
<a href="https://api.dart.dev/stable/2.14.3/dart-core/int-class.html">int</a>
<a href="https://api.dart.dev/stable/2.14.4/dart-core/int-class.html">int</a>
<span class="name ">exitCode</span>
<div class="features">read / write</div>
@ -97,17 +97,19 @@
<a href="../../dcat/CatResult-class.html#instance-properties">Properties</a>
</li>
<li><a href="../../dcat/CatResult/exitCode.html">exitCode</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/hashCode.html">hashCode</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/hashCode.html">hashCode</a></li>
<li><a href="../../dcat/CatResult/isFailure.html">isFailure</a></li>
<li><a href="../../dcat/CatResult/isSuccess.html">isSuccess</a></li>
<li><a href="../../dcat/CatResult/messages.html">messages</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/runtimeType.html">runtimeType</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/runtimeType.html">runtimeType</a></li>
<li class="section-title"><a href="../../dcat/CatResult-class.html#instance-methods">Methods</a></li>
<li><a href="../../dcat/CatResult/addMessage.html">addMessage</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/toString.html">toString</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/toString.html">toString</a></li>
<li class="section-title inherited"><a href="../../dcat/CatResult-class.html#operators">Operators</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/operator_equals.html">operator ==</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/operator_equals.html">operator ==</a></li>

View file

@ -0,0 +1,150 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no">
<meta name="description" content="API docs for the isFailure property from the CatResult class, for the Dart programming language.">
<title>isFailure property - CatResult class - dcat library - Dart API</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,300;0,400;0,500;0,700;1,400&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="../../static-assets/github.css?v1">
<link rel="stylesheet" href="../../static-assets/styles.css?v1">
<link rel="icon" href="../../static-assets/favicon.png?v1">
</head>
<body data-base-href="../../"
data-using-base-href="false">
<div id="overlay-under-drawer"></div>
<header id="title">
<button id="sidenav-left-toggle" type="button">&nbsp;</button>
<ol class="breadcrumbs gt-separated dark hidden-xs">
<li><a href="../../index.html">dcat</a></li>
<li><a href="../../dcat/dcat-library.html">dcat</a></li>
<li><a href="../../dcat/CatResult-class.html">CatResult</a></li>
<li class="self-crumb">isFailure property</li>
</ol>
<div class="self-name">isFailure</div>
<form class="search navbar-right" role="search">
<input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
</form>
</header>
<main>
<div id="dartdoc-main-content" class="main-content">
<div>
<h1><span class="kind-property">isFailure</span> property
<a href="https://dart.dev/null-safety" class="feature feature-null-safety" title="Supports the null safety language feature.">Null safety</a>
</h1></div>
<section id="getter">
<section class="multi-line-signature">
<span class="returntype"><a href="https://api.dart.dev/stable/2.14.4/dart-core/bool-class.html">bool</a></span>
<span class="name ">isFailure</span>
</section>
<section class="desc markdown">
<p>Returns <code>true</code> if the <a href="../../dcat/CatResult/exitCode.html">exitCode</a> is <a href="../../dcat/exitFailure-constant.html">exitFailure</a>.</p>
</section>
<section class="summary source-code" id="source">
<h2><span>Implementation</span></h2>
<pre class="language-dart"><code class="language-dart">bool get isFailure =&gt; exitCode == exitFailure;</code></pre>
</section>
</section>
</div> <!-- /.main-content -->
<div id="dartdoc-sidebar-left" class="sidebar sidebar-offcanvas-left">
<header id="header-search-sidebar" class="hidden-l">
<form class="search-sidebar" role="search">
<input type="text" id="search-sidebar" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
</form>
</header>
<ol class="breadcrumbs gt-separated dark hidden-l" id="sidebar-nav">
<li><a href="../../index.html">dcat</a></li>
<li><a href="../../dcat/dcat-library.html">dcat</a></li>
<li><a href="../../dcat/CatResult-class.html">CatResult</a></li>
<li class="self-crumb">isFailure property</li>
</ol>
<h5>CatResult class</h5>
<ol>
<li class="section-title"><a href="../../dcat/CatResult-class.html#constructors">Constructors</a></li>
<li><a href="../../dcat/CatResult/CatResult.html">CatResult</a></li>
<li class="section-title">
<a href="../../dcat/CatResult-class.html#instance-properties">Properties</a>
</li>
<li><a href="../../dcat/CatResult/exitCode.html">exitCode</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/hashCode.html">hashCode</a></li>
<li><a href="../../dcat/CatResult/isFailure.html">isFailure</a></li>
<li><a href="../../dcat/CatResult/isSuccess.html">isSuccess</a></li>
<li><a href="../../dcat/CatResult/messages.html">messages</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/runtimeType.html">runtimeType</a></li>
<li class="section-title"><a href="../../dcat/CatResult-class.html#instance-methods">Methods</a></li>
<li><a href="../../dcat/CatResult/addMessage.html">addMessage</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/toString.html">toString</a></li>
<li class="section-title inherited"><a href="../../dcat/CatResult-class.html#operators">Operators</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/operator_equals.html">operator ==</a></li>
</ol>
</div><!--/.sidebar-offcanvas-->
<div id="dartdoc-sidebar-right" class="sidebar sidebar-offcanvas-right">
</div><!--/.sidebar-offcanvas-->
</main>
<footer>
<span class="no-break">
dcat
1.0.0
</span>
</footer>
<script src="../../static-assets/highlight.pack.js?v1"></script>
<script src="../../static-assets/script.js?v1"></script>
</body>
</html>

View file

@ -0,0 +1,150 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no">
<meta name="description" content="API docs for the isSuccess property from the CatResult class, for the Dart programming language.">
<title>isSuccess property - CatResult class - dcat library - Dart API</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,300;0,400;0,500;0,700;1,400&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="../../static-assets/github.css?v1">
<link rel="stylesheet" href="../../static-assets/styles.css?v1">
<link rel="icon" href="../../static-assets/favicon.png?v1">
</head>
<body data-base-href="../../"
data-using-base-href="false">
<div id="overlay-under-drawer"></div>
<header id="title">
<button id="sidenav-left-toggle" type="button">&nbsp;</button>
<ol class="breadcrumbs gt-separated dark hidden-xs">
<li><a href="../../index.html">dcat</a></li>
<li><a href="../../dcat/dcat-library.html">dcat</a></li>
<li><a href="../../dcat/CatResult-class.html">CatResult</a></li>
<li class="self-crumb">isSuccess property</li>
</ol>
<div class="self-name">isSuccess</div>
<form class="search navbar-right" role="search">
<input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
</form>
</header>
<main>
<div id="dartdoc-main-content" class="main-content">
<div>
<h1><span class="kind-property">isSuccess</span> property
<a href="https://dart.dev/null-safety" class="feature feature-null-safety" title="Supports the null safety language feature.">Null safety</a>
</h1></div>
<section id="getter">
<section class="multi-line-signature">
<span class="returntype"><a href="https://api.dart.dev/stable/2.14.4/dart-core/bool-class.html">bool</a></span>
<span class="name ">isSuccess</span>
</section>
<section class="desc markdown">
<p>Returns <code>true</code> if the <a href="../../dcat/CatResult/exitCode.html">exitCode</a> is <a href="../../dcat/exitSuccess-constant.html">exitSuccess</a>.</p>
</section>
<section class="summary source-code" id="source">
<h2><span>Implementation</span></h2>
<pre class="language-dart"><code class="language-dart">bool get isSuccess =&gt; exitCode == exitSuccess;</code></pre>
</section>
</section>
</div> <!-- /.main-content -->
<div id="dartdoc-sidebar-left" class="sidebar sidebar-offcanvas-left">
<header id="header-search-sidebar" class="hidden-l">
<form class="search-sidebar" role="search">
<input type="text" id="search-sidebar" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
</form>
</header>
<ol class="breadcrumbs gt-separated dark hidden-l" id="sidebar-nav">
<li><a href="../../index.html">dcat</a></li>
<li><a href="../../dcat/dcat-library.html">dcat</a></li>
<li><a href="../../dcat/CatResult-class.html">CatResult</a></li>
<li class="self-crumb">isSuccess property</li>
</ol>
<h5>CatResult class</h5>
<ol>
<li class="section-title"><a href="../../dcat/CatResult-class.html#constructors">Constructors</a></li>
<li><a href="../../dcat/CatResult/CatResult.html">CatResult</a></li>
<li class="section-title">
<a href="../../dcat/CatResult-class.html#instance-properties">Properties</a>
</li>
<li><a href="../../dcat/CatResult/exitCode.html">exitCode</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/hashCode.html">hashCode</a></li>
<li><a href="../../dcat/CatResult/isFailure.html">isFailure</a></li>
<li><a href="../../dcat/CatResult/isSuccess.html">isSuccess</a></li>
<li><a href="../../dcat/CatResult/messages.html">messages</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/runtimeType.html">runtimeType</a></li>
<li class="section-title"><a href="../../dcat/CatResult-class.html#instance-methods">Methods</a></li>
<li><a href="../../dcat/CatResult/addMessage.html">addMessage</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/toString.html">toString</a></li>
<li class="section-title inherited"><a href="../../dcat/CatResult-class.html#operators">Operators</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/operator_equals.html">operator ==</a></li>
</ol>
</div><!--/.sidebar-offcanvas-->
<div id="dartdoc-sidebar-right" class="sidebar sidebar-offcanvas-right">
</div><!--/.sidebar-offcanvas-->
</main>
<footer>
<span class="no-break">
dcat
1.0.0
</span>
</footer>
<script src="../../static-assets/highlight.pack.js?v1"></script>
<script src="../../static-assets/script.js?v1"></script>
</body>
</html>

View file

@ -50,7 +50,7 @@
</h1></div>
<section class="multi-line-signature">
<a href="https://api.dart.dev/stable/2.14.3/dart-core/List-class.html">List</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="https://api.dart.dev/stable/2.14.3/dart-core/String-class.html">String</a></span>&gt;</span>
<a href="https://api.dart.dev/stable/2.14.4/dart-core/List-class.html">List</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="https://api.dart.dev/stable/2.14.4/dart-core/String-class.html">String</a></span>&gt;</span>
<span class="name ">messages</span>
<div class="features">final</div>
@ -97,17 +97,19 @@
<a href="../../dcat/CatResult-class.html#instance-properties">Properties</a>
</li>
<li><a href="../../dcat/CatResult/exitCode.html">exitCode</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/hashCode.html">hashCode</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/hashCode.html">hashCode</a></li>
<li><a href="../../dcat/CatResult/isFailure.html">isFailure</a></li>
<li><a href="../../dcat/CatResult/isSuccess.html">isSuccess</a></li>
<li><a href="../../dcat/CatResult/messages.html">messages</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/runtimeType.html">runtimeType</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/runtimeType.html">runtimeType</a></li>
<li class="section-title"><a href="../../dcat/CatResult-class.html#instance-methods">Methods</a></li>
<li><a href="../../dcat/CatResult/addMessage.html">addMessage</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/toString.html">toString</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/toString.html">toString</a></li>
<li class="section-title inherited"><a href="../../dcat/CatResult-class.html#operators">Operators</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/operator_equals.html">operator ==</a></li>
<li class="inherited"><a href="https://api.dart.dev/stable/2.14.4/dart-core/Object/operator_equals.html">operator ==</a></li>

View file

@ -52,27 +52,25 @@
<section class="multi-line-signature">
<span class="returntype"><a href="https://api.dart.dev/stable/2.14.3/dart-async/Future-class.html">Future</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="../dcat/CatResult-class.html">CatResult</a></span>&gt;</span></span>
<span class="name ">cat</span>(<wbr><ol class="parameter-list"><li><span class="parameter" id="cat-param-paths"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/List-class.html">List</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="https://api.dart.dev/stable/2.14.3/dart-core/String-class.html">String</a></span>&gt;</span></span> <span class="parameter-name">paths</span>, </span></li>
<li><span class="parameter" id="cat-param-output"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object-class.html">Object</a></span> <span class="parameter-name">output</span>, </span></li>
<li><span class="parameter" id="cat-param-input">{<span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-async/Stream-class.html">Stream</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="https://api.dart.dev/stable/2.14.3/dart-core/List-class.html">List</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="https://api.dart.dev/stable/2.14.3/dart-core/int-class.html">int</a></span>&gt;</span></span>&gt;</span>?</span> <span class="parameter-name">input</span>, </span></li>
<li><span class="parameter" id="cat-param-log"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/List-class.html">List</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="https://api.dart.dev/stable/2.14.3/dart-core/String-class.html">String</a></span>&gt;</span>?</span> <span class="parameter-name">log</span>, </span></li>
<li><span class="parameter" id="cat-param-showEnds"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">showEnds</span> = <span class="default-value">false</span>, </span></li>
<li><span class="parameter" id="cat-param-numberNonBlank"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">numberNonBlank</span> = <span class="default-value">false</span>, </span></li>
<li><span class="parameter" id="cat-param-showLineNumbers"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">showLineNumbers</span> = <span class="default-value">false</span>, </span></li>
<li><span class="parameter" id="cat-param-showTabs"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">showTabs</span> = <span class="default-value">false</span>, </span></li>
<li><span class="parameter" id="cat-param-squeezeBlank"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">squeezeBlank</span> = <span class="default-value">false</span>, </span></li>
<li><span class="parameter" id="cat-param-showNonPrinting"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">showNonPrinting</span> = <span class="default-value">false</span>}</span></li>
<span class="returntype"><a href="https://api.dart.dev/stable/2.14.4/dart-async/Future-class.html">Future</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="../dcat/CatResult-class.html">CatResult</a></span>&gt;</span></span>
<span class="name ">cat</span>(<wbr><ol class="parameter-list"><li><span class="parameter" id="cat-param-paths"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/List-class.html">List</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="https://api.dart.dev/stable/2.14.4/dart-core/String-class.html">String</a></span>&gt;</span></span> <span class="parameter-name">paths</span>, </span></li>
<li><span class="parameter" id="cat-param-output"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-io/IOSink-class.html">IOSink</a></span> <span class="parameter-name">output</span>, </span></li>
<li><span class="parameter" id="cat-param-input">{<span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-async/Stream-class.html">Stream</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="https://api.dart.dev/stable/2.14.4/dart-core/List-class.html">List</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="https://api.dart.dev/stable/2.14.4/dart-core/int-class.html">int</a></span>&gt;</span></span>&gt;</span>?</span> <span class="parameter-name">input</span>, </span></li>
<li><span class="parameter" id="cat-param-showEnds"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">showEnds</span> = <span class="default-value">false</span>, </span></li>
<li><span class="parameter" id="cat-param-numberNonBlank"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">numberNonBlank</span> = <span class="default-value">false</span>, </span></li>
<li><span class="parameter" id="cat-param-showLineNumbers"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">showLineNumbers</span> = <span class="default-value">false</span>, </span></li>
<li><span class="parameter" id="cat-param-showTabs"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">showTabs</span> = <span class="default-value">false</span>, </span></li>
<li><span class="parameter" id="cat-param-squeezeBlank"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">squeezeBlank</span> = <span class="default-value">false</span>, </span></li>
<li><span class="parameter" id="cat-param-showNonPrinting"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">showNonPrinting</span> = <span class="default-value">false</span>}</span></li>
</ol>)
</section>
<section class="desc markdown">
<p>Concatenates files in <code>paths</code> to <a href="https://api.dart.dev/stable/2.14.3/dart-io/stdout.html">stdout</a> or <a href="https://api.dart.dev/stable/2.14.3/dart-io/File-class.html">File</a>.</p>
<p>Concatenates files in <code>paths</code> to the standard output or a file.</p>
<ul>
<li><code>output</code> should be an <a href="https://api.dart.dev/stable/2.14.3/dart-io/IOSink-class.html">IOSink</a> like <a href="https://api.dart.dev/stable/2.14.3/dart-io/stdout.html">stdout</a> or a <a href="https://api.dart.dev/stable/2.14.3/dart-io/File-class.html">File</a>.</li>
<li><code>input</code> can be <a href="https://api.dart.dev/stable/2.14.3/dart-io/stdin.html">stdin</a>.</li>
<li><code>log</code> is used for debugging/testing purposes.</li>
<li><code>output</code> should be an <a href="https://api.dart.dev/stable/2.14.4/dart-io/IOSink-class.html">IOSink</a> such as <a href="https://api.dart.dev/stable/2.14.4/dart-io/stdout.html">stdout</a> or <a href="https://api.dart.dev/stable/2.14.4/dart-io/File/openWrite.html">File.openWrite</a>.</li>
<li><code>input</code> can be <a href="https://api.dart.dev/stable/2.14.4/dart-io/stdin.html">stdin</a>.</li>
</ul>
<p>The remaining optional parameters are similar to the <a href="https://www.gnu.org/software/coreutils/manual/html_node/cat-invocation.html#cat-invocation">GNU cat utility</a>.</p>
</section>
@ -81,33 +79,21 @@
<section class="summary source-code" id="source">
<h2><span>Implementation</span></h2>
<pre class="language-dart"><code class="language-dart">Future&lt;CatResult&gt; cat(List&lt;String&gt; paths, Object output,
<pre class="language-dart"><code class="language-dart">Future&lt;CatResult&gt; cat(List&lt;String&gt; paths, IOSink output,
{Stream&lt;List&lt;int&gt;&gt;? input,
List&lt;String&gt;? log,
bool showEnds = false,
bool numberNonBlank = false,
bool showLineNumbers = false,
bool showTabs = false,
bool squeezeBlank = false,
bool showNonPrinting = false}) async {
var result = CatResult();
var lineNumber = 1;
log?.clear();
final result = CatResult();
final lastLine = _LastLine(0, _lineFeed);
if (paths.isEmpty) {
if (input != null) {
final lines = await _readStream(input);
try {
await _writeLines(
lines,
lineNumber,
output,
log,
showEnds,
showLineNumbers,
numberNonBlank,
showTabs,
squeezeBlank,
showNonPrinting);
await _writeStream(input, lastLine, output, showEnds, showLineNumbers,
numberNonBlank, showTabs, squeezeBlank, showNonPrinting);
} catch (e) {
result.addMessage(exitFailure, &#39;$e&#39;);
}
@ -115,25 +101,14 @@
} else {
for (final path in paths) {
try {
final Stream&lt;String&gt; lines;
final Stream&lt;List&lt;int&gt;&gt; stream;
if (path == &#39;-&#39; &amp;&amp; input != null) {
lines = await _readStream(input);
stream = input;
} else {
lines = utf8.decoder
.bind(File(path).openRead())
.transform(const LineSplitter());
stream = File(path).openRead();
}
lineNumber = await _writeLines(
lines,
lineNumber,
output,
log,
showEnds,
showLineNumbers,
numberNonBlank,
showTabs,
squeezeBlank,
showNonPrinting);
await _writeStream(stream, lastLine, output, showEnds, showLineNumbers,
numberNonBlank, showTabs, squeezeBlank, showNonPrinting);
} on FileSystemException catch (e) {
final String? osMessage = e.osError?.message;
final String message;

View file

@ -77,12 +77,12 @@
<dl class="properties">
<dt id="exitFailure" class="constant">
<span class="name "><a href="../dcat/exitFailure-constant.html">exitFailure</a></span>
<span class="signature">&#8594; const <a href="https://api.dart.dev/stable/2.14.3/dart-core/int-class.html">int</a></span>
<span class="signature">&#8594; const <a href="https://api.dart.dev/stable/2.14.4/dart-core/int-class.html">int</a></span>
</dt>
<dd>
Failure exit code.
<div>
@ -92,12 +92,12 @@
<dt id="exitSuccess" class="constant">
<span class="name "><a href="../dcat/exitSuccess-constant.html">exitSuccess</a></span>
<span class="signature">&#8594; const <a href="https://api.dart.dev/stable/2.14.3/dart-core/int-class.html">int</a></span>
<span class="signature">&#8594; const <a href="https://api.dart.dev/stable/2.14.4/dart-core/int-class.html">int</a></span>
</dt>
<dd>
Success exit code.
<div>
@ -114,14 +114,14 @@
<dl class="callables">
<dt id="cat" class="callable">
<span class="name"><a href="../dcat/cat.html">cat</a></span><span class="signature">(<wbr><span class="parameter" id="cat-param-paths"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/List-class.html">List</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="https://api.dart.dev/stable/2.14.3/dart-core/String-class.html">String</a></span>&gt;</span></span> <span class="parameter-name">paths</span>, </span><span class="parameter" id="cat-param-output"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/Object-class.html">Object</a></span> <span class="parameter-name">output</span>, </span><span class="parameter" id="cat-param-input">{<span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-async/Stream-class.html">Stream</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="https://api.dart.dev/stable/2.14.3/dart-core/List-class.html">List</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="https://api.dart.dev/stable/2.14.3/dart-core/int-class.html">int</a></span>&gt;</span></span>&gt;</span>?</span> <span class="parameter-name">input</span>, </span><span class="parameter" id="cat-param-log"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/List-class.html">List</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="https://api.dart.dev/stable/2.14.3/dart-core/String-class.html">String</a></span>&gt;</span>?</span> <span class="parameter-name">log</span>, </span><span class="parameter" id="cat-param-showEnds"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">showEnds</span> = <span class="default-value">false</span>, </span><span class="parameter" id="cat-param-numberNonBlank"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">numberNonBlank</span> = <span class="default-value">false</span>, </span><span class="parameter" id="cat-param-showLineNumbers"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">showLineNumbers</span> = <span class="default-value">false</span>, </span><span class="parameter" id="cat-param-showTabs"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">showTabs</span> = <span class="default-value">false</span>, </span><span class="parameter" id="cat-param-squeezeBlank"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">squeezeBlank</span> = <span class="default-value">false</span>, </span><span class="parameter" id="cat-param-showNonPrinting"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.3/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">showNonPrinting</span> = <span class="default-value">false</span>}</span>)
<span class="returntype parameter">&#8594; <a href="https://api.dart.dev/stable/2.14.3/dart-async/Future-class.html">Future</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="../dcat/CatResult-class.html">CatResult</a></span>&gt;</span></span>
<span class="name"><a href="../dcat/cat.html">cat</a></span><span class="signature">(<wbr><span class="parameter" id="cat-param-paths"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/List-class.html">List</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="https://api.dart.dev/stable/2.14.4/dart-core/String-class.html">String</a></span>&gt;</span></span> <span class="parameter-name">paths</span>, </span><span class="parameter" id="cat-param-output"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-io/IOSink-class.html">IOSink</a></span> <span class="parameter-name">output</span>, </span><span class="parameter" id="cat-param-input">{<span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-async/Stream-class.html">Stream</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="https://api.dart.dev/stable/2.14.4/dart-core/List-class.html">List</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="https://api.dart.dev/stable/2.14.4/dart-core/int-class.html">int</a></span>&gt;</span></span>&gt;</span>?</span> <span class="parameter-name">input</span>, </span><span class="parameter" id="cat-param-showEnds"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">showEnds</span> = <span class="default-value">false</span>, </span><span class="parameter" id="cat-param-numberNonBlank"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">numberNonBlank</span> = <span class="default-value">false</span>, </span><span class="parameter" id="cat-param-showLineNumbers"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">showLineNumbers</span> = <span class="default-value">false</span>, </span><span class="parameter" id="cat-param-showTabs"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">showTabs</span> = <span class="default-value">false</span>, </span><span class="parameter" id="cat-param-squeezeBlank"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">squeezeBlank</span> = <span class="default-value">false</span>, </span><span class="parameter" id="cat-param-showNonPrinting"><span class="type-annotation"><a href="https://api.dart.dev/stable/2.14.4/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">showNonPrinting</span> = <span class="default-value">false</span>}</span>)
<span class="returntype parameter">&#8594; <a href="https://api.dart.dev/stable/2.14.4/dart-async/Future-class.html">Future</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="../dcat/CatResult-class.html">CatResult</a></span>&gt;</span></span>
</span>
</dt>
<dd>
Concatenates files in <code>paths</code> to <a href="https://api.dart.dev/stable/2.14.3/dart-io/stdout.html">stdout</a> or <a href="https://api.dart.dev/stable/2.14.3/dart-io/File-class.html">File</a>. <a href="../dcat/cat.html">[...]</a>
Concatenates files in <code>paths</code> to the standard output or a file. <a href="../dcat/cat.html">[...]</a>
</dd>

View file

@ -50,12 +50,15 @@
</h1></div>
<section class="multi-line-signature">
<a href="https://api.dart.dev/stable/2.14.3/dart-core/int-class.html">int</a>
<a href="https://api.dart.dev/stable/2.14.4/dart-core/int-class.html">int</a>
const <span class="name ">exitFailure</span>
</section>
<section class="desc markdown">
<p>Failure exit code.</p>
</section>
<section class="summary source-code" id="source">

View file

@ -50,12 +50,15 @@
</h1></div>
<section class="multi-line-signature">
<a href="https://api.dart.dev/stable/2.14.3/dart-core/int-class.html">int</a>
<a href="https://api.dart.dev/stable/2.14.4/dart-core/int-class.html">int</a>
const <span class="name ">exitSuccess</span>
</section>
<section class="desc markdown">
<p>Success exit code.</p>
</section>
<section class="summary source-code" id="source">

View file

@ -85,34 +85,36 @@ Examples:
<h2 id="library-usage">Library Usage</h2>
<pre class="language-dart"><code class="language-dart">import 'package:dcat/dcat.dart';
final result = await cat(['path/to/file', 'path/to/otherfile]'], File('path/to/outfile'));
if (result.exitCode == exitFailure) {
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");
}
}
</code></pre>
<p>The <code>cat</code> function supports the following parameters:</p>
<table><thead><tr><th style="text-align: left;">Parameter</th><th style="text-align: left;">Description</th><th style="text-align: left;">Type</th></tr></thead><tbody><tr><td style="text-align: left;">paths</td><td style="text-align: left;">The file paths.</td><td style="text-align: left;">String[]</td></tr><tr><td style="text-align: left;">output</td><td style="text-align: left;">The standard output or file.</td><td style="text-align: left;">IOSink or File</td></tr><tr><td style="text-align: left;">input</td><td style="text-align: left;">The standard input.</td><td style="text-align: left;">Stream&lt;List&lt;int&gt;&gt;?</td></tr><tr><td style="text-align: left;">log</td><td style="text-align: left;">The log for debugging.</td><td style="text-align: left;">List&lt;String&gt;?</td></tr><tr><td style="text-align: left;">showEnds</td><td style="text-align: left;">Same as <code>-e</code></td><td style="text-align: left;">bool</td></tr><tr><td style="text-align: left;">numberNonBlank</td><td style="text-align: left;">Same as <code>-b</code></td><td style="text-align: left;">bool</td></tr><tr><td style="text-align: left;">showLineNumbers</td><td style="text-align: left;">Same as <code>-n</code></td><td style="text-align: left;">bool</td></tr><tr><td style="text-align: left;">showTabs</td><td style="text-align: left;">Same as <code>-T</code></td><td style="text-align: left;">bool</td></tr><tr><td style="text-align: left;">squeezeBlank</td><td style="text-align: left;">Same as <code>-s</code></td><td style="text-align: left;">bool</td></tr><tr><td style="text-align: left;">showNonPrinting</td><td style="text-align: left;">Same as <code>-v</code></td><td style="text-align: left;">bool</td></tr></tbody></table>
<table><thead><tr><th style="text-align: left;">Parameter</th><th style="text-align: left;">Description</th><th style="text-align: left;">Type</th></tr></thead><tbody><tr><td style="text-align: left;">paths</td><td style="text-align: left;">The file paths.</td><td style="text-align: left;">String[]</td></tr><tr><td style="text-align: left;">output</td><td style="text-align: left;">The standard output or file.</td><td style="text-align: left;"><a href="https://api.dart.dev/dart-io/IOSink-class.html">IOSink</a></td></tr><tr><td style="text-align: left;">input</td><td style="text-align: left;">The standard input.</td><td style="text-align: left;">Stream&lt;List&lt;int&gt;&gt;?</td></tr><tr><td style="text-align: left;">showEnds</td><td style="text-align: left;">Same as <code>-e</code></td><td style="text-align: left;">bool</td></tr><tr><td style="text-align: left;">numberNonBlank</td><td style="text-align: left;">Same as <code>-b</code></td><td style="text-align: left;">bool</td></tr><tr><td style="text-align: left;">showLineNumbers</td><td style="text-align: left;">Same as <code>-n</code></td><td style="text-align: left;">bool</td></tr><tr><td style="text-align: left;">showTabs</td><td style="text-align: left;">Same as <code>-T</code></td><td style="text-align: left;">bool</td></tr><tr><td style="text-align: left;">squeezeBlank</td><td style="text-align: left;">Same as <code>-s</code></td><td style="text-align: left;">bool</td></tr><tr><td style="text-align: left;">showNonPrinting</td><td style="text-align: left;">Same as <code>-v</code></td><td style="text-align: left;">bool</td></tr></tbody></table>
<ul>
<li><code>paths</code> and <code>output</code> are required.</li>
<li><code>output</code> should be an <code>IOSink</code> like <code>stdout</code> or a <code>File</code>.</li>
<li><code>input</code> can be <code>stdin</code>.</li>
<li><code>log</code> is used for debugging/testing purposes.</li>
<li><code>output</code> should be an <a href="https://api.dart.dev/dart-io/IOSink-class.html">IOSink</a> like <code>stdout</code> or a <a href="https://api.dart.dev/dart-io/File/openWrite.html">File</a> stream.</li>
<li><code>input</code> can be <a href="https://api.dart.dev/dart-io/Stdin-class.html">stdin</a>.</li>
</ul>
<p>The remaining optional parameters are similar to the <a href="https://www.gnu.org/software/coreutils/manual/html_node/cat-invocation.html#cat-invocation">GNU cat</a> utility.</p>
<p>A <code>CatResult</code> object is returned which contains the <code>exitCode</code> (<code>exitSuccess</code> or <code>exitFailure</code>) and error <code>messages</code> if any:</p>
<pre class="language-dart"><code class="language-dart">final result = await cat(['path/to/file'], stdout);
if (result.exitCode == exitSuccess) {
...
} else {
for (final message in result.messages) {
stderr.writeln("Error: $message");
}
}
</code></pre>
<h2 id="differences-from-gnu-cathttpswwwgnuorgsoftwarecoreutilsmanualhtml_nodecat-invocationhtmlcat-invocation">Differences from <a href="https://www.gnu.org/software/coreutils/manual/html_node/cat-invocation.html#cat-invocation">GNU cat</a></h2>
<ul>
<li>No binary file support.</li>
<li>A line is considered terminated by either a <code>CR</code> (carriage return), a <code>LF</code> (line feed), a <code>CR+LF</code> sequence (DOS line ending).</li>
<li>A line ending is automatically appended to the last line of any read file.</li>
<li>The <code>U+</code> notation is used instead of <code>M-</code> for non-printing characters.</li>
<li>The <a href="https://en.wikipedia.org/wiki/Unicode">U+</a> notation is used instead of <code>M-</code> for non-printing characters.</li>
</ul>
</section>

View file

@ -1 +1 @@
[{"name":"dcat","qualifiedName":"dcat","href":"dcat/dcat-library.html","type":"library","overriddenDepth":0,"packageName":"dcat"},{"name":"CatResult","qualifiedName":"dcat.CatResult","href":"dcat/CatResult-class.html","type":"class","overriddenDepth":0,"packageName":"dcat","enclosedBy":{"name":"dcat","type":"library"}},{"name":"CatResult","qualifiedName":"dcat.CatResult.CatResult","href":"dcat/CatResult/CatResult.html","type":"constructor","overriddenDepth":0,"packageName":"dcat","enclosedBy":{"name":"CatResult","type":"class"}},{"name":"addMessage","qualifiedName":"dcat.CatResult.addMessage","href":"dcat/CatResult/addMessage.html","type":"method","overriddenDepth":0,"packageName":"dcat","enclosedBy":{"name":"CatResult","type":"class"}},{"name":"exitCode","qualifiedName":"dcat.CatResult.exitCode","href":"dcat/CatResult/exitCode.html","type":"property","overriddenDepth":0,"packageName":"dcat","enclosedBy":{"name":"CatResult","type":"class"}},{"name":"messages","qualifiedName":"dcat.CatResult.messages","href":"dcat/CatResult/messages.html","type":"property","overriddenDepth":0,"packageName":"dcat","enclosedBy":{"name":"CatResult","type":"class"}},{"name":"cat","qualifiedName":"dcat.cat","href":"dcat/cat.html","type":"function","overriddenDepth":0,"packageName":"dcat","enclosedBy":{"name":"dcat","type":"library"}},{"name":"exitFailure","qualifiedName":"dcat.exitFailure","href":"dcat/exitFailure-constant.html","type":"top-level constant","overriddenDepth":0,"packageName":"dcat","enclosedBy":{"name":"dcat","type":"library"}},{"name":"exitSuccess","qualifiedName":"dcat.exitSuccess","href":"dcat/exitSuccess-constant.html","type":"top-level constant","overriddenDepth":0,"packageName":"dcat","enclosedBy":{"name":"dcat","type":"library"}}]
[{"name":"dcat","qualifiedName":"dcat","href":"dcat/dcat-library.html","type":"library","overriddenDepth":0,"packageName":"dcat"},{"name":"CatResult","qualifiedName":"dcat.CatResult","href":"dcat/CatResult-class.html","type":"class","overriddenDepth":0,"packageName":"dcat","enclosedBy":{"name":"dcat","type":"library"}},{"name":"CatResult","qualifiedName":"dcat.CatResult.CatResult","href":"dcat/CatResult/CatResult.html","type":"constructor","overriddenDepth":0,"packageName":"dcat","enclosedBy":{"name":"CatResult","type":"class"}},{"name":"addMessage","qualifiedName":"dcat.CatResult.addMessage","href":"dcat/CatResult/addMessage.html","type":"method","overriddenDepth":0,"packageName":"dcat","enclosedBy":{"name":"CatResult","type":"class"}},{"name":"exitCode","qualifiedName":"dcat.CatResult.exitCode","href":"dcat/CatResult/exitCode.html","type":"property","overriddenDepth":0,"packageName":"dcat","enclosedBy":{"name":"CatResult","type":"class"}},{"name":"isFailure","qualifiedName":"dcat.CatResult.isFailure","href":"dcat/CatResult/isFailure.html","type":"property","overriddenDepth":0,"packageName":"dcat","enclosedBy":{"name":"CatResult","type":"class"}},{"name":"isSuccess","qualifiedName":"dcat.CatResult.isSuccess","href":"dcat/CatResult/isSuccess.html","type":"property","overriddenDepth":0,"packageName":"dcat","enclosedBy":{"name":"CatResult","type":"class"}},{"name":"messages","qualifiedName":"dcat.CatResult.messages","href":"dcat/CatResult/messages.html","type":"property","overriddenDepth":0,"packageName":"dcat","enclosedBy":{"name":"CatResult","type":"class"}},{"name":"cat","qualifiedName":"dcat.cat","href":"dcat/cat.html","type":"function","overriddenDepth":0,"packageName":"dcat","enclosedBy":{"name":"dcat","type":"library"}},{"name":"exitFailure","qualifiedName":"dcat.exitFailure","href":"dcat/exitFailure-constant.html","type":"top-level constant","overriddenDepth":0,"packageName":"dcat","enclosedBy":{"name":"dcat","type":"library"}},{"name":"exitSuccess","qualifiedName":"dcat.exitSuccess","href":"dcat/exitSuccess-constant.html","type":"top-level constant","overriddenDepth":0,"packageName":"dcat","enclosedBy":{"name":"dcat","type":"library"}}]