There are some ways to set environment when running in CLI mode for Codeigniter 3:
$ CI_ENV="production" php index.php welcome/index
You could create a bootstrap for CLI with production environment concern:
In Codeigniter webroot: ./cli-prod.php
if (php_sapi_name() !== 'cli') {
die('Access Denied');
}
define('ENVIRONMENT', 'production');
require __DIR__ . '/index.php';
After that, run command likes:
php ./cli-prod.php controller/action