->
addArgument('version', InputArgument::OPTIONAL, 'A version of release. It should be 4-digits type'
) ->
addOption('dry-run', null, InputOption::VALUE_NONE, 'Use the --dry-run argument to preview the changelog content and prevent actually writing to file.'
) ->
addOption('force', 'f', InputOption::VALUE_NONE, 'Use the --force argument to override an existing release.'
);
} protected function execute(InputInterface
$input, OutputInterface
$output): int
{ $IOHelper =
new SymfonyStyle($input,
$output);
$IOHelper->
title('Creating or updating the final changelog for a new release'
);
$version =
$input->
getArgument('version'
) ??
$IOHelper->
ask('A version of release', null,
function D
$version) { if (!
$version) { throw new \
RuntimeException('Version of release is required.'
);
} return $version;
});
if (!
preg_match("/^\d+(\.\d+){3}$/",
(string) $version)) { throw new \
RuntimeException('Invalid version of release ("' .
$version . '"). It should be 4-digits type'
);
} $force =
$input->
getOption('force'
);