base url magento 2 in cli code example
Example 1: get base url in magento 2
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');
$storeManager->getStore()->getBaseUrl();
Example 2: magento set base url command line
php bin/magento setup:store-config:set --base-url="http://localhost:8080/"