Skip to content

Commit

Permalink
feat(cli)!: change --edit preceded to --from and --to
Browse files Browse the repository at this point in the history
  • Loading branch information
hyiso committed Jan 18, 2023
1 parent e3485b1 commit fb9a6a8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ jobs:
# Your project will need to have tests in test/ and a dependency on
# package:test for this step to succeed. Note that Flutter projects will
# want to change this to 'flutter test'.
# - name: Run tests
# run: melos test --no-select
- name: Run tests
run: melos test --no-select
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

melos analyze
melos format-check
# melos test --no-select
melos test --no-select
2 changes: 1 addition & 1 deletion melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ scripts:
exec: dart format . --output=none --set-exit-if-changed
description: Run `dart format` checks for all packages.

version: dart scripts/generate_version.dart && git add packages/commitlit_cli/lib/src/version.g.dart
version: dart scripts/generate_version.dart && git add packages/commitlint_cli/lib/src/version.g.dart
bootstrap: dart pub get && dart run husky install
12 changes: 5 additions & 7 deletions packages/commitlint_cli/lib/src/runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ class CommitLintRunner extends CommandRunner {
help: 'read last commit message from the specified file.')
..addOption('from',
help:
'lower end of the commit range to lint. This is preceded to --edit')
'lower end of the commit range to lint. This is succeeded to --edit')
..addOption('to',
help:
'upper end of the commit range to lint. This is preceded to --edit')
'upper end of the commit range to lint. This is succeeded to --edit')
..addFlag('version',
negatable: false, help: 'display version information');
}
Expand All @@ -46,11 +46,9 @@ class CommitLintRunner extends CommandRunner {
final to = topLevelResults['to'] as String?;
final edit = topLevelResults['edit'] as String?;
bool fromStdin = from == null && to == null && edit == null;
final messages = fromStdin
? await _stdin()
: await read(from: from, to: to, edit: edit ?? '.git/COMMIT_EDITMSG');
final rules = await load(LoadOptions(
cwd: Directory.current.path, file: topLevelResults['config']));
final messages =
fromStdin ? await _stdin() : await read(from: from, to: to, edit: edit);
final rules = await load(file: topLevelResults['config']);
final results = (await Future.wait(
messages.map((message) async => await lint(message, rules))));
if (rules.isEmpty) {
Expand Down
7 changes: 1 addition & 6 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ name: commitlint_monorepo
publish_to: none

environment:
sdk: '>=2.12.0 <3.0.0'
sdk: '>=2.18.0 <3.0.0'

dev_dependencies:
args: ^2.3.1
commitlint_cli: ^0.1.0
commitlint_config: ^0.1.0
commitlint_format: ^0.1.0
Expand Down Expand Up @@ -35,7 +34,3 @@ dependency_overrides:
path: ./packages/commitlint_rules
commitlint_types:
path: ./packages/commitlint_types

# This allows us to use commitlint on itself during development.
executables:
commitlint:

0 comments on commit fb9a6a8

Please sign in to comment.