Added generated doc.

This commit is contained in:
Erik C. Thauvin 2021-10-10 00:58:57 -07:00
parent a29d8130a9
commit 4948aaa970
18 changed files with 3605 additions and 6 deletions

View file

@ -1,9 +1,9 @@
[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](http://opensource.org/licenses/BSD-3-Clause)
[![GitHub CI](https://github.com/ethauvin/dcat/actions/workflows/dart.yml/badge.svg)](https://github.com/ethauvin/dcat/actions/workflows/dart.yml)
# dcat: Concatenate file(s) to standard output.
# dcat: Concatenate File(s) to Standard Output
A **cat** command-line implemenation in [Dart](https://dart.dev/), loosely based on the [Write command-line apps sample code](https://dart.dev/tutorials/server/cmdline).
A **cat** command-line implemenation in [Dart](https://dart.dev/), inspired by the [Write command-line apps sample code](https://dart.dev/tutorials/server/cmdline).
## Command-Line Usage
@ -30,16 +30,16 @@ Examples:
```
## Compile Application
### Linux
### *nix
```sh
dart compile exe -o bin/dcat bin/dcat.dart
```
### Windows
```cmd
dart compile.exe bin/dcat.dart
dart compile exe bin/dcat.dart
```
## Differences from GNU cat
## Differences from [GNU cat](https://www.gnu.org/software/coreutils/manual/html_node/cat-invocation.html#cat-invocation)
- No binary file support.
- Line numbers are printed as `X:` where `X` is the line number.
- Line numbers are printed as `X:` where `X` is the line number.

103
doc/api/__404error.html Normal file
View file

@ -0,0 +1,103 @@
<!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="generator" content="made with love by dartdoc 4.0.0">
<meta name="description" content="dcat API docs, for the Dart programming language.">
<title>dcat - Dart API docs</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="https://github.com/ethauvin/dcat">dcat package</a></li>
</ol>
<div class="self-name">dcat</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">
<h1>404: Something's gone wrong :-(</h1>
<section class="desc">
<p>You've tried to visit a page that doesn't exist. Luckily this site
has other <a href="index.html">pages</a>.</p>
<p>If you were looking for something specific, try searching:
<form class="search-body" role="search">
<input type="text" id="search-body" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
</form>
</p>
</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="https://github.com/ethauvin/dcat">dcat package</a></li>
</ol>
<h5><span class="package-name">dcat</span> <span class="package-kind">package</span></h5>
<ol>
<li class="section-title">Libraries</li>
<li><a href="dcat/dcat-library.html">dcat</a></li>
</ol>
</div>
<div id="dartdoc-sidebar-right" class="sidebar sidebar-offcanvas-right">
</div>
</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>

1
doc/api/categories.json Normal file
View file

@ -0,0 +1 @@
[]

186
doc/api/dcat/cat.html Normal file
View file

@ -0,0 +1,186 @@
<!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 cat function from the dcat library, for the Dart programming language.">
<title>cat 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">cat function</li>
</ol>
<div class="self-name">cat</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">cat</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 ">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-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>
</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></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 purpose.</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,
{List&lt;String&gt;? log,
bool showEnds = false,
bool numberNonBlank = false,
bool showLineNumbers = false,
bool showTabs = false,
bool squeezeBlank = false}) async {
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);
} else {
for (final path in paths) {
try {
final Stream&lt;String&gt; lines;
if (path == &#39;-&#39;) {
lines = await _readStdin();
} else {
lines = utf8.decoder
.bind(File(path).openRead())
.transform(const LineSplitter());
}
lineNumber = await _writeLines(lines, lineNumber, log, showEnds,
showLineNumbers, numberNonBlank, showTabs, squeezeBlank);
} on FileSystemException catch (e) {
final String? osMessage = e.osError?.message;
final String message;
if (osMessage != null &amp;&amp; osMessage.isNotEmpty) {
message = osMessage;
} else {
message = e.message;
}
returnCode = await printError(message, path: path);
} on FormatException {
returnCode = await printError(&#39;Binary file not supported.&#39;, path: path);
} catch (e) {
returnCode = await printError(e.toString(), path: path);
}
}
}
return returnCode;
}</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">cat 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><a href="../dcat/libName-constant.html">libName</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

@ -0,0 +1,212 @@
<!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="dcat library API docs, for the Dart programming language.">
<title>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 class="self-crumb">dcat library</li>
</ol>
<div class="self-name">dcat</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-library">dcat</span> library
<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="summary offset-anchor" id="constants">
<h2>Constants</h2>
<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>
</dt>
<dd>
<div>
<span class="signature"><code>1</code></span>
</div>
</dd>
<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>
</dt>
<dd>
<div>
<span class="signature"><code>0</code></span>
</div>
</dd>
<dt id="libName" class="constant">
<span class="name "><a href="../dcat/libName-constant.html">libName</a></span>
<span class="signature">&#8594; const <a href="https://api.dart.dev/stable/2.14.3/dart-core/String-class.html">String</a></span>
</dt>
<dd>
<div>
<span class="signature"><code>&#39;dcat&#39;</code></span>
</div>
</dd>
</dl>
</section>
<section class="summary offset-anchor" id="functions">
<h2>Functions</h2>
<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-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="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>
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">libName</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>.
</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 class="self-crumb">dcat library</li>
</ol>
<h5><span class="package-name">dcat</span> <span class="package-kind">package</span></h5>
<ol>
<li class="section-title">Libraries</li>
<li><a href="../dcat/dcat-library.html">dcat</a></li>
</ol>
</div>
<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#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><a href="../dcat/libName-constant.html">libName</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-right-->
</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,129 @@
<!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 exitFailure constant from the dcat library, for the Dart programming language.">
<title>exitFailure constant - 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">exitFailure constant</li>
</ol>
<div class="self-name">exitFailure</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-top-level-property">exitFailure</span> top-level constant
<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>
const <span class="name ">exitFailure</span>
</section>
<section class="summary source-code" id="source">
<h2><span>Implementation</span></h2>
<pre class="language-dart"><code class="language-dart">const exitFailure = 1;</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">exitFailure constant</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><a href="../dcat/libName-constant.html">libName</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

@ -0,0 +1,129 @@
<!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 exitSuccess constant from the dcat library, for the Dart programming language.">
<title>exitSuccess constant - 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">exitSuccess constant</li>
</ol>
<div class="self-name">exitSuccess</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-top-level-property">exitSuccess</span> top-level constant
<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>
const <span class="name ">exitSuccess</span>
</section>
<section class="summary source-code" id="source">
<h2><span>Implementation</span></h2>
<pre class="language-dart"><code class="language-dart">const exitSuccess = 0;</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">exitSuccess constant</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><a href="../dcat/libName-constant.html">libName</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

@ -0,0 +1,129 @@
<!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 libName constant from the dcat library, for the Dart programming language.">
<title>libName constant - 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">libName constant</li>
</ol>
<div class="self-name">libName</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-top-level-property">libName</span> top-level constant
<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/String-class.html">String</a>
const <span class="name ">libName</span>
</section>
<section class="summary source-code" id="source">
<h2><span>Implementation</span></h2>
<pre class="language-dart"><code class="language-dart">const libName = &#39;dcat&#39;;</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">libName constant</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><a href="../dcat/libName-constant.html">libName</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

@ -0,0 +1,144 @@
<!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">libName</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 = libName, String path = &#39;&#39;}) async {
if (path.isNotEmpty) {
stderr.writeln(&#39;$libName: $path: $message&#39;);
} else {
stderr.write(&#39;$libName: $message&#39;);
}
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><a href="../dcat/libName-constant.html">libName</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>

145
doc/api/index.html Normal file
View file

@ -0,0 +1,145 @@
<!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="generator" content="made with love by dartdoc 4.0.0">
<meta name="description" content="dcat API docs, for the Dart programming language.">
<title>dcat - Dart API docs</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="https://github.com/ethauvin/dcat">dcat package</a></li>
</ol>
<div class="self-name">dcat</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">
<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 implemenation 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="command-line-usage">Command-Line Usage</h2>
<pre class="language-sh"><code class="language-sh">dcat --help
</code></pre>
<pre class="language-dart"><code>Usage: dcat [OPTION]... [FILE]...
Concatenate FILE(s) to standard output.
With no FILE, or when FILE is -, read standard input.
-b, --number-nonblank number nonempty output lines, overrides -n
-E, --show-ends display $ at end of each line
-h, --help display this help and exit
-n, --number number all output lines
-T, --show-tabs display TAB characters as ^I
-s, --squeeze-blank suppress repeated empty output lines
--version output version information and exit
Examples:
dcat f - g Output f's contents, then standard input, then g's contents.
dcat Copy standard input to standard output.
</code></pre>
<h2 id="compile-application">Compile Application</h2>
<h3 id="nix">*nix</h3>
<pre class="language-sh"><code class="language-sh">dart compile exe -o bin/dcat bin/dcat.dart
</code></pre>
<h3 id="windows">Windows</h3>
<pre class="language-cmd"><code class="language-cmd">dart compile exe bin/dcat.dart
</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>Line numbers are printed as <code>X:</code> where <code>X</code> is the line number.</li>
</ul>
</section>
<section class="summary">
<h2>Libraries</h2>
<dl>
<dt id="dcat">
<span class="name"><a href="dcat/dcat-library.html">dcat</a></span>
</dt>
<dd>
</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="https://github.com/ethauvin/dcat">dcat package</a></li>
</ol>
<h5 class="hidden-xs"><span class="package-name">dcat</span> <span class="package-kind">package</span></h5>
<ol>
<li class="section-title">Libraries</li>
<li><a href="dcat/dcat-library.html">dcat</a></li>
</ol>
</div>
<div id="dartdoc-sidebar-right" class="sidebar sidebar-offcanvas-right">
</div>
</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>

1
doc/api/index.json Normal file
View file

@ -0,0 +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":"libName","qualifiedName":"dcat.libName","href":"dcat/libName-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"}}]

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -0,0 +1,99 @@
/*
github.com style (c) Vasily Polovnyov <vast@whiteants.net>
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
color: #333;
background: #f8f8f8;
}
.hljs-comment,
.hljs-quote {
color: #998;
font-style: italic;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-subst {
color: #333;
font-weight: bold;
}
.hljs-number,
.hljs-literal,
.hljs-variable,
.hljs-template-variable,
.hljs-tag .hljs-attr {
color: #008080;
}
.hljs-string,
.hljs-doctag {
color: #d14;
}
.hljs-title,
.hljs-section,
.hljs-selector-id {
color: #900;
font-weight: bold;
}
.hljs-subst {
font-weight: normal;
}
.hljs-type,
.hljs-class .hljs-title {
color: #458;
font-weight: bold;
}
.hljs-tag,
.hljs-name,
.hljs-attribute {
color: #000080;
font-weight: normal;
}
.hljs-regexp,
.hljs-link {
color: #009926;
}
.hljs-symbol,
.hljs-bullet {
color: #990073;
}
.hljs-built_in,
.hljs-builtin-name {
color: #0086b3;
}
.hljs-meta {
color: #999;
font-weight: bold;
}
.hljs-deletion {
background: #fdd;
}
.hljs-addition {
background: #dfd;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="68" height="68" viewBox="0 0 17.992 17.992"><path d="M17.992 8.996A8.996 8.996 0 1 0 0 8.996a8.996 8.996 0 0 0 17.992 0m-2.23 0l-9.895 5.713V3.282l9.896 5.714h2.229z" fill-opacity=".198"/><path d="M15.763 8.996l-9.896 5.713V3.283z" fill="#7d7d7d" fill-opacity=".821"/></svg>

After

Width:  |  Height:  |  Size: 321 B

View file

@ -0,0 +1,22 @@
# highlight.js
Generated from https://highlightjs.org/download/ on 2021-07-13
**Included languages:**
* bash
* c
* css
* dart
* diff
* html, xml
* java
* javascript
* json
* kotlin
* markdown
* objective-c
* plaintext
* shell
* swift
* yaml

View file

@ -0,0 +1,501 @@
/*
*
* Update script.js versions in all lib/templates when modifying this file!
*
*/
function initSideNav() {
const leftNavToggle = document.getElementById('sidenav-left-toggle');
const leftDrawer = document.querySelector('.sidebar-offcanvas-left');
const overlay = document.getElementById('overlay-under-drawer');
function toggleBoth() {
if (leftDrawer) {
leftDrawer.classList.toggle('active');
}
if (overlay) {
overlay.classList.toggle('active');
}
}
if (overlay) {
overlay.addEventListener('click', toggleBoth);
}
if (leftNavToggle) {
leftNavToggle.addEventListener('click', toggleBoth);
}
}
function saveLeftScroll() {
const leftSidebar = document.getElementById('dartdoc-sidebar-left');
sessionStorage.setItem('dartdoc-sidebar-left-scrollt' + window.location.pathname, leftSidebar.scrollTop.toString());
sessionStorage.setItem('dartdoc-sidebar-left-scrolll' + window.location.pathname, leftSidebar.scrollLeft.toString());
}
function saveMainContentScroll() {
const mainContent = document.getElementById('dartdoc-main-content');
sessionStorage.setItem('dartdoc-main-content-scrollt' + window.location.pathname, mainContent.scrollTop.toString());
sessionStorage.setItem('dartdoc-main-content-scrolll' + window.location.pathname, mainContent.scrollLeft.toString());
}
function saveRightScroll() {
const rightSidebar = document.getElementById('dartdoc-sidebar-right');
sessionStorage.setItem('dartdoc-sidebar-right-scrollt' + window.location.pathname, rightSidebar.scrollTop.toString());
sessionStorage.setItem('dartdoc-sidebar-right-scrolll' + window.location.pathname, rightSidebar.scrollLeft.toString());
}
function restoreScrolls() {
const leftSidebar = document.getElementById('dartdoc-sidebar-left');
const mainContent = document.getElementById('dartdoc-main-content');
const rightSidebar = document.getElementById('dartdoc-sidebar-right');
try {
const leftSidebarX = sessionStorage.getItem('dartdoc-sidebar-left-scrolll' + window.location.pathname);
const leftSidebarY = sessionStorage.getItem('dartdoc-sidebar-left-scrollt' + window.location.pathname);
const mainContentX = sessionStorage.getItem('dartdoc-main-content-scrolll' + window.location.pathname);
const mainContentY = sessionStorage.getItem('dartdoc-main-content-scrollt' + window.location.pathname);
const rightSidebarX = sessionStorage.getItem('dartdoc-sidebar-right-scrolll' + window.location.pathname);
const rightSidebarY = sessionStorage.getItem('dartdoc-sidebar-right-scrollt' + window.location.pathname);
leftSidebar.scrollTo(parseFloat(leftSidebarX), parseFloat(leftSidebarY));
mainContent.scrollTo(parseFloat(mainContentX), parseFloat(mainContentY));
rightSidebar.scrollTo(parseFloat(rightSidebarX), parseFloat(rightSidebarY));
} finally {
// Set visibility to visible after scroll to prevent the brief appearance of the
// panel in the wrong position.
leftSidebar.style.visibility = 'visible';
mainContent.style.visibility = 'visible';
rightSidebar.style.visibility = 'visible';
}
}
function initScrollSave() {
const leftSidebar = document.getElementById('dartdoc-sidebar-left');
const mainContent = document.getElementById('dartdoc-main-content');
const rightSidebar = document.getElementById('dartdoc-sidebar-right');
leftSidebar.addEventListener("scroll", saveLeftScroll, true);
mainContent.addEventListener("scroll", saveMainContentScroll, true);
rightSidebar.addEventListener("scroll", saveRightScroll, true);
}
const weights = {
'library' : 2,
'class' : 2,
'mixin' : 3,
'extension' : 3,
'typedef' : 3,
'method' : 4,
'accessor' : 4,
'operator' : 4,
'constant' : 4,
'property' : 4,
'constructor' : 4
};
function findMatches(index, query) {
if (query === '') {
return [];
}
const allMatches = [];
index.forEach(element => {
function score(value) {
value -= element.overriddenDepth * 10;
const weightFactor = weights[element.type] || 4;
allMatches.push({element: element, score: (value / weightFactor) >> 0});
}
const name = element.name;
const qualifiedName = element.qualifiedName;
const lowerName = name.toLowerCase();
const lowerQualifiedName = qualifiedName.toLowerCase();
const lowerQuery = query.toLowerCase();
if (name === query || qualifiedName === query || name === `dart:${query}`) {
score(2000);
} else if (lowerName === `dart:${lowerQuery}`) {
score(1800);
} else if (lowerName === lowerQuery || lowerQualifiedName === lowerQuery) {
score(1700);
} else if (query.length > 1) {
if (name.startsWith(query) || qualifiedName.startsWith(query)) {
score(750);
} else if (lowerName.startsWith(lowerQuery) || lowerQualifiedName.startsWith(lowerQuery)) {
score(650);
} else if (name.includes(query) || qualifiedName.includes(query)) {
score(500);
} else if (lowerName.includes(lowerQuery) || lowerQualifiedName.includes(query)) {
score(400);
}
}
});
allMatches.sort((a, b) => {
const x = b.score - a.score;
if (x === 0) {
return a.element.name.length - b.element.name.length;
}
return x;
});
const justElements = [];
for (let i = 0; i < allMatches.length; i++) {
justElements.push(allMatches[i].element);
}
return justElements;
}
let baseHref = '';
const minLength = 1;
const suggestionLimit = 10;
function initializeSearch(input, index) {
input.disabled = false;
input.setAttribute('placeholder', 'Search API Docs');
// Handle grabbing focus when the users types / outside of the input
document.addEventListener('keypress', (event) => {
if (event.code === 'Slash' && !(document.activeElement instanceof HTMLInputElement)) {
event.preventDefault();
input.focus();
}
});
// Prepare elements
const parentForm = input.parentNode;
const wrapper = document.createElement('div');
wrapper.classList.add('tt-wrapper');
parentForm.replaceChild(wrapper, input);
const inputHint = document.createElement('input');
inputHint.setAttribute('type', 'text');
inputHint.setAttribute('autocomplete', 'off');
inputHint.setAttribute('readonly', 'true');
inputHint.setAttribute('spellcheck', 'false');
inputHint.setAttribute('tabindex', '-1');
inputHint.classList.add('typeahead', 'tt-hint');
wrapper.appendChild(inputHint);
input.setAttribute('autocomplete', 'off');
input.setAttribute('spellcheck', 'false');
input.classList.add('tt-input');
wrapper.appendChild(input);
const listBox = document.createElement('div');
listBox.setAttribute('role', 'listbox');
listBox.setAttribute('aria-expanded', 'false');
listBox.style.display = 'none';
listBox.classList.add('tt-menu');
const presentation = document.createElement('div');
presentation.classList.add('tt-elements');
listBox.appendChild(presentation);
wrapper.appendChild(listBox);
// Set up various search functionality
function highlight(text, query) {
query = query.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
return text.replace(new RegExp(query, 'gi'), (matched) => {
return `<strong class='tt-highlight'>${matched}</strong>`;
});
}
function createSuggestion(query, match) {
const suggestion = document.createElement('div');
suggestion.setAttribute('data-href', match.href);
suggestion.classList.add('tt-suggestion');
const suggestionTitle = document.createElement('span');
suggestionTitle.classList.add('tt-suggestion-title');
suggestionTitle.innerHTML = highlight(`${match.name} ${match.type.toLowerCase()}`, query);
suggestion.appendChild(suggestionTitle);
if (match.enclosedBy) {
const fromLib = document.createElement('div');
fromLib.classList.add('search-from-lib');
fromLib.innerHTML = `from ${highlight(match.enclosedBy.name, query)}`;
suggestion.appendChild(fromLib);
}
suggestion.addEventListener('mousedown', event => {
event.preventDefault();
});
suggestion.addEventListener('click', event => {
if (match.href) {
window.location = baseHref + match.href;
event.preventDefault();
}
});
return suggestion;
}
let storedValue = null;
let actualValue = '';
let hint = null;
let suggestionElements = [];
let suggestionsInfo = [];
let selectedElement = null;
function setHint(value) {
hint = value;
inputHint.value = value || '';
}
function updateSuggestions(query, suggestions) {
suggestionsInfo = [];
suggestionElements = [];
presentation.textContent = '';
if (suggestions.length < minLength) {
setHint(null)
hideSuggestions();
return;
}
for (let i = 0; i < suggestions.length; i++) {
const element = createSuggestion(query, suggestions[i]);
suggestionElements.push(element);
presentation.appendChild(element);
}
suggestionsInfo = suggestions;
setHint(query + suggestions[0].name.slice(query.length));
selectedElement = null;
showSuggestions();
}
function handle(newValue, forceUpdate) {
if (actualValue === newValue && !forceUpdate) {
return;
}
if (newValue === null || newValue.length === 0) {
updateSuggestions('', []);
return;
}
const suggestions = findMatches(index, newValue).slice(0, suggestionLimit);
actualValue = newValue;
updateSuggestions(newValue, suggestions);
}
function showSuggestions() {
if (presentation.hasChildNodes()) {
listBox.style.display = 'block';
listBox.setAttribute('aria-expanded', 'true');
}
}
function hideSuggestions() {
listBox.style.display = 'none';
listBox.setAttribute('aria-expanded', 'false');
}
// Hook up events
input.addEventListener('focus', () => {
handle(input.value, true);
});
input.addEventListener('blur', () => {
selectedElement = null;
if (storedValue !== null) {
input.value = storedValue;
storedValue = null;
}
hideSuggestions();
setHint(null);
});
input.addEventListener('input', event => {
handle(event.target.value);
});
input.addEventListener('keydown', event => {
if (suggestionElements.length === 0) {
return;
}
if (event.code === 'Enter') {
const selectingElement = selectedElement || 0;
const href = suggestionElements[selectingElement].dataset.href;
if (href) {
window.location = baseHref + href;
}
return;
}
if (event.code === 'Tab') {
if (selectedElement === null) {
// The user wants to fill the field with the hint
if (hint !== null) {
input.value = hint;
handle(hint);
event.preventDefault();
}
} else {
// The user wants to fill the input field with their currently selected suggestion
handle(suggestionsInfo[selectedElement].name);
storedValue = null;
selectedElement = null;
event.preventDefault();
}
return;
}
const lastIndex = suggestionElements.length - 1;
const previousSelectedElement = selectedElement;
if (event.code === 'ArrowUp') {
if (selectedElement === null) {
selectedElement = lastIndex;
} else if (selectedElement === 0) {
selectedElement = null;
} else {
selectedElement--;
}
} else if (event.code === 'ArrowDown') {
if (selectedElement === null) {
selectedElement = 0;
} else if (selectedElement === lastIndex) {
selectedElement = null;
} else {
selectedElement++;
}
} else {
if (storedValue !== null) {
storedValue = null;
handle(input.value);
}
return;
}
if (previousSelectedElement !== null) {
suggestionElements[previousSelectedElement].classList.remove('tt-cursor');
}
if (selectedElement !== null) {
const selected = suggestionElements[selectedElement];
selected.classList.add('tt-cursor');
// Guarantee the selected element is visible
if (selectedElement === 0) {
listBox.scrollTop = 0;
} else if (selectedElement === lastIndex) {
listBox.scrollTop = listBox.scrollHeight;
} else {
const offsetTop = selected.offsetTop;
const parentOffsetHeight = listBox.offsetHeight;
if (offsetTop < parentOffsetHeight || parentOffsetHeight < (offsetTop + selected.offsetHeight)) {
selected.scrollIntoView({behavior: 'auto', block: 'nearest'});
}
}
if (storedValue === null) {
// Store the actual input value to display their currently selected item
storedValue = input.value;
}
input.value = suggestionsInfo[selectedElement].name;
setHint('');
} else if (storedValue !== null && previousSelectedElement !== null) {
// They are moving back to the input field, so return the stored value
input.value = storedValue;
setHint(storedValue + suggestionsInfo[0].name.slice(storedValue.length));
storedValue = null;
}
event.preventDefault();
});
}
document.addEventListener('DOMContentLoaded', () => {
// Place this first so that unexpected exceptions in other JavaScript do not block page visibility.
restoreScrolls();
hljs.highlightAll();
initSideNav();
initScrollSave();
const searchBox = document.getElementById('search-box');
const searchBody = document.getElementById('search-body');
const searchSidebar = document.getElementById('search-sidebar');
if (document.body.getAttribute('data-using-base-href') === 'false') {
// If dartdoc did not add a base-href tag, we will need to add the relative
// path ourselves.
baseHref = document.body.getAttribute('data-base-href');
}
function disableSearch() {
console.log('Could not activate search functionality.');
if (searchBox) {
searchBox.placeholder = 'Failed to initialize search';
}
if (searchBody) {
searchBody.placeholder = 'Failed to initialize search';
}
if (searchSidebar) {
searchSidebar.placeholder = 'Failed to initialize search';
}
}
if ('fetch' in window) {
fetch(baseHref + 'index.json', {method: 'GET'})
.then(response => response.json())
.then(index => {
// Handle if the user specified a `search` parameter in the URL
if ('URLSearchParams' in window) {
const search = new URLSearchParams(window.location.search).get('search');
if (search) {
const matches = findMatches(search);
if (matches.length !== 0) {
window.location = baseHref + matches[0].href;
return;
}
}
}
// Initialize all three search fields
if (searchBox) {
initializeSearch(searchBox, index);
}
if (searchBody) {
initializeSearch(searchBody, index);
}
if (searchSidebar) {
initializeSearch(searchSidebar, index);
}
})
.catch(() => {
disableSearch();
});
} else {
disableSearch();
}
});

File diff suppressed because it is too large Load diff