mad_scripts_base 1.0.0 copy "mad_scripts_base: ^1.0.0" to clipboard
mad_scripts_base: ^1.0.0 copied to clipboard

A lightweight Dart developer toolkit for building CLI automation scripts, code generators, and DevOps tools. Includes command base classes, colorful console output, configuration handling, file manag [...]

example/mad_scripts_base_example.dart

import 'package:mad_scripts_base/mad_scripts_base.dart';

void main(List<String> arguments) async {
  CommandRunner<bool>('scripts', 'Various scripts to help generate code.')
    ..addCommand(ExampleCommand())
    ..run(arguments);
}

class ExampleCommand extends ScriptCommand<bool>{
  @override
  String get description => 'Example command';

  @override
  String get name => 'example';

  @override
  String? get defaultConfig => 'example_config.json';

  @override
  Future<bool> runWrapped() async {
    output.info('Example command');
    final config = ConfigReader.fromFile(configPath ?? '', transformer: ExampleConfigModel.fromMap);
    output.debug(config.toString());

    return true;
  }
}

class ExampleConfigModel{
  const ExampleConfigModel({required this.path});

  final String path;

  factory ExampleConfigModel.fromMap(Map<String, dynamic> map) {
    return ExampleConfigModel(
      path: map['path'] as String,
    );
  }

  @override
  String toString() {
    return 'ExampleConfigModel(path: $path)';
  }
}
0
likes
130
points
136
downloads

Publisher

verified publishermadbrains.ru

Weekly Downloads

A lightweight Dart developer toolkit for building CLI automation scripts, code generators, and DevOps tools. Includes command base classes, colorful console output, configuration handling, file management, Mustache-based templates, and analyzer extensions for code modification.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

analyzer, args, mustache_template, path, yaml, yaml_edit

More

Packages that depend on mad_scripts_base