Improving CLI detection function to prevent web-based usage.