Made cat() a fully standalone library function.

This commit is contained in:
Erik C. Thauvin 2021-10-13 21:36:40 -07:00
parent 2f996bec48
commit e1b043c61f
19 changed files with 1182 additions and 271 deletions

View file

@ -0,0 +1,278 @@
<!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 CatResult class from the dcat library, for the Dart programming language.">
<title>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 class="self-crumb">CatResult class</li>
</ol>
<div class="self-name">CatResult</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-class">CatResult</span> class
<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 class="desc markdown">
<p>Holds the <a href="../dcat/cat.html">cat</a> result <a href="../dcat/CatResult/exitCode.html">exitCode</a> and error <a href="../dcat/CatResult/messages.html">messages</a>.</p>
</section>
<section class="summary offset-anchor" id="constructors">
<h2>Constructors</h2>
<dl class="constructor-summary-list">
<dt id="CatResult" class="callable">
<span class="name"><a href="../dcat/CatResult/CatResult.html">CatResult</a></span><span class="signature">()</span>
</dt>
<dd>
</dd>
</dl>
</section>
<section class="summary offset-anchor" id="instance-properties">
<h2>Properties</h2>
<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>
</dt>
<dd>
The exit code.
<div class="features">read / write</div>
</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>
</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>
<div class="features">read-only, inherited</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>
</dt>
<dd>
The error messages.
<div class="features">final</div>
</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>
</dt>
<dd class="inherited">
A representation of the runtime type of the object.
<div class="features">read-only, inherited</div>
</dd>
</dl>
</section>
<section class="summary offset-anchor" id="instance-methods">
<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="returntype parameter">&#8594; void</span>
</span>
</dt>
<dd>
Add a message.
</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="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>
<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>
</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>
<div class="features">inherited</div>
</dd>
</dl>
</section>
<section class="summary offset-anchor inherited" id="operators">
<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>
</dt>
<dd class="inherited">
The equality operator. <a href="https://api.dart.dev/stable/2.14.3/dart-core/Object/operator_equals.html">[...]</a>
<div class="features">inherited</div>
</dd>
</dl>
</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 class="self-crumb">CatResult class</li>
</ol>
<h5>dcat library</h5>
<ol>
<li class="section-title"><a href="../dcat/dcat-library.html#classes">Classes</a></li>
<li><a href="../dcat/CatResult-class.html">CatResult</a></li>
<li class="section-title"><a href="../dcat/dcat-library.html#constants">Constants</a></li>
<li><a href="../dcat/exitFailure-constant.html">exitFailure</a></li>
<li><a href="../dcat/exitSuccess-constant.html">exitSuccess</a></li>
<li class="section-title"><a href="../dcat/dcat-library.html#functions">Functions</a></li>
<li><a href="../dcat/cat.html">cat</a></li>
</ol>
</div>
<div id="dartdoc-sidebar-right" class="sidebar sidebar-offcanvas-right">
<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.3/dart-core/Object/hashCode.html">hashCode</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="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="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>
</ol>
</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,137 @@
<!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 CatResult constructor from the Class CatResult class from the dcat library, for the Dart programming language.">
<title>CatResult constructor - 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">CatResult constructor</li>
</ol>
<div class="self-name">CatResult</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-constructor">CatResult</span> constructor
<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 class="multi-line-signature">
<span class="name ">CatResult</span>(<wbr>)
</section>
<section class="summary source-code" id="source">
<h2><span>Implementation</span></h2>
<pre class="language-dart"><code class="language-dart">CatResult();</code></pre>
</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">CatResult constructor</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.3/dart-core/Object/hashCode.html">hashCode</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="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="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>
</ol>
</div><!--/.sidebar-offcanvas-left-->
<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,155 @@
<!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 addMessage method from the CatResult class, for the Dart programming language.">
<title>addMessage method - 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">addMessage method</li>
</ol>
<div class="self-name">addMessage</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-method">addMessage</span> method
<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 class="multi-line-signature">
<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>
</ol>)
</section>
<section class="desc markdown">
<p>Add a message.</p>
</section>
<section class="summary source-code" id="source">
<h2><span>Implementation</span></h2>
<pre class="language-dart"><code class="language-dart">void addMessage(int exitCode, String message, {String? path}) {
this.exitCode = exitCode;
if (path != null &amp;&amp; path.isNotEmpty) {
messages.add(&#39;$path: $message&#39;);
} else {
messages.add(message);
}
}</code></pre>
</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">addMessage method</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.3/dart-core/Object/hashCode.html">hashCode</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="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="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>
</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,143 @@
<!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 exitCode property from the CatResult class, for the Dart programming language.">
<title>exitCode 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">exitCode property</li>
</ol>
<div class="self-name">exitCode</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">exitCode</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 class="multi-line-signature">
<a href="https://api.dart.dev/stable/2.14.3/dart-core/int-class.html">int</a>
<span class="name ">exitCode</span>
<div class="features">read / write</div>
</section>
<section class="desc markdown">
<p>The exit code.</p>
</section>
<section class="summary source-code" id="source">
<h2><span>Implementation</span></h2>
<pre class="language-dart"><code class="language-dart">int exitCode = exitSuccess;
</code></pre>
</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">exitCode 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.3/dart-core/Object/hashCode.html">hashCode</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="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="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>
</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,143 @@
<!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 messages property from the CatResult class, for the Dart programming language.">
<title>messages 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">messages property</li>
</ol>
<div class="self-name">messages</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">messages</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 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>
<span class="name ">messages</span>
<div class="features">final</div>
</section>
<section class="desc markdown">
<p>The error messages.</p>
</section>
<section class="summary source-code" id="source">
<h2><span>Implementation</span></h2>
<pre class="language-dart"><code class="language-dart">final List&lt;String&gt; messages = [];
</code></pre>
</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">messages 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.3/dart-core/Object/hashCode.html">hashCode</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="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="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>
</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

@ -52,9 +52,10 @@
<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="https://api.dart.dev/stable/2.14.3/dart-core/int-class.html">int</a></span>&gt;</span></span>
<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-appName">{<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">appName</span> = <span class="default-value">&#39;&#39;</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>
@ -67,17 +68,21 @@
</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></p>
<p>The 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>.
Specify a <code>log</code> for debugging or testing purpose.</p>
<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>
<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>
</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>
<section class="summary source-code" id="source">
<h2><span>Implementation</span></h2>
<pre class="language-dart"><code class="language-dart">Future&lt;int&gt; cat(List&lt;String&gt; paths,
{String appName = &#39;&#39;,
<pre class="language-dart"><code class="language-dart">Future&lt;CatResult&gt; cat(List&lt;String&gt; paths, Object output,
{Stream&lt;List&lt;int&gt;&gt;? input,
List&lt;String&gt;? log,
bool showEnds = false,
bool numberNonBlank = false,
@ -85,19 +90,34 @@ Specify a <code>log</code> for debugging or testing purpose.</p>
bool showTabs = false,
bool squeezeBlank = false,
bool showNonPrinting = false}) async {
var result = CatResult();
var lineNumber = 1;
var returnCode = 0;
log?.clear();
if (paths.isEmpty) {
final lines = await _readStdin();
await _writeLines(lines, lineNumber, log, showEnds, showLineNumbers,
numberNonBlank, showTabs, squeezeBlank, showNonPrinting);
if (input != null) {
final lines = await _readStream(input);
try {
await _writeLines(
lines,
lineNumber,
output,
log,
showEnds,
showLineNumbers,
numberNonBlank,
showTabs,
squeezeBlank,
showNonPrinting);
} catch (e) {
result.addMessage(exitFailure, &#39;$e&#39;);
}
}
} else {
for (final path in paths) {
try {
final Stream&lt;String&gt; lines;
if (path == &#39;-&#39;) {
lines = await _readStdin();
if (path == &#39;-&#39; &amp;&amp; input != null) {
lines = await _readStream(input);
} else {
lines = utf8.decoder
.bind(File(path).openRead())
@ -106,6 +126,7 @@ Specify a <code>log</code> for debugging or testing purpose.</p>
lineNumber = await _writeLines(
lines,
lineNumber,
output,
log,
showEnds,
showLineNumbers,
@ -121,17 +142,16 @@ Specify a <code>log</code> for debugging or testing purpose.</p>
} else {
message = e.message;
}
returnCode = await printError(message, appName: appName, path: path);
result.addMessage(exitFailure, message, path: path);
} on FormatException {
returnCode = await printError(&#39;Binary file not supported.&#39;,
appName: appName, path: path);
result.addMessage(exitFailure, &#39;Binary file not supported.&#39;,
path: path);
} catch (e) {
returnCode =
await printError(e.toString(), appName: appName, path: path);
result.addMessage(exitFailure, &#39;$e&#39;, path: path);
}
}
}
return returnCode;
return result;
}</code></pre>
</section>
@ -154,6 +174,8 @@ Specify a <code>log</code> for debugging or testing purpose.</p>
<h5>dcat library</h5>
<ol>
<li class="section-title"><a href="../dcat/dcat-library.html#classes">Classes</a></li>
<li><a href="../dcat/CatResult-class.html">CatResult</a></li>
@ -164,7 +186,6 @@ Specify a <code>log</code> for debugging or testing purpose.</p>
<li class="section-title"><a href="../dcat/dcat-library.html#functions">Functions</a></li>
<li><a href="../dcat/cat.html">cat</a></li>
<li><a href="../dcat/printError.html">printError</a></li>

View file

@ -50,10 +50,24 @@
<section class="desc markdown">
<p>Library to concatenate file(s) to standard output,</p>
<p>A library to concatenate files to standard output or file.</p>
</section>
<section class="summary offset-anchor" id="classes">
<h2>Classes</h2>
<dl>
<dt id="CatResult">
<span class="name "><a href="../dcat/CatResult-class.html">CatResult</a></span>
</dt>
<dd>
Holds the <a href="../dcat/cat.html">cat</a> result <a href="../dcat/CatResult/exitCode.html">exitCode</a> and error <a href="../dcat/CatResult/messages.html">messages</a>.
</dd>
</dl>
</section>
@ -100,27 +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-appName">{<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">appName</span> = <span class="default-value">&#39;&#39;</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="https://api.dart.dev/stable/2.14.3/dart-core/int-class.html">int</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.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>
</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> <a href="../dcat/cat.html">[...]</a>
</dd>
<dt id="printError" class="callable">
<span class="name"><a href="../dcat/printError.html">printError</a></span><span class="signature">(<wbr><span class="parameter" id="printError-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="printError-param-appName">{<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">appName</span> = <span class="default-value">&#39;&#39;</span>, </span><span class="parameter" id="printError-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 class="default-value">&#39;&#39;</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="https://api.dart.dev/stable/2.14.3/dart-core/int-class.html">int</a></span>&gt;</span></span>
</span>
</dt>
<dd>
Prints the <code>appName</code>, <code>path</code> and error <code>message</code> to <a href="https://api.dart.dev/stable/2.14.3/dart-io/stderr.html">stderr</a>.
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>
</dd>
@ -157,6 +158,8 @@
<div id="dartdoc-sidebar-right" class="sidebar sidebar-offcanvas-right">
<h5>dcat library</h5>
<ol>
<li class="section-title"><a href="../dcat/dcat-library.html#classes">Classes</a></li>
<li><a href="../dcat/CatResult-class.html">CatResult</a></li>
@ -167,7 +170,6 @@
<li class="section-title"><a href="../dcat/dcat-library.html#functions">Functions</a></li>
<li><a href="../dcat/cat.html">cat</a></li>
<li><a href="../dcat/printError.html">printError</a></li>

View file

@ -83,6 +83,8 @@
<h5>dcat library</h5>
<ol>
<li class="section-title"><a href="../dcat/dcat-library.html#classes">Classes</a></li>
<li><a href="../dcat/CatResult-class.html">CatResult</a></li>
@ -93,7 +95,6 @@
<li class="section-title"><a href="../dcat/dcat-library.html#functions">Functions</a></li>
<li><a href="../dcat/cat.html">cat</a></li>
<li><a href="../dcat/printError.html">printError</a></li>

View file

@ -83,6 +83,8 @@
<h5>dcat library</h5>
<ol>
<li class="section-title"><a href="../dcat/dcat-library.html#classes">Classes</a></li>
<li><a href="../dcat/CatResult-class.html">CatResult</a></li>
@ -93,7 +95,6 @@
<li class="section-title"><a href="../dcat/dcat-library.html#functions">Functions</a></li>
<li><a href="../dcat/cat.html">cat</a></li>
<li><a href="../dcat/printError.html">printError</a></li>

View file

@ -1,145 +0,0 @@
<!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 printError function from the dcat library, for the Dart programming language.">
<title>printError function - 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 class="self-crumb">printError function</li>
</ol>
<div class="self-name">printError</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-function">printError</span> function
<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 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="https://api.dart.dev/stable/2.14.3/dart-core/int-class.html">int</a></span>&gt;</span></span>
<span class="name ">printError</span>(<wbr><ol class="parameter-list"><li><span class="parameter" id="printError-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="printError-param-appName">{<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">appName</span> = <span class="default-value">&#39;&#39;</span>, </span></li>
<li><span class="parameter" id="printError-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 class="default-value">&#39;&#39;</span>}</span></li>
</ol>)
</section>
<section class="desc markdown">
<p>Prints the <code>appName</code>, <code>path</code> and error <code>message</code> to <a href="https://api.dart.dev/stable/2.14.3/dart-io/stderr.html">stderr</a>.</p>
</section>
<section class="summary source-code" id="source">
<h2><span>Implementation</span></h2>
<pre class="language-dart"><code class="language-dart">Future&lt;int&gt; printError(String message,
{String appName = &#39;&#39;, String path = &#39;&#39;}) async {
if (appName.isNotEmpty) {
stderr.write(&#39;$appName: &#39;);
}
if (path.isNotEmpty) {
stderr.write(&#39;$path: &#39;);
}
stderr.writeln(message);
return exitFailure;
}</code></pre>
</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 class="self-crumb">printError function</li>
</ol>
<h5>dcat library</h5>
<ol>
<li class="section-title"><a href="../dcat/dcat-library.html#constants">Constants</a></li>
<li><a href="../dcat/exitFailure-constant.html">exitFailure</a></li>
<li><a href="../dcat/exitSuccess-constant.html">exitSuccess</a></li>
<li class="section-title"><a href="../dcat/dcat-library.html#functions">Functions</a></li>
<li><a href="../dcat/cat.html">cat</a></li>
<li><a href="../dcat/printError.html">printError</a></li>
</ol>
</div><!--/.sidebar-offcanvas-left-->
<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

@ -45,11 +45,12 @@
<section class="desc markdown">
<p><a href="http://opensource.org/licenses/BSD-3-Clause"><img src="https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square" alt="License (3-Clause BSD)"></a>
<a href="https://github.com/ethauvin/dcat/actions/workflows/dart.yml"><img src="https://github.com/ethauvin/dcat/actions/workflows/dart.yml/badge.svg" alt="GitHub CI"></a></p>
<h1 id="dcat-concatenate-files-to-standard-output">dcat: Concatenate File(s) to Standard Output</h1>
<p>A <strong>cat</strong> command-line implementation in <a href="https://dart.dev/">Dart</a>, inspired by the <a href="https://dart.dev/tutorials/server/cmdline">Write command-line apps sample code</a>.</p>
<a href="https://github.com/ethauvin/dcat/actions/workflows/dart.yml"><img src="https://github.com/ethauvin/dcat/actions/workflows/dart.yml/badge.svg" alt="GitHub CI"></a>
<a href="https://codecov.io/gh/ethauvin/dcat"><img src="https://codecov.io/gh/ethauvin/dcat/branch/master/graph/badge.svg?token=9PC4K4IZXJ" alt="codecov"></a></p>
<h1 id="dcat-concatenate-files-to-standard-output-or-file">dcat: Concatenate File(s) to Standard Output or File</h1>
<p>A <strong>cat</strong> command-line and library implementation in <a href="https://dart.dev/">Dart</a>, inspired by the <a href="https://dart.dev/tutorials/server/cmdline">Write command-line apps sample code</a>.</p>
<h2 id="synopsis">Synopsis</h2>
<p><strong>dcat</strong> copies each file, or standard input if none are given, to standard output.</p>
<p><strong>dcat</strong> copies each file, or standard input if none are given, to standard output or file.</p>
<h2 id="command-line-usage">Command-Line Usage</h2>
<pre class="language-sh"><code class="language-sh">dcat --help
</code></pre>
@ -81,6 +82,31 @@ Examples:
<h3 id="windows">Windows</h3>
<pre class="language-cmd"><code class="language-cmd">dart compile exe bin/dcat.dart
</code></pre>
<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) {
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>
<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>
</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) {
...
}
</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>
@ -98,7 +124,7 @@ Examples:
<span class="name"><a href="dcat/dcat-library.html">dcat</a></span>
</dt>
<dd>Library to concatenate file(s) to standard output,
<dd>A library to concatenate files to standard output or file.
</dd>
</dl>

View file

@ -1 +1 @@
[{"name":"dcat","qualifiedName":"dcat","href":"dcat/dcat-library.html","type":"library","overriddenDepth":0,"packageName":"dcat"},{"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":"printError","qualifiedName":"dcat.printError","href":"dcat/printError.html","type":"function","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":"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"}}]