From 05a15117c3fe706b7dc72e56883d82e61aa3738e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Arnholtz?= Date: Wed, 4 Nov 2020 11:15:08 +0100 Subject: [PATCH] Bring back --using-file flag with a deprecation warning. (#317) --- src/commands/exec.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/commands/exec.rs b/src/commands/exec.rs index 4279cc0..75e63e7 100644 --- a/src/commands/exec.rs +++ b/src/commands/exec.rs @@ -2,8 +2,10 @@ use super::command::Command as Cmd; use crate::choose_version_for_user_input::choose_version_for_user_input; use crate::choose_version_for_user_input::Error as UserInputError; use crate::config::FnmConfig; +use crate::outln; use crate::user_version::UserVersion; use crate::version_files::get_user_version_from_file; +use colored::Colorize; use snafu::{OptionExt, ResultExt, Snafu}; use std::process::{Command, Stdio}; use structopt::StructOpt; @@ -14,12 +16,19 @@ pub struct Exec { arguments: Vec, #[structopt(long = "using")] version: Option, + /// Deprecated. This is the default now. + #[structopt(long = "using-file", hidden = true)] + using_file: bool, } impl Cmd for Exec { type Error = Error; fn apply(self, config: &FnmConfig) -> Result<(), Self::Error> { + if self.using_file { + outln!(config#Error, "{} {} is deprecated. This is now the default.", "warning:".yellow().bold(), "--using-file".italic()); + } + let version = self .version .or_else(|| {