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:cli_util #690

Merged
merged 137 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
2cf24bb
Initial commit.
pq Feb 3, 2015
dec7d29
Update README.md
pq Feb 3, 2015
e4c554b
readme tweaks
devoncarew Feb 3, 2015
10a0953
ws
devoncarew Feb 3, 2015
d6448b0
de-dup backticks
devoncarew Feb 3, 2015
33a5768
Merge pull request dart-lang/cli_util#1 from dart-lang/devoncarew_readme
pq Feb 3, 2015
75bdfa3
Update README.md
devoncarew Feb 3, 2015
6acc6df
Update pubspec.yaml
pq Feb 3, 2015
a100c38
Update pubspec.yaml
pq Feb 3, 2015
6f88596
Initial commit.
pq Feb 3, 2015
db0be59
Travis scaffolding.
pq Feb 3, 2015
35dd38e
Travis scaffolding for cli_util.
pq Feb 4, 2015
2e4a975
Initial commit of travis.yml.
pq Feb 4, 2015
f056114
Merge branch 'master' of https://github.com/dart-lang/cli_util
pq Feb 4, 2015
041b345
Initial commit of travis.yml.
pq Feb 4, 2015
232bbfb
Merge branch 'master' of https://github.com/dart-lang/cli_util
pq Feb 4, 2015
e088e84
Fixed exec bit.
pq Feb 4, 2015
bc87756
Update README.md
pq Feb 4, 2015
2f41e03
Merge branch 'master' of https://github.com/dart-lang/cli_util
pq Feb 4, 2015
844f397
Arg parsing tests
pq Feb 4, 2015
195df79
Check for null return from which().
pq Feb 10, 2015
1431a26
Version rev.
pq Feb 10, 2015
f6cb74f
Fixed MD.
pq Feb 10, 2015
74cfeca
If-block rethink.
pq Feb 10, 2015
19538ee
Merge pull request dart-lang/cli_util#4 from dart-lang/null_link_fix
pq Feb 10, 2015
6a5a1f9
Update .travis.yml
pq Apr 16, 2015
838c866
Merge pull request dart-lang/cli_util#7 from dart-lang/sudo_fix
pq Apr 16, 2015
93ebaa6
Support an executable in a symlinked directory.
nex3 May 19, 2015
ae41b32
Test that getSdkDir() finds the SDK without CLI args.
ochafik May 21, 2015
979a071
Merge pull request dart-lang/cli_util#9 from ochafik/getSdkDir_withou…
pq May 22, 2015
23610c3
Flip the strong-mode bit for `cli_utl`.
pq May 10, 2016
ff3126f
Update cli_util.dart
stereotype441 Sep 26, 2016
d83bd44
Update CHANGELOG.md
stereotype441 Sep 26, 2016
de2528f
Update pubspec.yaml
stereotype441 Sep 26, 2016
78ae5e6
Merge pull request dart-lang/cli_util#12 from dart-lang/stereotype441…
stereotype441 Sep 26, 2016
0ac3953
introduce a getSdkPath() API
devoncarew May 15, 2017
01fde2d
Merge pull request dart-lang/cli_util#13 from dart-lang/use_platform_…
devoncarew May 15, 2017
17debc2
add cli_logging.dart
devoncarew May 17, 2017
efef03f
update the readme
devoncarew May 17, 2017
5434b09
Merge pull request dart-lang/cli_util#15 from dart-lang/cli_logging
devoncarew May 17, 2017
9b30025
rev to 0.1.0
devoncarew May 17, 2017
2f1237a
Merge pull request dart-lang/cli_util#16 from dart-lang/0.1.0
devoncarew May 17, 2017
fa9b089
Add pub package badge.
pq May 17, 2017
a6a9be0
Merge pull request dart-lang/cli_util#17 from dart-lang/pq-patch-1-1
pq May 17, 2017
a2f3ed2
fix and add library docs
devoncarew May 18, 2017
319fc79
Merge pull request dart-lang/cli_util#18 from dart-lang/docs
devoncarew May 19, 2017
e7c8915
sme updates to the output for the progess display
devoncarew May 19, 2017
1d9ba8c
Merge branch 'master' into cli_output_updates
devoncarew May 19, 2017
92d7759
Merge pull request dart-lang/cli_util#19 from dart-lang/cli_output_up…
devoncarew May 19, 2017
f0ff8b9
add Logger.isVerbose; rev version
devoncarew May 26, 2017
e33ddef
Merge pull request dart-lang/cli_util#20 from dart-lang/verbose_and_rev
devoncarew May 26, 2017
8c9e548
fix an issue with getSdkDir
devoncarew Jul 13, 2017
4c7f011
Merge pull request dart-lang/cli_util#22 from dart-lang/directory_check
devoncarew Jul 13, 2017
f9fb8d1
Update SDK constraint to be 2.0.0 dev friendly.
pq Jul 13, 2017
8d7d4ce
Merge pull request dart-lang/cli_util#23 from dart-lang/pq-patch-1
pq Jul 13, 2017
e82b752
Update CHANGELOG.md
devoncarew Jul 19, 2017
3695790
Make trusty default distro explicit.
pq Aug 3, 2017
03702bb
Merge pull request dart-lang/cli_util#26 from dart-lang/trusty
pq Aug 4, 2017
66175ad
Fix SDK constraint (dart-lang/cli_util#27)
kevmoo Sep 19, 2017
3694a44
Changes for landing https://github.com/dart-lang/sdk/issues/32161
MichaelRFairhurst Feb 19, 2018
7b07f72
Merge pull request dart-lang/cli_util#28 from MichaelRFairhurst/void-…
MichaelRFairhurst Feb 19, 2018
a2278db
Update .gitignore to new `dart_tool` pub cache
pq Mar 10, 2018
c257d4a
Update .gitignore
pq Mar 11, 2018
8271c64
Merge pull request dart-lang/cli_util#29 from dart-lang/dart_tool
pq Mar 11, 2018
ff72416
change the verbose logging output
devoncarew May 14, 2018
173b5fd
update the timestamp message
devoncarew May 14, 2018
25509c4
review comments
devoncarew May 16, 2018
233d1ac
Merge pull request dart-lang/cli_util#31 from dart-lang/change_verbos…
devoncarew May 16, 2018
3003994
Fix dart:io constants. (dart-lang/cli_util#32)
lrhn May 30, 2018
12f41e6
remove preview-dart2 flag
pq Jun 21, 2018
691de2f
Merge pull request dart-lang/cli_util#34 from dart-lang/pq-patch-1
pq Jun 21, 2018
a9046a0
goodbye `strong`
pq Jul 2, 2018
103ff37
Merge pull request dart-lang/cli_util#35 from dart-lang/rm_strong
pq Jul 3, 2018
6541f25
0.1.3+2
pq Jul 16, 2018
d2f6fa9
bumped test dep
pq Jul 16, 2018
cc15beb
Merge pull request dart-lang/cli_util#36 from dart-lang/0.1.3+2
pq Jul 16, 2018
17f714a
Test on oldest supported SDK (dart-lang/cli_util#37)
kevmoo Apr 29, 2019
72f87c2
Add Ansi.reversed getter, and prepare to publish version 0.1.4. (dart…
stereotype441 May 4, 2020
a3175b0
Add write() and writeCharCode() to Logger (dart-lang/cli_util#42)
srawlins Jun 3, 2020
03fa1d5
Fix outdated URIs, remove gratuitous title in readme (dart-lang/cli_u…
kevmoo Aug 19, 2020
d84c05f
Enable and fix default pedantic lints (dart-lang/cli_util#47)
kevmoo Aug 19, 2020
81179cf
add support for github actions (dart-lang/cli_util#49)
devoncarew Nov 2, 2020
87a692d
remove travis support (dart-lang/cli_util#50)
devoncarew Nov 2, 2020
ac71c4e
Add cron task (dart-lang/cli_util#51)
kevmoo Nov 2, 2020
abfe622
nnbd migration (dart-lang/cli_util#52)
pq Nov 9, 2020
3568689
Use late final for _timer fields (dart-lang/cli_util#53)
natebosch Nov 9, 2020
bc99ef9
Print dart version in CI job (dart-lang/cli_util#54)
kevmoo Nov 12, 2020
3d25ebd
stable null safety release (dart-lang/cli_util#56)
jakemac53 Feb 6, 2021
930a2af
remove optional `new`s (dart-lang/cli_util#57)
pq Feb 6, 2021
5f748c1
Fix latest lints (dart-lang/cli_util#58)
kevmoo Mar 11, 2021
27ba5b3
Update LICENSE (dart-lang/cli_util#59)
franklinyow Apr 1, 2021
3ee2a44
Fix frozen spinner (dart-lang/cli_util#61)
natebosch May 5, 2021
909e4f2
Standardize CI action (dart-lang/cli_util#62)
kevmoo May 7, 2021
aafe7a4
enable recommended lints (dart-lang/cli_util#63)
pq May 14, 2021
cbebf75
Update constraint to '>=1.3.0 <3.0.0'. (dart-lang/cli_util#64)
scheglov Jul 4, 2021
5763bbe
Revert to 'meta: ^1.3.0'. (dart-lang/cli_util#65)
scheglov Jul 7, 2021
d56c2a9
Introduce applicationConfigHome (dart-lang/cli_util#66)
jonasfj Sep 17, 2021
a261cbe
Improve tests for applicationConfigHome (dart-lang/cli_util#67)
jonasfj Sep 17, 2021
7844468
Make applicationConfigHome failures catchable (dart-lang/cli_util#68)
sigurdm Oct 11, 2021
86a5c92
Prepare publish of v0.3.5 (dart-lang/cli_util#69)
sigurdm Oct 12, 2021
e0cff73
blast_repo fixes (dart-lang/cli_util#71)
devoncarew Nov 15, 2022
86a7d62
Bump actions/checkout from 3.1.0 to 3.2.0 (dart-lang/cli_util#72)
dependabot[bot] Jan 1, 2023
677d9fc
Migrate from no-implicit-casts to strict-casts (dart-lang/cli_util#73)
srawlins Jan 9, 2023
5ad9d09
Bump dart-lang/setup-dart from 1.3 to 1.4 (dart-lang/cli_util#75)
dependabot[bot] Feb 1, 2023
adc3a2b
Bump actions/checkout from 3.2.0 to 3.3.0 (dart-lang/cli_util#74)
dependabot[bot] Feb 1, 2023
00ce67b
blast_repo fixes (dart-lang/cli_util#76)
kevmoo Feb 24, 2023
1b2b8b1
Move to dart_flutter_team_lints, require Dart 2.19 (dart-lang/cli_uti…
kevmoo Feb 24, 2023
ca51580
remove getSdkDir; prep to publish 0.4.0 (dart-lang/cli_util#78)
devoncarew Mar 2, 2023
181b253
Update README.md (dart-lang/cli_util#79)
devoncarew Mar 2, 2023
569b532
Bump actions/checkout from 3.3.0 to 3.5.0 (dart-lang/cli_util#80)
dependabot[bot] Apr 3, 2023
7123978
Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (dart-lang/cli_util#81)
dependabot[bot] Apr 3, 2023
6eb2c3b
Bump actions/checkout from 3.5.0 to 3.5.2 (dart-lang/cli_util#82)
dependabot[bot] May 1, 2023
15f5bc8
blast_repo fixes (dart-lang/cli_util#83)
devoncarew May 15, 2023
ec9d7a0
Bump actions/checkout from 3.5.2 to 3.5.3 (dart-lang/cli_util#84)
dependabot[bot] Jul 1, 2023
572e4b3
Bump actions/checkout from 3.5.3 to 3.6.0 (dart-lang/cli_util#88)
dependabot[bot] Sep 1, 2023
d4a03ce
Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (dart-lang/cli_util#90)
dependabot[bot] Oct 1, 2023
55e86c8
Bump actions/checkout from 3.6.0 to 4.1.0 (dart-lang/cli_util#89)
dependabot[bot] Oct 3, 2023
1c3f7eb
Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (dart-lang/cli_util#92)
dependabot[bot] Nov 1, 2023
04e6408
Bump actions/checkout from 4.1.0 to 4.1.1 (dart-lang/cli_util#91)
dependabot[bot] Nov 1, 2023
194ebfb
require dart 3.0; rev to 0.4.1 in prep for publishing (dart-lang/cli_…
devoncarew Dec 15, 2023
79a6729
blast_repo fixes (dart-lang/cli_util#95)
kevmoo Dec 20, 2023
3c5114a
Bump actions/stale from 8.0.0 to 9.0.0 (dart-lang/cli_util#96)
dependabot[bot] Jan 1, 2024
1f404b7
Bump dart-lang/setup-dart from 1.6.0 to 1.6.2 (dart-lang/cli_util#97)
dependabot[bot] Feb 1, 2024
b8e2df3
Bump actions/checkout from 4.1.1 to 4.1.2 (dart-lang/cli_util#98)
dependabot[bot] Apr 1, 2024
0629a6e
Make `sdkPath` a getter (dart-lang/cli_util#100)
lrhn Apr 11, 2024
2fde139
Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/cli_util#101)
dependabot[bot] May 1, 2024
215e0f3
Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/cli_util#102)
dependabot[bot] May 1, 2024
381745b
blast_repo fixes (dart-lang/cli_util#103)
devoncarew May 3, 2024
8fd519a
Bump actions/checkout from 4.1.4 to 4.1.6 in the github-actions group…
dependabot[bot] Jun 1, 2024
ba5b1d2
Bump the github-actions group with 2 updates (dart-lang/cli_util#105)
dependabot[bot] Jul 1, 2024
138ada8
update lints (dart-lang/cli_util#106)
kevmoo Jul 8, 2024
d844845
Bump actions/checkout from 4.1.7 to 4.2.0 in the github-actions group…
dependabot[bot] Oct 1, 2024
fa5f2a0
Merge package:cli_util into the tools monorepo
mosuem Oct 25, 2024
e221624
Add issue template and other fixes
mosuem Oct 25, 2024
aca6134
Moving fixes
mosuem Oct 25, 2024
32e06bd
Merge branch 'main' into merge-cli_util-package
mosuem Oct 29, 2024
5e842b4
Remove lint
mosuem Oct 29, 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/cli_util.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
name: "package:cli_util"
about: "Create a bug or file a feature request against package:cli_util."
labels: "package:cli_util"
---
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
- changed-files:
- any-glob-to-any-file: 'pkgs/cli_config/**'

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

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

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

env:
PUB_ENVIRONMENT: bot.github


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

jobs:
analyze:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [dev]
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
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'

test:
needs: analyze
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
sdk: ['3.4', dev]
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
with:
sdk: ${{ matrix.sdk }}
- id: install
name: Install dependencies
run: dart pub get
- name: Run tests
run: dart test --test-randomize-ordering-seed=random
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 @@ -19,6 +19,7 @@ don't naturally belong to other topic monorepos (like
| [boolean_selector](pkgs/boolean_selector/) | A flexible syntax for boolean expressions, based on a simplified version of Dart's expression syntax. | [![pub package](https://img.shields.io/pub/v/boolean_selector.svg)](https://pub.dev/packages/boolean_selector) |
| [browser_launcher](pkgs/browser_launcher/) | Provides a standardized way to launch web browsers for testing and tools. | [![pub package](https://img.shields.io/pub/v/browser_launcher.svg)](https://pub.dev/packages/browser_launcher) |
| [cli_config](pkgs/cli_config/) | A library to take config values from configuration files, CLI arguments, and environment variables. | [![pub package](https://img.shields.io/pub/v/cli_config.svg)](https://pub.dev/packages/cli_config) |
| [cli_util](pkgs/cli_util/) | A library to help in building Dart command-line apps. | [![pub package](https://img.shields.io/pub/v/cli_util.svg)](https://pub.dev/packages/cli_util) |
| [clock](pkgs/clock/) | A fakeable wrapper for dart:core clock APIs. | [![pub package](https://img.shields.io/pub/v/clock.svg)](https://pub.dev/packages/clock) |
| [coverage](pkgs/coverage/) | Coverage data manipulation and formatting. | [![pub package](https://img.shields.io/pub/v/coverage.svg)](https://pub.dev/packages/coverage) |
| [csslib](pkgs/csslib/) | A library for parsing and analyzing CSS (Cascading Style Sheets). | [![pub package](https://img.shields.io/pub/v/csslib.svg)](https://pub.dev/packages/csslib) |
Expand Down
3 changes: 3 additions & 0 deletions pkgs/cli_util/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.dart_tool/
.packages
pubspec.lock
6 changes: 6 additions & 0 deletions pkgs/cli_util/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Below is a list of people and organizations that have contributed
# to the cli_util project. Names should be added to the list like so:
#
# Name/Organization <email address>

Google Inc.
105 changes: 105 additions & 0 deletions pkgs/cli_util/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
## 0.4.2

- Add `sdkPath` getter, deprecate `getSdkPath` function.
* Move to `dart-lang/tools` monorepo.

## 0.4.1

- Fix a broken link in the readme.
- Require Dart 3.0.

## 0.4.0

- Remove the deprecated method `getSdkDir()` (instead, use `getSdkPath()`).
- Require Dart 2.19.

## 0.3.5
- Make `applicationConfigHome` throw an `Exception` when it fails to find a
configuration folder.

## 0.3.4

- Introduce `applicationConfigHome` for making it easy to consistently find the
user-specific application configuration folder.

## 0.3.3

- Reverted `meta` constraint to `^1.3.0`.

## 0.3.2

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

## 0.3.1

- Fix a bug in `AnsiProgress` where the spinning character doesn't every update.

## 0.3.0

- Stable null safety release.

## 0.3.0-nullsafety.0

- Updated to support 2.12.0 and null safety.

## 0.2.1

## 0.2.0

- Add `Logger.write` and `Logger.writeCharCode` methods which write without
printing a trailing newline.

## 0.1.4

- Add `Ansi.reversed` getter.

## 0.1.3+2

- Update Dart SDK constraint to < 3.0.0.

## 0.1.3+1

- Update Dart SDK to 2.0.0-dev.

## 0.1.3

- In verbose mode, instead of printing the diff from the last log message,
print the total time since the tool started
- Change to not buffer the last log message sent in verbose logging mode
- Expose more classes from the logging library

## 0.1.2+1

- Remove unneeded change to Dart SDK constraint.

## 0.1.2

- Fix a bug in `getSdkDir` (#21)

## 0.1.1

- Updated to the output for indeterminate progress
- Exposed a `Logger.isVerbose` getter

## 0.1.0

- Added a new `getSdkPath()` method to get the location of the SDK (this uses the new
`Platform.resolvedExecutable` API to locate the SDK)
- Deprecated `getSdkDir()` in favor of `getSdkPath()`
- Add the `cli_logging.dart` library - utilities to display output and progress

## 0.0.1+3

- Find SDK properly when invoked from inside SDK tests.

## 0.0.1+2

- Support an executable in a symlinked directory.

## 0.0.1+1

- Fix for when the dart executable can't be found by `which`.

## 0.0.1

- Initial version
27 changes: 27 additions & 0 deletions pkgs/cli_util/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright 2015, 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.
68 changes: 68 additions & 0 deletions pkgs/cli_util/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
[![Build Status](https://github.com/dart-lang/tools/actions/workflows/cli_util.yaml/badge.svg)](https://github.com/dart-lang/tools/actions/workflows/cli_util.yaml)
[![Pub](https://img.shields.io/pub/v/cli_util.svg)](https://pub.dev/packages/cli_util)
[![package publisher](https://img.shields.io/pub/publisher/cli_util.svg)](https://pub.dev/packages/cli_util/publisher)

A package to help in building Dart command-line apps.

## What's this?

`package:cli_util` provides:
- utilities to find the Dart SDK directory (`sdkPath`)
- utilities to find the settings directory for a tool (`applicationConfigHome()`)
- utilities to aid in showing rich CLI output and progress information (`cli_logging.dart`)

## Locating the Dart SDK

```dart
import 'dart:io';

import 'package:cli_util/cli_util.dart';
import 'package:path/path.dart' as path;

main(args) {
// Get SDK directory from cli_util.
var sdkDir = sdkPath;

// Do stuff... For example, print version string
var versionFile = File(path.join(sdkDir, 'version'));
print(versionFile.readAsStringSync());
}
```

## Displaying output and progress

`package:cli_util` can also be used to help CLI tools display output and progress.
It has a logging mechanism which can help differentiate between regular tool
output and error messages, and can facilitate having a more verbose (`-v`) mode for
output.

In addition, it can display an indeterminate progress spinner for longer running
tasks, and optionally display the elapsed time when finished:

```dart
import 'package:cli_util/cli_logging.dart';

void main(List<String> args) async {
var verbose = args.contains('-v');
var logger = verbose ? Logger.verbose() : Logger.standard();

logger.stdout('Hello world!');
logger.trace('message 1');
await Future.delayed(Duration(milliseconds: 200));
logger.trace('message 2');
logger.trace('message 3');

var progress = logger.progress('doing some work');
await Future.delayed(Duration(seconds: 2));
progress.finish(showTiming: true);

logger.stdout('All ${logger.ansi.emphasized('done')}.');
logger.flush();
}
```

## Features and bugs

Please file feature requests and bugs at the [issue tracker][tracker].

[tracker]: https://github.com/dart-lang/tools/issues
32 changes: 32 additions & 0 deletions pkgs/cli_util/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_raw_strings
- use_if_null_to_convert_nulls_to_bools
- use_raw_strings
- use_string_buffers
24 changes: 24 additions & 0 deletions pkgs/cli_util/example/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:async';

import 'package:cli_util/cli_logging.dart';

Future<void> main(List<String> args) async {
final verbose = args.contains('-v');
final logger = verbose ? Logger.verbose() : Logger.standard();

logger.stdout('Hello world!');
logger.trace('message 1');
await Future<void>.delayed(const Duration(milliseconds: 200));
logger.trace('message 2');
logger.trace('message 3');

final progress = logger.progress('doing some work');
await Future<void>.delayed(const Duration(seconds: 2));
progress.finish(showTiming: true);

logger.stdout('All ${logger.ansi.emphasized('done')}.');
}
Loading
Loading