Browse Source

Bring back --using-file flag with a deprecation warning. (#317)

remotes/origin/add-with-shims
Bjørn Arnholtz 5 years ago committed by GitHub
parent
commit
05a15117c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      src/commands/exec.rs

9
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::choose_version_for_user_input;
use crate::choose_version_for_user_input::Error as UserInputError; use crate::choose_version_for_user_input::Error as UserInputError;
use crate::config::FnmConfig; use crate::config::FnmConfig;
use crate::outln;
use crate::user_version::UserVersion; use crate::user_version::UserVersion;
use crate::version_files::get_user_version_from_file; use crate::version_files::get_user_version_from_file;
use colored::Colorize;
use snafu::{OptionExt, ResultExt, Snafu}; use snafu::{OptionExt, ResultExt, Snafu};
use std::process::{Command, Stdio}; use std::process::{Command, Stdio};
use structopt::StructOpt; use structopt::StructOpt;
@ -14,12 +16,19 @@ pub struct Exec {
arguments: Vec<String>, arguments: Vec<String>,
#[structopt(long = "using")] #[structopt(long = "using")]
version: Option<UserVersion>, version: Option<UserVersion>,
/// Deprecated. This is the default now.
#[structopt(long = "using-file", hidden = true)]
using_file: bool,
} }
impl Cmd for Exec { impl Cmd for Exec {
type Error = Error; type Error = Error;
fn apply(self, config: &FnmConfig) -> Result<(), Self::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 let version = self
.version .version
.or_else(|| { .or_else(|| {

Loading…
Cancel
Save