Differentiated between options and arguments in dynamic field add command.

This commit is contained in:
Stefan Härter 2023-10-10 18:56:37 +02:00
parent 705a352f36
commit 04a2a6adcb

View File

@ -38,55 +38,48 @@ sub Configure {
my ( $Self, %Param ) = @_;
$Self->Description('Create a new dynamic field.');
$Self->AddOption(
$Self->AddArgument(
Name => 'name',
Description => 'Name for the new field.',
Required => 1,
HasValue => 1,
ValueRegex => qr/[A-Za-z0-9]+/smx,
);
$Self->AddOption(
$Self->AddArgument(
Name => 'label',
Description => 'Label which will be displayed alongside the field.',
Required => 1,
HasValue => 1,
ValueRegex => qr/.*/smx,
);
$Self->AddOption(
$Self->AddArgument(
Name => 'field-type',
Description => 'Dynamic field type.',
Required => 1,
HasValue => 1,
ValueRegex => qr/[A-Za-z0-9]/smx,
);
$Self->AddOption(
$Self->AddArgument(
Name => 'object-type',
Description => 'Object type for the new field.',
Required => 1,
HasValue => 1,
ValueRegex => qr/[A-Za-z0-9]/smx,
);
$Self->AddOption(
$Self->AddArgument(
Name => 'config',
Description =>
'Config for dynamic field. Takes either an YAML or JSON string. See also Admin::DynamicField::ConfigDump and Admin::DynamicField::ConfigBuild.',
Required => 0,
HasValue => 1,
ValueRegex => qr/.*/smx,
);
$Self->AddOption(
$Self->AddArgument(
Name => 'namespace',
Description => 'Namespace to place the new field into.',
Required => 0,
HasValue => 1,
ValueRegex => qr/[A-Za-z0-9]+/smx,
);
$Self->AddOption(
$Self->AddArgument(
Name => 'field-order',
Description =>
'Field order to place the field at. Defaults to hightest order plus 1. Per default, other fields are reordered if an occupied order number is chosen.',
Required => 0,
HasValue => 1,
ValueRegex => qr/\d+/smx,
);
$Self->AddOption(
@ -96,11 +89,10 @@ sub Configure {
HasValue => 1,
ValueRegex => qr/^[[0-1]{1}$/smx,
);
$Self->AddOption(
$Self->AddArgument(
Name => 'valid',
Description => 'Whether the field to add is valid or invalid. Defaults to 1.',
Required => 0,
HasValue => 1,
ValueRegex => qr/^[0-1]{1}$/smx,
);
$Self->AddOption(