Skip to content

Commit

Permalink
chore: use positional args instead of named ones
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin-kolja committed Jan 31, 2024
1 parent 47dc736 commit c78bc18
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 44 deletions.
28 changes: 11 additions & 17 deletions lib/src/cli/command/bump_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@ import 'package:cider/src/cli/command/cider_command.dart';
import 'package:version_manipulation/mutations.dart';

enum BumpType {
breaking(mutation: BumpBreaking(), description: 'Bump the breaking version'),
major(mutation: BumpMajor(), description: 'Bump the major version'),
minor(mutation: BumpMinor(), description: 'Bump the minor version'),
patch(mutation: BumpPatch(), description: 'Bump the patch version'),
build(mutation: BumpBuild(), description: 'Bump the build version'),
pre(mutation: BumpPreRelease(), description: 'Bump the pre-release version'),
release(mutation: Release(), description: 'Bump the release version');
breaking(BumpBreaking(), 'Bump the breaking version'),
major(BumpMajor(), 'Bump the major version'),
minor(BumpMinor(), 'Bump the minor version'),
patch(BumpPatch(), 'Bump the patch version'),
build(BumpBuild(), 'Bump the build version'),
pre(BumpPreRelease(), 'Bump the pre-release version'),
release(Release(), 'Bump the release version');

const BumpType({
required this.mutation,
required this.description,
});
const BumpType(this.mutation, this.description);

final VersionMutation mutation;
final String description;
Expand All @@ -25,12 +22,9 @@ enum BumpType {
class BumpCommand extends CiderCommand {
BumpCommand(super.printer) {
for (final type in BumpType.values) {
addSubcommand(BumpSubCommand(
type.name,
description: type.description,
mutation: type.mutation,
printer: printer,
));
addSubcommand(
BumpSubCommand(type.name, type.description, type.mutation, printer),
);
}
}

Expand Down
8 changes: 2 additions & 6 deletions lib/src/cli/command/bump_sub_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@ import 'package:cider/src/cli/command/cider_command.dart';
import 'package:version_manipulation/mutations.dart';

class BumpSubCommand extends CiderCommand {
BumpSubCommand(
this.name, {
required this.description,
required this.mutation,
required Console printer,
}) : super(printer) {
BumpSubCommand(this.name, this.description, this.mutation, Console printer)
: super(printer) {
argParser
..addFlag('keep-build', help: 'Keep the existing build')
..addFlag('bump-build', help: 'Also bump the build')
Expand Down
25 changes: 10 additions & 15 deletions lib/src/cli/command/log_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,24 @@ import 'package:cider/src/cli/command/log_sub_command.dart';
import 'package:cider/src/project.dart';

enum LogType {
add(description: 'Add a new feature to the changelog'),
fix(description: 'Add a new bug fix to the changelog'),
change(description: 'Add a new change to the changelog'),
deprecate(description: 'Add a new deprecation to the changelog'),
remove(description: 'Add a new removal to the changelog'),
security(description: 'Add a new security fix to the changelog');
fix('Add a new bug fix to the changelog'),
add('Add a new feature to the changelog'),
change('Add a new change to the changelog'),
deprecate('Add a new deprecation to the changelog'),
remove('Add a new removal to the changelog'),
security('Add a new security fix to the changelog');

const LogType({
required this.description,
});
const LogType(this.description);

final String description;
}

class LogCommand extends CiderCommand {
LogCommand(super.printer) {
for (final type in LogType.values) {
addSubcommand(LogSubCommand(
type.name,
type: type,
description: type.description,
printer: printer,
));
addSubcommand(
LogSubCommand(type.name, type.description, type, printer),
);
}
}

Expand Down
8 changes: 2 additions & 6 deletions lib/src/cli/command/log_sub_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@ import 'package:cider/src/project.dart';
import 'package:cider/src/cli/command/cider_command.dart';

class LogSubCommand extends CiderCommand {
LogSubCommand(
this.name, {
required this.description,
required this.type,
required Console printer,
}) : super(printer);
LogSubCommand(this.name, this.description, this.type, Console printer)
: super(printer);

@override
final String name;
Expand Down

0 comments on commit c78bc18

Please sign in to comment.