tom_build_base 2.6.19 copy "tom_build_base: ^2.6.19" to clipboard
tom_build_base: ^2.6.19 copied to clipboard

Unified CLI framework for workspace traversal, tool definition, pipeline execution, and build configuration.

example/tom_build_base_example.dart

/// Minimal example of a tool built with `tom_build_base`.
///
/// Defines a multi-command tool with two commands (`hello` and `list`)
/// and runs it via [ToolRunner].
library;

import 'dart:io';

import 'package:tom_build_base/tom_build_base.dart';

/// Tool definition — declared once, immutable.
const exampleTool = ToolDefinition(
  name: 'example',
  description: 'Example tool demonstrating tom_build_base',
  version: '1.0.0',
  mode: ToolMode.multiCommand,
  features: NavigationFeatures.projectTool,
  commands: [
    CommandDefinition(
      name: 'hello',
      description: 'Print a greeting for each project',
      aliases: ['hi'],
    ),
    CommandDefinition(
      name: 'list',
      description: 'List discovered Dart projects',
      aliases: ['ls'],
      requiredNatures: {DartProjectFolder},
    ),
  ],
);

void main(List<String> args) async {
  final runner = ToolRunner(
    tool: exampleTool,
    executors: {
      'hello': CallbackExecutor(
        onExecute: (context, args) async {
          print('Hello from ${context.name}!');
          return ItemResult.success(path: context.path, name: context.name);
        },
      ),
      'list': CallbackExecutor(
        onExecute: (context, args) async {
          final dart = context.getNature<DartProjectFolder>();
          print('  ${dart.projectName} v${dart.version}');
          return ItemResult.success(path: context.path, name: context.name);
        },
      ),
    },
  );

  final result = await runner.run(args);
  exit(result.success ? 0 : 1);
}
1
likes
0
points
243
downloads

Publisher

unverified uploader

Weekly Downloads

Unified CLI framework for workspace traversal, tool definition, pipeline execution, and build configuration.

Homepage
Repository (GitHub)
View/report issues

Topics

#build-tools #cli #configuration

License

unknown (license)

Dependencies

args, console_markdown, dcli, glob, path, yaml

More

Packages that depend on tom_build_base