use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; class MyCommand extends Command { protected function configure() { $this ->setName('my-command') ->setDescription('Example command') ->addOption( 'force-interactive', null, InputOption::VALUE_NONE, 'Set to force interactive mode' ); } protected function execute(InputInterface $input, OutputInterface $output) { if ($input->getOption('force-interactive')) { $input->setInteractive(true); } else { $input->setInteractive(false); } // Your command logic here } }In this example, the `MyCommand` class defines an option `--force-interactive` that, when used, will force the script to run in interactive mode. In the `execute()` method, the `setInteractive()` method is used to set the interactive mode based on the value of the `--force-interactive` option. The Symfony\Component\Console\Input\InputInterface package is required to use the `InputInterface` class and its methods, including `setInteractive()`.