### Pre-release Version Tag Example Source: https://github.com/serverpod/cli_tools/blob/main/PUBLISH.md Provides an example of a tag format used for pre-release versions, including a suffix. ```Text v1.0.0-dev.1 ``` -------------------------------- ### Defining Option with Config Key (Dart) Source: https://github.com/serverpod/cli_tools/blob/main/README.md This Dart snippet shows how to define a `DurationOption` that can receive its value from a configuration broker. The `configKey` parameter specifies the key (using JSON pointer syntax in this example) to look up the value within the configuration source provided by the broker. ```Dart interval(DurationOption( argName: 'interval', argAbbrev: 'i', configKey: '/interval', // JSON pointer )); ``` -------------------------------- ### Defining and Accessing Options with a Static Class and List Source: https://github.com/serverpod/cli_tools/blob/main/README.md Shows an alternative method for defining options using static constants within an abstract class and collecting them into a list of OptionDefinition. Also demonstrates accessing these options from a Configuration object. ```Dart abstract final class _ProjectOptions { static const name = StringOption( argName: 'name', mandatory: true ); static const enable = FlagOption( argName: 'enable', defaultsTo: false, ); static createOptions = [ name, enable, ]; } ... Future runWithConfig( final Configuration commandConfig, ) async { final name = commandConfig.value(_ProjectOptions.name); final enable = commandConfig.value(_ProjectOptions.enable); ... } ``` -------------------------------- ### Implementing File Configuration Broker (Dart) Source: https://github.com/serverpod/cli_tools/blob/main/README.md This Dart class implements the `ConfigurationBroker` interface to read configuration values from a file. It lazy-loads the configuration source using `ConfigurationParser.fromFile`, allowing the configuration file path to be determined by another option's value. ```Dart class FileConfigBroker implements ConfigurationBroker { ConfigurationSource? _configSource; FileConfigBroker(); @override String? valueOrNull(final String key, final Configuration cfg) { // By lazy-loading the config, the file path can depend on another option _configSource ??= ConfigurationParser.fromFile( cfg.value(TimeSeriesOption.configFile).path, ); final value = _configSource?.valueOrNull(key); return value is String ? value : null; } } ``` -------------------------------- ### Defining Configuration Options with Qualified Keys (Dart) Source: https://github.com/serverpod/cli_tools/blob/main/README.md This snippet demonstrates how to define command-line options using DirOption and StringOption within the Serverpod CLI framework. It shows the use of the 'configKey' parameter with a qualified key format (e.g., 'domain:/key') to associate the option with a specific configuration domain. ```Dart dir(DirOption( argName: 'dir', configKey: 'local:/dir', helpText: 'the local directory', )), host(StringOption( argName: 'host', configKey: 'remote:/host', helpText: 'the remote host name', )); ``` -------------------------------- ### Using ConfigParser as ArgParser Replacement (Dart) Source: https://github.com/serverpod/cli_tools/blob/main/README.md Demonstrates how to use `ConfigParser` as a direct replacement for `ArgParser` from the 'args' package. It shows adding a flag, adding options with default values, and adding an option that can also be sourced from an environment variable. The `parse` method is used to process command-line arguments. ```Dart final parser = ConfigParser(); // instead of ArgParser() parser.addFlag('verbose', abbr: 'v'); parser.addOption('port', defaultsTo: '8080'); parser.addOption('host', envName: 'HOST'); // using env feature final results = parser.parse(['--verbose', '--port', '3000']); ``` -------------------------------- ### Standard Version Tag Format Source: https://github.com/serverpod/cli_tools/blob/main/PUBLISH.md Specifies the required format for standard release tags, following Semantic Versioning principles. ```Text vX.Y.Z ``` -------------------------------- ### Resolving Configuration with File Broker (Dart) Source: https://github.com/serverpod/cli_tools/blob/main/README.md This snippet demonstrates how to resolve a `Configuration` object in Dart, providing a `FileConfigBroker` instance to enable reading configuration values from files. It includes standard parameters like `options`, `argResults`, and `env`. ```Dart Configuration.resolve( options: options, argResults: argResults, env: envVariables, configBroker: FileConfigBroker(), ); ``` -------------------------------- ### Defining Command Options with a Dart Enum Source: https://github.com/serverpod/cli_tools/blob/main/README.md Defines a set of command options using a Dart enum that implements OptionDefinition. Each enum value represents a specific option with its type, name, help text, default value, and source mapping (e.g., argName, envName). ```Dart import 'package:cli_tools/config.dart'; enum LogOption implements OptionDefinition { limit(IntOption( argName: 'limit', helpText: 'The maximum number of log records to fetch.', defaultsTo: 50, min: 0, )), utc(FlagOption( argName: 'utc', argAbbrev: 'u', helpText: 'Display timestamps in UTC timezone instead of local.', defaultsTo: false, envName: 'DISPLAY_UTC', )), recent(DurationOption( argName: 'recent', argAbbrev: 'r', argPos: 0, helpText: 'Fetch records from the recent period. ' 'Can also be specified as the first argument.', min: Duration.zero, )), before(DateTimeOption( argName: 'before', helpText: 'Fetch records from before this timestamp.', )); const LogOption(this.option); @override final ConfigOptionBase option; } ``` -------------------------------- ### Accessing Enum-Defined Options from Configuration Source: https://github.com/serverpod/cli_tools/blob/main/README.md Demonstrates how to retrieve the resolved values of options defined by an enum (like LogOption) from a Configuration object. Uses `commandConfig.value()` for options guaranteed to have a value and `commandConfig.optionalValue()` for potentially null options. ```Dart Future runWithConfig( final Configuration commandConfig, ) async { final limit = commandConfig.value(LogOption.limit); final inUtc = commandConfig.value(LogOption.utc); final recentOpt = commandConfig.optionalValue(LogOption.recent); final beforeOpt = commandConfig.optionalValue(LogOption.before); ... } ``` -------------------------------- ### Changelog File Name Source: https://github.com/serverpod/cli_tools/blob/main/PUBLISH.md Refers to the file used as the authoritative source for changelog information on pub.dev. ```Text CHANGELOG.md ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.