Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge package:io #1207

Merged
merged 104 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
48df04c
Initial commit.
matanlurey Jun 25, 2017
8ccaa12
Add ExitCode, an enum-like class. (dart-lang/io#5)
matanlurey Jul 5, 2017
356f4f3
Add `ProcessManager` and `sharedStdIn` (dart-lang/io#6)
matanlurey Jul 12, 2017
cf4c2ec
Rename exit_code file to match class name (dart-lang/io#11)
kevmoo Aug 1, 2017
0c0b93f
Add AnsiCode (dart-lang/io#10)
kevmoo Aug 2, 2017
201756f
Use recommended property description (dart-lang/io#12)
kevmoo Aug 2, 2017
aab98fc
Fix up documentation ansi code (dart-lang/io#13)
kevmoo Aug 15, 2017
da2aede
Fix ansi_code_example (dart-lang/io#14)
kevmoo Aug 15, 2017
b0f4db7
Prepare for release (dart-lang/io#15)
kevmoo Aug 15, 2017
3d2c6c4
Added dependency on pkg/meta (dart-lang/io#16)
kevmoo Aug 15, 2017
bb0bc74
Standardize license format
kevmoo Sep 13, 2017
bef18b7
Fix ProcessManager, align better with dart:io (dart-lang/io#19)
matanlurey Sep 21, 2017
e9d37c2
Add a shellSplit() function (dart-lang/io#23)
nex3 Oct 12, 2017
727c6b4
Prepare to publish 0.3.0. (dart-lang/io#24)
matanlurey Oct 12, 2017
62f060a
Delint the shell_words.dart file. (dart-lang/io#25)
matanlurey Oct 17, 2017
073d713
Update README.md (dart-lang/io#27)
matanlurey Oct 23, 2017
9e09cb5
Add utilities to sharedStdIn. (dart-lang/io#26)
matanlurey Oct 25, 2017
6bd4e5d
Fix nested tests (dart-lang/io#28)
kevmoo Nov 6, 2017
17c283b
Add remaining args to spawnX. (dart-lang/io#29)
matanlurey Nov 23, 2017
2b6a28c
Add copyPath and copyPathSync. (dart-lang/io#30)
matanlurey Dec 1, 2017
f0ae9c6
Prepare to release 0.3.1. (dart-lang/io#31)
matanlurey Dec 1, 2017
daf68d3
Update travis file
kevmoo Jan 30, 2018
9c60e65
Provide access to ansi values suitable for shell scripts
kevmoo Jan 30, 2018
bd349c7
Make the forScript code paths ignore the ansiOutputEnabled property (…
kevmoo Jan 31, 2018
9d62165
Fix formatting for Dart v2-dev (dart-lang/io#38)
kevmoo Feb 27, 2018
e6b1b81
ignore .dart_tool dir
kevmoo Mar 7, 2018
840393d
misc: support lastest pkg:test in dev_dependencies
kevmoo Jun 26, 2018
bf3746c
fix: updates for Dart2 constants
kevmoo Jun 26, 2018
40e8f63
fix: update signature of `StartProcess` typedef
kevmoo Jun 26, 2018
32ee275
Prepare to release v0.3.3 (dart-lang/io#42)
kevmoo Jul 12, 2018
4faa6ba
misc: enable pkg:pendancy lints (dart-lang/io#43)
kevmoo Oct 2, 2018
31c54f3
Run tests on oldest supported SDK, enable remaining dartfmt lint (dar…
kevmoo Apr 7, 2019
0067edd
dartfmt (dart-lang/io#45)
kevmoo Apr 15, 2019
437e8e8
fix latest pedantic lints (dart-lang/io#47)
kevmoo Dec 9, 2019
fe86f6f
Delete author from pubspec
kevmoo Mar 16, 2020
1a49e08
Remove lints duplicated in pkg:pedantic
kevmoo Apr 2, 2020
f45c7a7
Extend package description
kevmoo Apr 2, 2020
daab101
Rename examples
kevmoo Apr 2, 2020
adeea23
cleanup the readme (dart-lang/io#52)
kevmoo Apr 2, 2020
d9386ad
Prepare to release v0.3.4 (dart-lang/io#53)
kevmoo Apr 3, 2020
1791d5f
Ignore a few 'unused' values in the _FilePermission enum (dart-lang/i…
srawlins Apr 7, 2020
c2e8ce8
Update .travis.yml (dart-lang/io#57)
kevmoo Jun 14, 2020
0a9f3f5
Remove unneeded dart:async imports
MichaelRFairhurst Sep 22, 2020
30dddbc
Merge pull request dart-lang/io#59 from MichaelRFairhurst/remove-imports
MichaelRFairhurst Oct 2, 2020
2298ff2
Remove dependency on `package:charcode`.
lrhn Feb 18, 2021
20ccad9
Remove `-dev` from version number.
lrhn Feb 19, 2021
446c4d4
Update changelog, dont ignore style guide.
lrhn Feb 22, 2021
e2c2a45
Merge pull request dart-lang/io#69 from dart-lang/remove-charcode
lrhn Feb 23, 2021
285f616
Move to GitHub actions, Require dart >= 2.12 (dart-lang/io#64)
kevmoo Feb 24, 2021
ebc76b6
Enable and fix a number of lints, disallow implicit dynamic (dart-lan…
kevmoo Feb 24, 2021
7f70274
fix readme (dart-lang/io#70)
kevmoo Feb 24, 2021
3aa1038
Migrate to null safety (dart-lang/io#67)
simolus3 Feb 24, 2021
092f7b7
prepare for stable release (dart-lang/io#71)
kevmoo Feb 25, 2021
a1ff3be
fix link in changelog
kevmoo Feb 25, 2021
7755247
Remove unneeded dart_style dep, remove dep overrides... (dart-lang/io…
kevmoo Mar 19, 2021
4fba6bd
Update LICENSE
franklinyow Apr 5, 2021
e3a75cb
Merge pull request dart-lang/io#75 from dart-lang/franklinyow-patch-1
franklinyow Apr 5, 2021
6be9a4d
Fix newly enforced lint (dart-lang/io#76)
kevmoo Apr 26, 2021
05ad212
Update example
mit-mit Jun 9, 2021
81781d1
Fix import
mit-mit Jun 9, 2021
22543ce
Merge pull request dart-lang/io#77 from dart-lang/darttool
mit-mit Jun 15, 2021
1328132
Update 'meta' constraint to '>=1.3.0 <3.0.0'.
scheglov Jul 4, 2021
aee8f9e
Merge pull request dart-lang/io#79 from scheglov/meta-2.0.0
scheglov Jul 4, 2021
fb03224
Revert to 'meta: ^1.3.0'.
scheglov Jul 7, 2021
51db4e3
Merge pull request dart-lang/io#80 from scheglov/meta-1.3.0
scheglov Jul 7, 2021
a5d3c6f
Dart format with latest SDK (dart-lang/io#81)
kevmoo Jul 11, 2021
d064c3c
blast_repo fixes (dart-lang/io#91)
kevmoo Nov 15, 2022
259a16c
Bump actions/checkout from 3.1.0 to 3.2.0 (dart-lang/io#92)
dependabot[bot] Jan 3, 2023
8da8bc8
Migrate from no-implicit-casts to strict-casts (dart-lang/io#94)
srawlins Jan 9, 2023
1762ff9
various updates and add publishing automation (dart-lang/io#95)
devoncarew Jan 19, 2023
cced291
update the publishing script (dart-lang/io#96)
devoncarew Jan 27, 2023
f0ac06f
Bump dart-lang/setup-dart from 1.3 to 1.4 (dart-lang/io#99)
dependabot[bot] Feb 1, 2023
c152b53
Bump actions/checkout from 3.2.0 to 3.3.0 (dart-lang/io#100)
dependabot[bot] Feb 1, 2023
fd5f679
Bump actions/checkout from 3.3.0 to 3.5.0 (dart-lang/io#104)
dependabot[bot] Apr 3, 2023
451695d
Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (dart-lang/io#103)
dependabot[bot] Apr 3, 2023
fb034df
Bump actions/checkout from 3.5.0 to 3.5.2 (dart-lang/io#105)
dependabot[bot] May 8, 2023
ec950e6
blast_repo fixes (dart-lang/io#107)
devoncarew May 22, 2023
55e4c0d
blast_repo fixes (dart-lang/io#108)
devoncarew May 31, 2023
670853d
Require Dart 3.0, update lints (dart-lang/io#109)
kevmoo Jun 7, 2023
e75f123
Bump actions/checkout from 3.5.2 to 3.5.3 (dart-lang/io#111)
dependabot[bot] Jul 1, 2023
f0cf939
Bump actions/checkout from 3.5.3 to 3.6.0 (dart-lang/io#112)
dependabot[bot] Sep 1, 2023
44b0d61
Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (dart-lang/io#114)
dependabot[bot] Oct 1, 2023
2f4e338
Bump actions/checkout from 3.6.0 to 4.1.0 (dart-lang/io#115)
dependabot[bot] Oct 1, 2023
746b420
Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (dart-lang/io#116)
dependabot[bot] Nov 1, 2023
90b60df
Bump actions/checkout from 4.1.0 to 4.1.1 (dart-lang/io#117)
dependabot[bot] Nov 1, 2023
e7980a6
drop outdated lints (dart-lang/io#119)
kevmoo Dec 4, 2023
e3e5288
Bump actions/stale from 8.0.0 to 9.0.0 (dart-lang/io#120)
dependabot[bot] Jan 1, 2024
1bee34c
Bump dart-lang/setup-dart from 1.6.0 to 1.6.2 (dart-lang/io#121)
dependabot[bot] Feb 1, 2024
e50f600
Bump actions/checkout from 4.1.1 to 4.1.2 (dart-lang/io#123)
dependabot[bot] Apr 1, 2024
8f8459d
Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/io#125)
dependabot[bot] May 1, 2024
62121aa
Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/io#124)
dependabot[bot] May 1, 2024
c561608
blast_repo fixes (dart-lang/io#126)
devoncarew May 7, 2024
bf2979b
Bump actions/checkout from 4.1.4 to 4.1.5 in the github-actions group…
dependabot[bot] May 7, 2024
cc742b3
Bump actions/checkout from 4.1.5 to 4.1.6 in the github-actions group…
dependabot[bot] Jun 1, 2024
141cbd6
Bump the github-actions group with 2 updates (dart-lang/io#130)
dependabot[bot] Jul 1, 2024
d6281c6
Fix analysis, bump lints, require Dart 3.4 (dart-lang/io#132)
kevmoo Aug 26, 2024
4346f35
Bump actions/checkout from 4.1.7 to 4.2.0 in the github-actions group…
dependabot[bot] Oct 1, 2024
043a0ba
blast_repo fixes (dart-lang/io#134)
kevmoo Oct 29, 2024
b7b0042
Bump actions/checkout from 4.2.0 to 4.2.2 in the github-actions group…
dependabot[bot] Nov 1, 2024
b44e89f
Bump dart-lang/setup-dart in the github-actions group (dart-lang/io#136)
dependabot[bot] Dec 1, 2024
7db2a20
Merge package:io into the tools monorepo
mosuem Dec 9, 2024
f5d585d
Add issue template and other fixes
mosuem Dec 9, 2024
7a673ce
Fix labels etc
mosuem Dec 9, 2024
ba87c44
Add licenses
mosuem Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/io.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
name: "package:io"
about: "Create a bug or file a feature request against package:io."
labels: "package:io"
---
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
- changed-files:
- any-glob-to-any-file: 'pkgs/html/**'

'package:io':
- changed-files:
- any-glob-to-any-file: 'pkgs/io/**'

'package:json_rpc_2':
- changed-files:
- any-glob-to-any-file: 'pkgs/json_rpc_2/**'
Expand Down
72 changes: 72 additions & 0 deletions .github/workflows/io.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: package:io

on:
# Run on PRs and pushes to the default branch.
push:
branches: [ main ]
paths:
- '.github/workflows/io.yml'
- 'pkgs/io/**'
pull_request:
branches: [ main ]
paths:
- '.github/workflows/io.yml'
- 'pkgs/io/**'
schedule:
- cron: "0 0 * * 0"

env:
PUB_ENVIRONMENT: bot.github


defaults:
run:
working-directory: pkgs/io/


jobs:
# Check code formatting and static analysis on a single OS (linux)
# against Dart dev and stable.
analyze:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [dev, 3.4]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
with:
sdk: ${{ matrix.sdk }}
- id: install
name: Install dependencies
run: dart pub get
- name: Check formatting
run: dart format --output=none --set-exit-if-changed .
if: always() && steps.install.outcome == 'success'
- name: Analyze code
run: dart analyze --fatal-infos
if: always() && steps.install.outcome == 'success'

# Run tests on a matrix consisting of two dimensions:
# 1. OS: ubuntu-latest, (macos-latest, windows-latest)
# 2. release channel: dev, stable
test:
needs: analyze
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Add macos-latest and/or windows-latest if relevant for this package.
os: [ubuntu-latest]
sdk: [dev, 3.4]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
with:
sdk: ${{ matrix.sdk }}
- id: install
name: Install dependencies
run: dart pub get
- run: dart test
if: always() && steps.install.outcome == 'success'
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ don't naturally belong to other topic monorepos (like
| [file_testing](pkgs/file_testing/) | Testing utilities for package:file. | [![package issues](https://img.shields.io/badge/package:file_testing-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Afile_testing) | [![pub package](https://img.shields.io/pub/v/file_testing.svg)](https://pub.dev/packages/file_testing) |
| [graphs](pkgs/graphs/) | Graph algorithms that operate on graphs in any representation. | [![package issues](https://img.shields.io/badge/package:graphs-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Agraphs) | [![pub package](https://img.shields.io/pub/v/graphs.svg)](https://pub.dev/packages/graphs) |
| [html](pkgs/html/) | APIs for parsing and manipulating HTML content outside the browser. | [![package issues](https://img.shields.io/badge/package:html-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Ahtml) | [![pub package](https://img.shields.io/pub/v/html.svg)](https://pub.dev/packages/html) |
| [io](pkgs/io/) | Utilities for the Dart VM Runtime including support for ANSI colors, file copying, and standard exit code values. | [![pub package](https://img.shields.io/pub/v/io.svg)](https://pub.dev/packages/io) |
| [json_rpc_2](pkgs/json_rpc_2/) | Utilities to write a client or server using the JSON-RPC 2.0 spec. | [![package issues](https://img.shields.io/badge/package:json_rpc_2-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Ajson_rpc_2) | [![pub package](https://img.shields.io/pub/v/json_rpc_2.svg)](https://pub.dev/packages/json_rpc_2) |
| [mime](pkgs/mime/) | Utilities for handling media (MIME) types, including determining a type from a file extension and file contents. | [![package issues](https://img.shields.io/badge/package:mime-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Amime) | [![pub package](https://img.shields.io/pub/v/mime.svg)](https://pub.dev/packages/mime) |
| [oauth2](pkgs/oauth2/) | A client library for authenticating with a remote service via OAuth2 on behalf of a user, and making authorized HTTP requests with the user's OAuth2 credentials. | [![package issues](https://img.shields.io/badge/package:oauth2-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aoauth2) | [![pub package](https://img.shields.io/pub/v/oauth2.svg)](https://pub.dev/packages/oauth2) |
Expand Down
4 changes: 4 additions & 0 deletions pkgs/io/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.dart_tool/
.pub/
.packages
pubspec.lock
7 changes: 7 additions & 0 deletions pkgs/io/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Below is a list of people and organizations that have contributed
# to the project. Names should be added to the list like so:
#
# Name/Organization <email address>

Google Inc.

119 changes: 119 additions & 0 deletions pkgs/io/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
## 1.0.5

* Require Dart 3.4.
* Move to `dart-lang/tools` monorepo.

## 1.0.4

* Updates to the readme.

## 1.0.3

* Revert `meta` constraint to `^1.3.0`.

## 1.0.2

* Update `meta` constraint to `>=1.3.0 <3.0.0`.

## 1.0.1

* Update code examples to call the unified `dart` developer tool.

## 1.0.0

* Migrate this package to null-safety.
* Require Dart >=2.12.

## 0.3.5

* Require Dart >=2.1.
* Remove dependency on `package:charcode`.

## 0.3.4

* Fix a number of issues affecting the package score on `pub.dev`.

## 0.3.3

* Updates for Dart 2 constants. Require at least Dart `2.0.0-dev.54`.

* Fix the type of `StartProcess` typedef to match `Process.start` from
`dart:io`.

## 0.3.2+1

* `ansi.dart`

* The "forScript" code paths now ignore the `ansiOutputEnabled` value. Affects
the `escapeForScript` property on `AnsiCode` and the `wrap` and `wrapWith`
functions when `forScript` is true.

## 0.3.2

* `ansi.dart`

* Added `forScript` named argument to top-level `wrapWith` function.

* `AnsiCode`

* Added `String get escapeForScript` property.

* Added `forScript` named argument to `wrap` function.

## 0.3.1

- Added `SharedStdIn.nextLine` (similar to `readLineSync`) and `lines`:

```dart
main() async {
// Prints the first line entered on stdin.
print(await sharedStdIn.nextLine());

// Prints all remaining lines.
await for (final line in sharedStdIn.lines) {
print(line);
}
}
```

- Added a `copyPath` and `copyPathSync` function, similar to `cp -R`.

- Added a dependency on `package:path`.

- Added the remaining missing arguments to `ProcessManager.spawnX` which
forward to `Process.start`. It is now an interchangeable function for running
a process.

## 0.3.0

- **BREAKING CHANGE**: The `arguments` argument to `ProcessManager.spawn` is
now positional (not named) and required. This makes it more similar to the
built-in `Process.start`, and easier to use as a drop in replacement:

```dart
main() {
processManager.spawn('dart', ['--version']);
}
```

- Fixed a bug where processes created from `ProcessManager.spawn` could not
have their `stdout`/`stderr` read through their respective getters (a runtime
error was always thrown).

- Added `ProcessMangaer#spawnBackground`, which does not forward `stdin`.

- Added `ProcessManager#spawnDetached`, which does not forward any I/O.

- Added the `shellSplit()` function, which parses a list of arguments in the
same manner as [the POSIX shell][what_is_posix_shell].

[what_is_posix_shell]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.html

## 0.2.0

- Initial commit of...
- `FutureOr<bool> String isExecutable(path)`.
- `ExitCode`
- `ProcessManager` and `Spawn`
- `sharedStdIn` and `SharedStdIn`
- `ansi.dart` library with support for formatting terminal output
27 changes: 27 additions & 0 deletions pkgs/io/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright 2017, the Dart project authors.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
104 changes: 104 additions & 0 deletions pkgs/io/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
[![Build Status](https://github.com/dart-lang/tools/actions/workflows/io.yaml/badge.svg)](https://github.com/dart-lang/tools/actions/workflows/io.yaml)
[![pub package](https://img.shields.io/pub/v/io.svg)](https://pub.dev/packages/io)
[![package publisher](https://img.shields.io/pub/publisher/io.svg)](https://pub.dev/packages/io/publisher)

Contains utilities for the Dart VM's `dart:io`.

## Usage - `io.dart`

### Files

#### `isExecutable`

Returns whether a provided file path is considered _executable_ on the host
operating system.

### Processes

#### `ExitCode`

An `enum`-like class that contains known exit codes.

#### `ProcessManager`

A higher-level service for spawning and communicating with processes.

##### Use `spawn` to create a process with std[in|out|err] forwarded by default

```dart
Future<void> main() async {
final manager = ProcessManager();

// Print `dart` tool version to stdout.
print('** Running `dart --version`');
var spawn = await manager.spawn('dart', ['--version']);
await spawn.exitCode;

// Check formatting and print the result to stdout.
print('** Running `dart format --output=none .`');
spawn = await manager.spawn('dart', ['format', '--output=none', '.']);
await spawn.exitCode;

// Check if a package is ready for publishing.
// Upon hitting a blocking stdin state, you may directly
// output to the processes's stdin via your own, similar to how a bash or
// shell script would spawn a process.
print('** Running pub publish');
spawn = await manager.spawn('dart', ['pub', 'publish', '--dry-run']);
await spawn.exitCode;

// Closes stdin for the entire program.
await sharedStdIn.terminate();
}
```

#### `sharedStdIn`

A safer version of the default `stdin` stream from `dart:io` that allows a
subscriber to cancel their subscription, and then allows a _new_ subscriber to
start listening. This differs from the default behavior where only a single
listener is ever allowed in the application lifecycle:

```dart
test('should allow multiple subscribers', () async {
final logs = <String>[];
final asUtf8 = sharedStdIn.transform(UTF8.decoder);
// Wait for input for the user.
logs.add(await asUtf8.first);
// Wait for more input for the user.
logs.add(await asUtf8.first);
expect(logs, ['Hello World', 'Goodbye World']);
});
```

For testing, an instance of `SharedStdIn` may be created directly.

## Usage - `ansi.dart`

```dart
import 'dart:io' as io;
import 'package:io/ansi.dart';

void main() {
// To use one style, call the `wrap` method on one of the provided top-level
// values.
io.stderr.writeln(red.wrap("Bad error!"));

// To use multiple styles, call `wrapWith`.
print(wrapWith('** Important **', [red, styleBold, styleUnderlined]));

// The wrap functions will simply return the provided value unchanged if
// `ansiOutputEnabled` is false.
//
// You can override the value `ansiOutputEnabled` by wrapping code in
// `overrideAnsiOutput`.
overrideAnsiOutput(false, () {
assert('Normal text' == green.wrap('Normal text'));
});
}
```

## Publishing automation

For information about our publishing automation and release process, see
https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.
32 changes: 32 additions & 0 deletions pkgs/io/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# https://dart.dev/guides/language/analysis-options
include: package:dart_flutter_team_lints/analysis_options.yaml

analyzer:
language:
strict-casts: true
strict-inference: true
strict-raw-types: true

linter:
rules:
- avoid_bool_literals_in_conditional_expressions
- avoid_classes_with_only_static_members
- avoid_private_typedef_functions
- avoid_redundant_argument_values
- avoid_returning_this
- avoid_unused_constructor_parameters
- avoid_void_async
- cancel_subscriptions
- join_return_with_assignment
- literal_only_boolean_expressions
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
- no_runtimeType_toString
- prefer_const_declarations
- prefer_expression_function_bodies
- prefer_final_locals
- unnecessary_await_in_return
- unnecessary_breaks
- use_if_null_to_convert_nulls_to_bools
- use_raw_strings
- use_string_buffers
Loading
Loading