Arguments.fromArgResults constructor

Arguments.fromArgResults(
  1. ArgResults argResults,
  2. ArgResults? globalResults
)

Creates Arguments instance from command-line arguments.

Parses command-line arguments and optional global results to create a fully configured GitHub Arguments instance. Handles type conversion and validation for all GitHub-specific parameters.

Parameters:

  • argResults - Parsed command-line arguments
  • globalResults - Optional global command arguments

Returns configured Arguments instance with parsed values. Binary type is set to empty string as it's determined during upload.

Note: Binary type filtering is handled during file processing rather than at argument parsing time for flexibility.

Implementation

factory Arguments.fromArgResults(
  ArgResults argResults,
  ArgResults? globalResults,
) {
  return Arguments(
    Variables.fromSystem(globalResults),
    filePath: argResults['file-path'] as String,
    binaryType: '', // Provide a default or derive this value as needed
    repoName: argResults['repo-name'] as String,
    repoOwner: argResults['repo-owner'] as String,
    token: argResults['token'] as String,
    releaseName: argResults['release-name'] as String,
    releaseBody: argResults['release-body'] ?? "",
  );
}