Table of Contents

Bodu.Globalization.Calendar.Tool Namespace

Package
Bodu.Globalization.Calendar.Tool 0.7.1 (not published on nuget.org)

Bodu.Globalization.Calendar.Tool

Purpose

Bodu.Globalization.Calendar.Tool is the bodu-calendar command-line tool (built from a clone - it is not published to nuget.org): it validates notable-date XML / JSON documents with the stable BODU-CAL-* diagnostics (lint), compiles them to sealed .bcal binary rule packs (compile), and inspects compiled packs (info). The namespace holds the tool's in-process entry point, CalendarTool, which the console host, the Bodu.Globalization.Calendar.Build MSBuild task, and the test suite all share - so the build-time compiler and the command line are one code path.

The package is published as Preview. It depends on Bodu.Globalization.Calendar and performs every load through NotableDateResourceLoader in collect mode, resolving imports first from an optional --resolver-dir and then from the bundled CommonNotableDateResources.

Static documentation

Key types

  • CalendarTool - the static command surface. Run(string[] args, TextWriter output, TextWriter error) dispatches the lint / compile / info verbs (case-insensitive), writes normal output to output and errors plus usage help to error, and returns the process exit code. The exit codes are exposed as constants: ExitSuccess (0), ExitFailure (1 - a validation or input failure), and ExitUsage (2 - a usage error). Diagnostics print one per line as [Severity] CODE: message.

Example

using Bodu.Globalization.Calendar.Tool;

// Drive the tool in process - the same path the console host and the MSBuild task use.
int exitCode = CalendarTool.Run(
    ["compile", "rules/holidays.xml", "-o", "packs/holidays.bcal", "--resolver-dir", "rules/shared"],
    Console.Out,
    Console.Error);

if (exitCode != CalendarTool.ExitSuccess)
{
    // ExitFailure: the document reported BODU-CAL-* errors (printed to the error writer) or the input was missing.
    // ExitUsage:   a bad verb, option, or extension; usage help was printed to the error writer.
    Console.Error.WriteLine($"bodu-calendar exited with {exitCode}");
}

Notes

  • Preview. The verb set and option names may still change between releases without a major-version bump.
  • No public API beyond Run. The tool is meant to be installed and invoked, or hosted through the Bodu.Globalization.Calendar.Build package; consumers who want to compile packs from code should use NotableDateDocumentBuilder.SaveBinary or NotableDateBinaryResource.Write directly rather than referencing this assembly.

Classes

CalendarTool

Implements the bodu-calendar command surface - lint, compile, and info - as an in-process entry point the console host and the tests share.