Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dart-archive/cli_util
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.0.1+3
Choose a base ref
...
head repository: dart-archive/cli_util
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on May 15, 2017

  1. Copy the full SHA
    7fae620 View commit details
  2. Merge pull request #13 from dart-lang/use_platform_resolvedExecutable

    introduce a getSdkPath() API
    devoncarew authored May 15, 2017
    Copy the full SHA
    d8f691a View commit details

Commits on May 17, 2017

  1. add cli_logging.dart

    devoncarew committed May 17, 2017
    Copy the full SHA
    f102e86 View commit details
  2. update the readme

    devoncarew committed May 17, 2017
    Copy the full SHA
    a47b1ed View commit details
  3. Merge pull request #15 from dart-lang/cli_logging

    add cli_logging.dart
    devoncarew authored May 17, 2017
    Copy the full SHA
    e62b70e View commit details
  4. rev to 0.1.0

    devoncarew committed May 17, 2017
    Copy the full SHA
    1ac5b2e View commit details
  5. Merge pull request #16 from dart-lang/0.1.0

    rev to 0.1.0
    devoncarew authored May 17, 2017
    Copy the full SHA
    dfb626f View commit details
  6. Add pub package badge.

    pq authored May 17, 2017
    Copy the full SHA
    55354bc View commit details
  7. Merge pull request #17 from dart-lang/pq-patch-1-1

    Add pub package badge.
    pq authored May 17, 2017
    Copy the full SHA
    c05f47e View commit details

Commits on May 18, 2017

  1. fix and add library docs

    devoncarew committed May 18, 2017
    Copy the full SHA
    786117d View commit details

Commits on May 19, 2017

  1. Merge pull request #18 from dart-lang/docs

    fix and add library docs
    devoncarew authored May 19, 2017
    Copy the full SHA
    f737350 View commit details
  2. Copy the full SHA
    589090f View commit details
  3. Copy the full SHA
    8655d7d View commit details
  4. Merge pull request #19 from dart-lang/cli_output_updates

    some updates to the output for the progress display
    devoncarew authored May 19, 2017
    Copy the full SHA
    31c64f5 View commit details

Commits on May 26, 2017

  1. Copy the full SHA
    6d73e8c View commit details
  2. Merge pull request #20 from dart-lang/verbose_and_rev

    add Logger.isVerbose; rev version
    devoncarew authored May 26, 2017
    Copy the full SHA
    97828ad View commit details

Commits on Jul 13, 2017

  1. Copy the full SHA
    183e28d View commit details
  2. Merge pull request #22 from dart-lang/directory_check

    fix an issue with getSdkDir
    devoncarew authored Jul 13, 2017
    Copy the full SHA
    0240489 View commit details
  3. Copy the full SHA
    a41149b View commit details
  4. Merge pull request #23 from dart-lang/pq-patch-1

    Update SDK constraint to be 2.0.0 dev friendly.
    pq authored Jul 13, 2017
    Copy the full SHA
    a244fb5 View commit details

Commits on Jul 19, 2017

  1. Update CHANGELOG.md

    update the changelog
    devoncarew authored Jul 19, 2017
    Copy the full SHA
    3f24218 View commit details

Commits on Aug 3, 2017

  1. Copy the full SHA
    b39a075 View commit details

Commits on Aug 4, 2017

  1. Merge pull request #26 from dart-lang/trusty

    Make trusty default distro explicit.
    pq authored Aug 4, 2017
    Copy the full SHA
    c10b88b View commit details

Commits on Sep 19, 2017

  1. Fix SDK constraint (#27)

    kevmoo authored Sep 19, 2017
    Copy the full SHA
    8ab0e41 View commit details

Commits on Feb 19, 2018

  1. Changes for landing dart-lang/sdk#32161

    Add void declarations to methods with implicit dynamic returning void
    values, which may be illegal in dart 2, but in either case, expresses
    the current intent better.
    MichaelRFairhurst committed Feb 19, 2018
    Copy the full SHA
    f69c2ec View commit details
  2. Copy the full SHA
    9c0be5d View commit details

Commits on Mar 10, 2018

  1. Copy the full SHA
    7ff4d97 View commit details

Commits on Mar 11, 2018

  1. Update .gitignore

    pq authored Mar 11, 2018
    Copy the full SHA
    2b06cca View commit details
  2. Merge pull request #29 from dart-lang/dart_tool

    Update .gitignore to new `dart_tool` pub cache
    pq authored Mar 11, 2018
    Copy the full SHA
    f1becff View commit details

Commits on May 14, 2018

  1. Copy the full SHA
    a106370 View commit details
  2. Copy the full SHA
    8653bd8 View commit details

Commits on May 16, 2018

  1. review comments

    devoncarew committed May 16, 2018
    Copy the full SHA
    e838ecb View commit details
  2. Merge pull request #31 from dart-lang/change_verbose_logging

    Change verbose logging
    devoncarew authored May 16, 2018
    Copy the full SHA
    352a8f8 View commit details

Commits on May 30, 2018

  1. Fix dart:io constants. (#32)

    * Stop using deprecated upper-case constant name.
    lrhn authored May 30, 2018
    Copy the full SHA
    67c3e69 View commit details

Commits on Jun 21, 2018

  1. remove preview-dart2 flag

    pq authored Jun 21, 2018
    Copy the full SHA
    235c372 View commit details
  2. Merge pull request #34 from dart-lang/pq-patch-1

    remove preview-dart2 flag
    pq authored Jun 21, 2018
    Copy the full SHA
    3c604ea View commit details

Commits on Jul 2, 2018

  1. goodbye strong

    pq committed Jul 2, 2018
    Copy the full SHA
    628ec70 View commit details

Commits on Jul 3, 2018

  1. Merge pull request #35 from dart-lang/rm_strong

    goodbye `strong`
    pq authored Jul 3, 2018
    Copy the full SHA
    fb5ee65 View commit details

Commits on Jul 16, 2018

  1. 0.1.3+2

    pq committed Jul 16, 2018
    Copy the full SHA
    2b11c53 View commit details
  2. bumped test dep

    pq committed Jul 16, 2018
    Copy the full SHA
    5420c44 View commit details
  3. Merge pull request #36 from dart-lang/0.1.3+2

    0.1.3+2
    pq authored Jul 16, 2018
    Copy the full SHA
    4ad7ccb View commit details

Commits on Apr 29, 2019

  1. Copy the full SHA
    c9af735 View commit details

Commits on May 4, 2020

  1. Copy the full SHA
    94889b7 View commit details

Commits on Jun 3, 2020

  1. Add write() and writeCharCode() to Logger (#42)

    Add write() and writeCharCode() methods to Logger
    srawlins authored Jun 3, 2020
    Copy the full SHA
    a4d9ff3 View commit details

Commits on Aug 19, 2020

  1. Copy the full SHA
    42678bb View commit details
  2. Copy the full SHA
    335ed16 View commit details

Commits on Nov 2, 2020

  1. add support for github actions (#49)

    add support for github actions
    devoncarew authored Nov 2, 2020
    Copy the full SHA
    c77d27e View commit details
  2. Copy the full SHA
    b5291bc View commit details
  3. Add cron task (#51)

    kevmoo authored Nov 2, 2020
    Copy the full SHA
    c796cb7 View commit details

Commits on Nov 9, 2020

  1. nnbd migration (#52)

    * nnbd migration
    
    * bump to dev container
    
    * updated version
    
    * + notes
    pq authored Nov 9, 2020
    Copy the full SHA
    50cc840 View commit details
Showing with 748 additions and 139 deletions.
  1. +0 −2 .analysis_options
  2. +15 −0 .github/dependabot.yml
  3. +55 −0 .github/workflows/build.yaml
  4. +37 −0 .github/workflows/no-response.yml
  5. +14 −0 .github/workflows/publish.yaml
  6. +3 −9 .gitignore
  7. +0 −3 .status
  8. +0 −3 .travis.yml
  9. +88 −1 CHANGELOG.md
  10. +1 −1 CONTRIBUTING.md
  11. +3 −2 LICENSE
  12. +48 −11 README.md
  13. +33 −0 analysis_options.yaml
  14. +0 −3 codereview.settings
  15. +24 −0 example/main.dart
  16. +316 −0 lib/cli_logging.dart
  17. +73 −58 lib/cli_util.dart
  18. +10 −7 pubspec.yaml
  19. +28 −13 test/cli_util_test.dart
  20. +0 −26 tool/travis.sh
2 changes: 0 additions & 2 deletions .analysis_options

This file was deleted.

15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Dependabot configuration file.
# See https://docs.github.com/en/code-security/dependabot/dependabot-version-updates
version: 2

updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
labels:
- autosubmit
groups:
github-actions:
patterns:
- "*"
55 changes: 55 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Dart CI

on:
schedule:
# “At 00:00 (UTC) on Sunday.”
- cron: '0 0 * * 0'
pull_request:
branches: [ master ]
push:
branches: [ master ]

env:
PUB_ENVIRONMENT: bot.github

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'
37 changes: 37 additions & 0 deletions .github/workflows/no-response.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# A workflow to close issues where the author hasn't responded to a request for
# more information; see https://github.com/actions/stale.

name: No Response

# Run as a daily cron.
on:
schedule:
# Every day at 8am
- cron: '0 8 * * *'

# All permissions not specified are set to 'none'.
permissions:
issues: write
pull-requests: write

jobs:
no-response:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'dart-lang' }}
steps:
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e
with:
# Don't automatically mark inactive issues+PRs as stale.
days-before-stale: -1
# Close needs-info issues and PRs after 14 days of inactivity.
days-before-close: 14
stale-issue-label: "needs-info"
close-issue-message: >
Without additional information we're not able to resolve this issue.
Feel free to add more info or respond to any questions above and we
can reopen the case. Thanks for your contribution!
stale-pr-label: "needs-info"
close-pr-message: >
Without additional information we're not able to resolve this PR.
Feel free to add more info or respond to any questions above.
Thanks for your contribution!
14 changes: 14 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# A CI configuration to auto-publish pub packages.

name: Publish

on:
pull_request:
branches: [ master ]
push:
tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ]

jobs:
publish:
if: ${{ github.repository_owner == 'dart-lang' }}
uses: dart-lang/ecosystem/.github/workflows/publish.yaml@main
12 changes: 3 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
.buildlog
.DS_Store
.idea
.pub/
.project
.settings
build/
packages
pubspec.lock
.dart_tool/
.packages
pubspec.lock
3 changes: 0 additions & 3 deletions .status

This file was deleted.

3 changes: 0 additions & 3 deletions .travis.yml

This file was deleted.

89 changes: 88 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,91 @@
# Changelog
## 0.4.2-wip

- Add `sdkPath` getter, deprecate `getSdkPath` function.

## 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

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ All submissions, including submissions by project members, require review.
### File headers
All files in the project must start with the following header.

// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// 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.

5 changes: 3 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Copyright 2015, the Dart project authors. All rights reserved.
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:
@@ -9,7 +10,7 @@ met:
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 Inc. nor the names of its
* 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.

59 changes: 48 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# cli_util
> [!IMPORTANT]
> This repo has moved to https://github.com/dart-lang/tools/tree/main/pkgs/cli_util
A library to help in building Dart command-line apps.
[![Dart CI](https://github.com/dart-lang/cli_util/actions/workflows/build.yaml/badge.svg)](https://github.com/dart-lang/cli_util/actions/workflows/build.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)

In particular, `cli_util` provides a simple, standardized way to get the current
SDK directory. Useful, especially, when building client applications that
interact with the Dart SDK (such as the [analyzer][analyzer]).
A package to help in building Dart command-line apps.

[![Build Status](https://travis-ci.org/dart-lang/cli_util.svg)](https://travis-ci.org/dart-lang/cli_util)
## What's this?

## Usage
`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';
@@ -17,18 +23,49 @@ import 'package:cli_util/cli_util.dart';
import 'package:path/path.dart' as path;
main(args) {
// Get sdk dir from cli_util
Directory sdkDir = getSdkDir(args);
// Get SDK directory from cli_util.
var sdkDir = sdkPath;
// Do stuff... For example, print version string
File versionFile = new File(path.join(sdkDir.path, 'version'));
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].

[analyzer]: https://pub.dartlang.org/packages/analyzer
[tracker]: https://github.com/dart-lang/cli_util/issues
33 changes: 33 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# 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
- package_api_docs
- 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
3 changes: 0 additions & 3 deletions codereview.settings

This file was deleted.

Loading