Selective yes (fix #802) (#808)

* Selective yes flag (fix #802)

* Selective yes flag (fix #802)

* selective yes

* MacOS
This commit is contained in:
Roey Darwish Dror
2021-12-06 14:44:20 +02:00
committed by GitHub
parent 4b8cf641a1
commit ab3ff0ecae
11 changed files with 77 additions and 59 deletions

View File

@@ -1,6 +1,7 @@
use crate::{error::SkipStep, execution_context::ExecutionContext, terminal::print_separator, utils};
use anyhow::Result;
use crate::{error::SkipStep, execution_context::ExecutionContext, terminal::print_separator, utils};
fn prepare_async_ssh_command(args: &mut Vec<&str>) {
args.insert(0, "ssh");
args.push("--keep");
@@ -19,10 +20,6 @@ pub fn ssh_step(ctx: &ExecutionContext, hostname: &str) -> Result<()> {
let env = format!("TOPGRADE_PREFIX={}", hostname);
args.extend(&["env", &env, "$SHELL", "-lc", topgrade]);
if ctx.config().yes() {
args.push("-y");
}
if ctx.config().run_in_tmux() && !ctx.run_type().dry() {
#[cfg(unix)]
{
@@ -47,10 +44,6 @@ pub fn ssh_step(ctx: &ExecutionContext, hostname: &str) -> Result<()> {
let env = format!("TOPGRADE_PREFIX={}", hostname);
args.extend(&["env", &env, "$SHELL", "-lc", topgrade]);
if ctx.config().yes() {
args.push("-y");
}
print_separator(format!("Remote ({})", hostname));
println!("Connecting to {}...", hostname);

View File

@@ -1,14 +1,16 @@
use crate::execution_context::ExecutionContext;
use crate::executor::CommandExt;
use crate::terminal::print_separator;
use crate::{error::SkipStep, utils};
use anyhow::Result;
use log::{debug, error};
use std::path::{Path, PathBuf};
use std::process::Command;
use std::{fmt::Display, rc::Rc, str::FromStr};
use anyhow::Result;
use log::{debug, error};
use strum::EnumString;
use crate::execution_context::ExecutionContext;
use crate::executor::CommandExt;
use crate::terminal::print_separator;
use crate::{error::SkipStep, utils, Step};
#[derive(Debug, Copy, Clone, EnumString)]
#[strum(serialize_all = "lowercase")]
enum BoxStatus {
@@ -188,7 +190,7 @@ pub fn topgrade_vagrant_box(ctx: &ExecutionContext, vagrant_box: &VagrantBox) ->
print_separator(seperator);
}
let mut command = format!("env TOPGRADE_PREFIX={} topgrade", vagrant_box.smart_name());
if ctx.config().yes() {
if ctx.config().yes(Step::Vagrant) {
command.push_str(" -y");
}