diff --git a/elasticms-cli/src/Command/Document/DocumentUpdateCommand.php b/elasticms-cli/src/Command/Document/DocumentUpdateCommand.php index f1286bea6..2aedbc2b5 100644 --- a/elasticms-cli/src/Command/Document/DocumentUpdateCommand.php +++ b/elasticms-cli/src/Command/Document/DocumentUpdateCommand.php @@ -11,11 +11,17 @@ use EMS\CommonBundle\Common\Admin\AdminHelper; use EMS\CommonBundle\Common\Command\AbstractCommand; use EMS\CommonBundle\Contracts\File\FileReaderInterface; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: Commands::DOCUMENTS_UPDATE, + description: 'Update documents from excel or csv file with custom configuration.', + hidden: false +)] final class DocumentUpdateCommand extends AbstractCommand { private string $configFile; @@ -26,8 +32,6 @@ final class DocumentUpdateCommand extends AbstractCommand private bool $dataSkipFirstRow; private bool $dryRun; - protected static $defaultName = Commands::DOCUMENTS_UPDATE; - private const ARGUMENT_DATA_FILE = 'data-file'; private const ARGUMENT_CONFIG_FILE = 'config-file'; private const OPTION_DATA_OFFSET = 'data-offset'; @@ -43,7 +47,6 @@ public function __construct(private readonly AdminHelper $adminHelper, private r protected function configure(): void { $this - ->setDescription('Update documents from excel or csv file with custom configuration') ->addArgument(self::ARGUMENT_CONFIG_FILE, InputArgument::REQUIRED, 'Config file (json)') ->addArgument(self::ARGUMENT_DATA_FILE, InputArgument::REQUIRED, 'Data file (excel or csv)') ->addOption(self::OPTION_DATA_OFFSET, null, InputOption::VALUE_REQUIRED, 'Offset data', 0) diff --git a/elasticms-cli/src/Command/File/AuditFileCommand.php b/elasticms-cli/src/Command/File/AuditFileCommand.php index 695c31acc..e80d4a00d 100644 --- a/elasticms-cli/src/Command/File/AuditFileCommand.php +++ b/elasticms-cli/src/Command/File/AuditFileCommand.php @@ -8,6 +8,7 @@ use App\CLI\Commands; use EMS\CommonBundle\Common\Command\AbstractCommand; use EMS\Helpers\File\File; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Logger\ConsoleLogger; @@ -15,9 +16,13 @@ use Symfony\Component\Finder\Finder; use Symfony\Component\Mime\MimeTypes; +#[AsCommand( + name: Commands::FILE_AUDIT, + description: 'Audit files in a folder structure.', + hidden: false +)] class AuditFileCommand extends AbstractCommand { - protected static $defaultName = Commands::FILE_AUDIT; final public const UPPERCASE_EXTENSION = 'ExtensionWithUppercase'; final public const EXTENSION_MISMATCH = 'ExtensionMismatch'; @@ -37,7 +42,6 @@ public function __construct() protected function configure(): void { $this - ->setDescription('Audit files in a folder structure') ->addArgument( self::ARG_FOLDER, InputArgument::REQUIRED, diff --git a/elasticms-cli/src/Command/FileReader/FileReaderImportCommand.php b/elasticms-cli/src/Command/FileReader/FileReaderImportCommand.php index f8e92b15c..a41ae48dc 100644 --- a/elasticms-cli/src/Command/FileReader/FileReaderImportCommand.php +++ b/elasticms-cli/src/Command/FileReader/FileReaderImportCommand.php @@ -9,16 +9,20 @@ use EMS\CommonBundle\Common\Command\AbstractCommand; use EMS\CommonBundle\Contracts\File\FileReaderInterface; use EMS\CommonBundle\Search\Search; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\ExpressionLanguage\ExpressionLanguage; +#[AsCommand( + name: Commands::FILE_READER_IMPORT, + description: 'Import an Excel file or a CSV file, one document per row.', + hidden: false +)] final class FileReaderImportCommand extends AbstractCommand { - protected static $defaultName = Commands::FILE_READER_IMPORT; - private const ARGUMENT_FILE = 'file'; private const ARGUMENT_CONTENT_TYPE = 'content-type'; private const OPTION_OUUID_EXPRESSION = 'ouuid-expression'; @@ -44,7 +48,6 @@ public function __construct(private readonly AdminHelper $adminHelper, private r protected function configure(): void { $this - ->setDescription('Import an Excel file or a CSV file, one document per row') ->addArgument(self::ARGUMENT_FILE, InputArgument::REQUIRED, 'File path (xlsx or csv)') ->addArgument(self::ARGUMENT_CONTENT_TYPE, InputArgument::REQUIRED, 'Content type target') ->addOption(self::OPTION_DRY_RUN, null, InputOption::VALUE_NONE, 'Just do a dry run') diff --git a/elasticms-cli/src/Command/MediaLibrary/LoadTikaCache.php b/elasticms-cli/src/Command/MediaLibrary/LoadTikaCache.php index 91b44c6bf..7ce776743 100644 --- a/elasticms-cli/src/Command/MediaLibrary/LoadTikaCache.php +++ b/elasticms-cli/src/Command/MediaLibrary/LoadTikaCache.php @@ -7,15 +7,19 @@ use App\CLI\Commands; use App\CLI\Helper\Tika\TikaHelper; use EMS\CommonBundle\Common\Command\AbstractCommand; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Finder\Finder; +#[AsCommand( + name: Commands::MEDIA_LIBRARY_TIKA_CACHE, + description: 'Generate a tika cache from files in a given folder.', + hidden: false +)] final class LoadTikaCache extends AbstractCommand { - protected static $defaultName = Commands::MEDIA_LIBRARY_TIKA_CACHE; - private const ARGUMENT_FOLDER = 'folder'; private const ARGUMENT_TIKA_CACHE_FOLDER = 'tika-cache-folder'; private string $folder; @@ -24,7 +28,6 @@ final class LoadTikaCache extends AbstractCommand protected function configure(): void { $this - ->setDescription('Generate a tika cache from files in a given folder') ->addArgument(self::ARGUMENT_FOLDER, InputArgument::REQUIRED, 'Folder path') ->addArgument(self::ARGUMENT_TIKA_CACHE_FOLDER, InputArgument::REQUIRED, 'Folder where tika extraction can be cached') ; diff --git a/elasticms-cli/src/Command/MediaLibrary/MediaLibrarySyncCommand.php b/elasticms-cli/src/Command/MediaLibrary/MediaLibrarySyncCommand.php index a9467f69a..83304ed43 100644 --- a/elasticms-cli/src/Command/MediaLibrary/MediaLibrarySyncCommand.php +++ b/elasticms-cli/src/Command/MediaLibrary/MediaLibrarySyncCommand.php @@ -12,15 +12,19 @@ use EMS\CommonBundle\Common\Command\AbstractCommand; use EMS\CommonBundle\Contracts\ExpressionServiceInterface; use EMS\CommonBundle\Contracts\File\FileReaderInterface; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: Commands::MEDIA_LIBRARY_SYNC, + description: 'Synchronization files on media library for a given folder.', + hidden: false +)] final class MediaLibrarySyncCommand extends AbstractCommand { - protected static $defaultName = Commands::MEDIA_LIBRARY_SYNC; - private const ARGUMENT_FOLDER = 'folder'; private const OPTION_CONTENT_TYPE = 'content-type'; private const OPTION_FOLDER_FIELD = 'folder-field'; @@ -56,7 +60,6 @@ public function __construct( protected function configure(): void { $this - ->setDescription('Synchronization files on media library for a given folder') ->addArgument(self::ARGUMENT_FOLDER, InputArgument::REQUIRED, 'Folder path') ->addOption(self::OPTION_CONTENT_TYPE, null, InputOption::VALUE_OPTIONAL, 'Media Library content type (default: media_file)', 'media_file') ->addOption(self::OPTION_FOLDER_FIELD, null, InputOption::VALUE_OPTIONAL, 'Media Library folder field (default: media_folder)', 'media_folder') diff --git a/elasticms-cli/src/Command/Photos/ApplePhotosMigrationCommand.php b/elasticms-cli/src/Command/Photos/ApplePhotosMigrationCommand.php index ebb30d84a..f1b9cbfba 100644 --- a/elasticms-cli/src/Command/Photos/ApplePhotosMigrationCommand.php +++ b/elasticms-cli/src/Command/Photos/ApplePhotosMigrationCommand.php @@ -6,14 +6,18 @@ use App\CLI\Client\Photos\PhotosLibraryInterface; use App\CLI\Commands; use EMS\CommonBundle\Common\Admin\AdminHelper; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: Commands::APPLE_PHOTOS_MIGRATION, + description: 'Migrate Apple Photo library to elaticms documents.', + hidden: false +)] class ApplePhotosMigrationCommand extends AbstractPhotosMigrationCommand { - protected static $defaultName = Commands::APPLE_PHOTOS_MIGRATION; - final public const ARG_PHOTOS_LIBRARY_PATH = 'photos-library-path'; private string $applePhotosPathPath; @@ -25,7 +29,6 @@ public function __construct(AdminHelper $adminHelper) protected function configure(): void { $this - ->setDescription('Migrate Apple Photo library to elaticms documents') ->addArgument( self::ARG_PHOTOS_LIBRARY_PATH, InputArgument::REQUIRED, diff --git a/elasticms-cli/src/Command/Web/AuditCommand.php b/elasticms-cli/src/Command/Web/AuditCommand.php index 155e50d2b..ed712f456 100644 --- a/elasticms-cli/src/Command/Web/AuditCommand.php +++ b/elasticms-cli/src/Command/Web/AuditCommand.php @@ -22,16 +22,20 @@ use EMS\CommonBundle\Contracts\CoreApi\Endpoint\Data\DataInterface; use EMS\CommonBundle\Elasticsearch\Document\EMSSource; use EMS\Helpers\Standard\Json; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Logger\ConsoleLogger; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: Commands::WEB_AUDIT, + description: 'Audit (security headers, content, locale, accessibility) website.', + hidden: false +)] class AuditCommand extends AbstractCommand { - protected static $defaultName = Commands::WEB_AUDIT; - private const ARG_URL = 'url'; private const OPTION_CONTINUE = 'continue'; private const OPTION_CACHE_FOLDER = 'cache-folder'; @@ -77,7 +81,6 @@ public function __construct(private readonly AdminHelper $adminHelper) protected function configure(): void { $this - ->setDescription('Audit (security headers, content, locale, accessibility) website') ->addArgument( self::ARG_URL, InputArgument::REQUIRED, diff --git a/elasticms-cli/src/Command/Web/MigrationCommand.php b/elasticms-cli/src/Command/Web/MigrationCommand.php index 55aee03cf..098811902 100644 --- a/elasticms-cli/src/Command/Web/MigrationCommand.php +++ b/elasticms-cli/src/Command/Web/MigrationCommand.php @@ -13,16 +13,20 @@ use EMS\CommonBundle\Common\Admin\AdminHelper; use EMS\CommonBundle\Common\Command\AbstractCommand; use EMS\Helpers\Standard\Json; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Logger\ConsoleLogger; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: Commands::WEB_MIGRATION, + description: 'Migration web resources to elaticms documents.', + hidden: false +)] class MigrationCommand extends AbstractCommand { - protected static $defaultName = Commands::WEB_MIGRATION; - private const ARG_CONFIG_FILE_PATH = 'json-path'; private const OPTION_CONTINUE = 'continue'; private const ARG_OUUID = 'OUUID'; @@ -51,7 +55,6 @@ public function __construct(private readonly AdminHelper $adminHelper) protected function configure(): void { $this - ->setDescription('Migration web resources to elaticms documents') ->addArgument( self::ARG_CONFIG_FILE_PATH, InputArgument::REQUIRED,