diff --git a/lib/src/cli/command/bump_command.dart b/lib/src/cli/command/bump_command.dart index 5784d4d..ed4a913 100644 --- a/lib/src/cli/command/bump_command.dart +++ b/lib/src/cli/command/bump_command.dart @@ -5,13 +5,21 @@ import 'package:cider/src/cli/command/cider_command.dart'; import 'package:version_manipulation/mutations.dart'; enum BumpType { - breaking, - major, - minor, - patch, - build, - pre, - release, + 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'); + + const BumpType({ + required this.mutation, + required this.description, + }); + + final VersionMutation mutation; + final String description; } class BumpCommand extends CiderCommand { @@ -19,33 +27,13 @@ class BumpCommand extends CiderCommand { for (final type in BumpType.values) { addSubcommand(BumpSubCommand( type.name, - description: _subcommandDescriptions[type]!, - mutation: _mutations[type]!, + description: type.description, + mutation: type.mutation, printer: printer, )); } } - static const _mutations = { - BumpType.breaking: BumpBreaking(), - BumpType.major: BumpMajor(), - BumpType.minor: BumpMinor(), - BumpType.patch: BumpPatch(), - BumpType.build: BumpBuild(), - BumpType.pre: BumpPreRelease(), - BumpType.release: Release(), - }; - - static const _subcommandDescriptions = { - BumpType.breaking: 'Bump the breaking version', - BumpType.major: 'Bump the major version', - BumpType.minor: 'Bump the minor version', - BumpType.patch: 'Bump the patch version', - BumpType.build: 'Bump the build version', - BumpType.pre: 'Bump the pre-release version', - BumpType.release: 'Bump the release version', - }; - @override final name = 'bump'; @override diff --git a/lib/src/cli/command/log_command.dart b/lib/src/cli/command/log_command.dart index 06bc899..f1d0212 100644 --- a/lib/src/cli/command/log_command.dart +++ b/lib/src/cli/command/log_command.dart @@ -4,12 +4,18 @@ import 'package:cider/src/cli/command/log_sub_command.dart'; import 'package:cider/src/project.dart'; enum LogType { - add, - fix, - change, - deprecate, - remove, - security, + 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'); + + const LogType({ + required this.description, + }); + + final String description; } class LogCommand extends CiderCommand { @@ -18,21 +24,12 @@ class LogCommand extends CiderCommand { addSubcommand(LogSubCommand( type.name, type: type, - description: _subcommandDescriptions[type]!, + description: type.description, printer: printer, )); } } - static const _subcommandDescriptions = { - LogType.add: 'Add a new feature to the changelog', - LogType.fix: 'Add a new bug fix to the changelog', - LogType.change: 'Add a new change to the changelog', - LogType.deprecate: 'Add a new deprecation to the changelog', - LogType.remove: 'Add a new removal to the changelog', - LogType.security: 'Add a new security fix to the changelog', - }; - @override final name = 'log'; @override