COMMAND_DART_TPL top-level constant

String const COMMAND_DART_TPL

Template for generating a new CardinalCommand file. Used by the add command.

Variables:

  • {{commandClassName}}: The PascalCase class name (e.g., NewCommand).
  • {{commandName}}: The CLI command name (e.g., new).

Implementation

const String COMMAND_DART_TPL = r'''
import 'package:cardinal/cardinal.dart';

class {{commandClassName}} extends CardinalCommand {
  {{commandClassName}}() : super(
      name: '{{commandName}}',
      description: 'A new command created by the CLI.'
      // Define your arguments and options here
    );

  @override
  Future<void> execute(CardinalContext context) async {
    print('{{commandName}} command executed!');
  }
}
''';