-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add!: proper sub commands for bump and log commands
- Loading branch information
1 parent
ac25b19
commit 86e6594
Showing
5 changed files
with
144 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import 'package:cider/src/cli/console.dart'; | ||
import 'package:cider/src/project.dart'; | ||
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) { | ||
argParser | ||
..addFlag('keep-build', help: 'Keep the existing build') | ||
..addFlag('bump-build', help: 'Also bump the build') | ||
..addOption('build', | ||
help: 'Sets the build to the given value', defaultsTo: '') | ||
..addOption('pre', | ||
help: 'Sets the pre-release to the given value', defaultsTo: ''); | ||
} | ||
|
||
@override | ||
final String name; | ||
|
||
@override | ||
final String description; | ||
|
||
final VersionMutation mutation; | ||
|
||
@override | ||
Future<int> exec(Project project) async { | ||
final result = await project.bumpVersion(mutation, | ||
keepBuild: argResults!['keep-build'], | ||
bumpBuild: argResults!['bump-build'], | ||
build: argResults!['build'], | ||
pre: argResults!['pre']); | ||
printer.out.writeln(result); | ||
|
||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import 'package:cider/src/cli/command/log_command.dart'; | ||
import 'package:cider/src/cli/console.dart'; | ||
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); | ||
|
||
@override | ||
final String name; | ||
|
||
@override | ||
final String description; | ||
|
||
final LogType type; | ||
|
||
@override | ||
Future<int> exec(Project project) async { | ||
await project.addUnreleased(type.name, argResults!.rest[0]); | ||
|
||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters