use crate::cli::ShellType;
use crate::core::VirtualenvService;
use crate::error::Result;
use crate::paths;
use crate::shell::{detect_shell, print_activate_script};
use crate::validate;
pub fn execute(name: &str, shell: Option<ShellType>) -> Result<()> {
validate::validate_env_name(name)?;
let service = VirtualenvService::auto()?;
let venv_path = service.get_path(name)?;
let bin_path = paths::virtualenv_bin(name)?;
let shell_type = shell.unwrap_or_else(detect_shell);
print_activate_script(shell_type, &venv_path, &bin_path, name);
Ok(())
}