feat: Retain context
This commit is contained in:
@@ -6,6 +6,7 @@ use clap::{CommandFactory, Parser};
|
||||
use clap_complete::{Shell, generate as generate_complete};
|
||||
use crete::cluster::Cluster;
|
||||
use crete::environment::PathEnvironment;
|
||||
use crete::talosconfig::{get_current_context, set_context};
|
||||
use crete::{get_configs_path, get_repo_path, set_repo_path};
|
||||
use futures::StreamExt;
|
||||
use futures::future::join_all;
|
||||
@@ -53,6 +54,8 @@ async fn generate(opts: &GlobalOpts) -> Result<(), Error> {
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
let context = get_current_context().await;
|
||||
|
||||
// Remove existing config files and create output directory
|
||||
let path = get_configs_path();
|
||||
tokio::fs::remove_dir_all(&path).await.ok();
|
||||
@@ -80,6 +83,10 @@ async fn generate(opts: &GlobalOpts) -> Result<(), Error> {
|
||||
cluster.talosconfig_merge().await;
|
||||
}
|
||||
|
||||
if let Some(context) = context {
|
||||
set_context(context).await;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user