Update deps

This commit is contained in:
Zhaofeng Li 2022-03-07 22:02:04 -08:00
parent 6340b8ba50
commit 26b2203da9
13 changed files with 100 additions and 77 deletions

View file

@ -2,7 +2,7 @@
use std::env;
use clap::{App, AppSettings, Arg, ArgMatches, ColorChoice};
use clap::{Command as ClapCommand, Arg, ArgMatches, ColorChoice};
use clap_complete::Shell;
use const_format::concatcp;
use env_logger::fmt::WriteStyle;
@ -86,15 +86,15 @@ macro_rules! handle_command {
};
}
pub fn build_cli(include_internal: bool) -> App<'static> {
pub fn build_cli(include_internal: bool) -> ClapCommand<'static> {
let version = env!("CARGO_PKG_VERSION");
let mut app = App::new("Colmena")
let mut app = ClapCommand::new("Colmena")
.bin_name("colmena")
.version(version)
.author("Zhaofeng Li <hello@zhaofeng.li>")
.about("NixOS deployment tool")
.long_about(LONG_ABOUT.as_str())
.setting(AppSettings::ArgRequiredElseHelp)
.arg_required_else_help(true)
.arg(Arg::new("config")
.short('f')
.long("config")
@ -131,9 +131,9 @@ It's also possible to specify the preference using environment variables. See <h
.global(true));
if include_internal {
app = app.subcommand(App::new("gen-completions")
app = app.subcommand(ClapCommand::new("gen-completions")
.about("Generate shell auto-completion files (Internal)")
.setting(AppSettings::Hidden)
.hide(true)
.arg(Arg::new("shell")
.index(1)
.possible_values(Shell::possible_values())

View file

@ -1,7 +1,7 @@
use std::env;
use std::path::PathBuf;
use clap::{Arg, App, ArgMatches, ArgSettings};
use clap::{Arg, Command as ClapCommand, ArgMatches};
use crate::error::ColmenaError;
use crate::nix::deployment::{
@ -16,7 +16,7 @@ use crate::progress::SimpleProgressOutput;
use crate::nix::NodeFilter;
use crate::util;
pub fn register_deploy_args(command: App) -> App {
pub fn register_deploy_args(command: ClapCommand) -> ClapCommand {
command
.arg(Arg::new("eval-node-limit")
.long("eval-node-limit")
@ -103,7 +103,7 @@ To temporarily disable remote build on all nodes, use `--no-build-on-target`.
.takes_value(false))
.arg(Arg::new("no-build-on-target")
.long("no-build-on-target")
.setting(ArgSettings::Hidden)
.hide(true)
.takes_value(false))
.arg(Arg::new("force-replace-unknown-profiles")
.long("force-replace-unknown-profiles")
@ -121,8 +121,8 @@ This is an experimental feature."#)
.possible_values(Evaluator::possible_values()))
}
pub fn subcommand() -> App<'static> {
let command = App::new("apply")
pub fn subcommand() -> ClapCommand<'static> {
let command = ClapCommand::new("apply")
.about("Apply configurations on remote machines")
.arg(Arg::new("goal")
.help("Deployment goal")

View file

@ -2,7 +2,7 @@ use std::env;
use regex::Regex;
use std::collections::HashMap;
use clap::{Arg, App, ArgMatches};
use clap::{Arg, Command as ClapCommand, ArgMatches};
use tokio::fs;
use tokio::process::Command;
@ -17,8 +17,8 @@ use crate::nix::{NodeName, host};
use crate::progress::SimpleProgressOutput;
use crate::util;
pub fn subcommand() -> App<'static> {
App::new("apply-local")
pub fn subcommand() -> ClapCommand<'static> {
ClapCommand::new("apply-local")
.about("Apply configurations on the local machine")
.arg(Arg::new("goal")
.help("Deployment goal")

View file

@ -1,12 +1,12 @@
use clap::{Arg, App};
use clap::{Arg, Command as ClapCommand};
use crate::util;
use super::apply;
pub use super::apply::run;
pub fn subcommand() -> App<'static> {
let command = App::new("build")
pub fn subcommand() -> ClapCommand<'static> {
let command = ClapCommand::new("build")
.about("Build configurations but not push to remote machines")
.long_about(r#"Build configurations but not push to remote machines

View file

@ -1,21 +1,21 @@
use std::path::PathBuf;
use clap::{Arg, App, AppSettings, ArgMatches};
use clap::{Arg, Command as ClapCommand, ArgMatches};
use crate::error::ColmenaError;
use crate::util;
pub fn subcommand() -> App<'static> {
pub fn subcommand() -> ClapCommand<'static> {
subcommand_gen("eval")
}
pub fn deprecated_alias() -> App<'static> {
pub fn deprecated_alias() -> ClapCommand<'static> {
subcommand_gen("introspect")
.setting(AppSettings::Hidden)
.hide(true)
}
fn subcommand_gen(name: &str) -> App<'static> {
App::new(name)
fn subcommand_gen(name: &str) -> ClapCommand<'static> {
ClapCommand::new(name)
.about("Evaluate an expression using the complete configuration")
.long_about(r#"Evaluate an expression using the complete configuration

View file

@ -2,7 +2,7 @@ use std::env;
use std::path::PathBuf;
use std::sync::Arc;
use clap::{Arg, App, AppSettings, ArgMatches};
use clap::{Arg, Command as ClapCommand, ArgMatches};
use futures::future::join_all;
use tokio::sync::Semaphore;
@ -12,10 +12,10 @@ use crate::nix::NodeFilter;
use crate::progress::SimpleProgressOutput;
use crate::util;
pub fn subcommand() -> App<'static> {
let command = App::new("exec")
pub fn subcommand() -> ClapCommand<'static> {
let command = ClapCommand::new("exec")
.about("Run a command on remote machines")
.setting(AppSettings::TrailingVarArg)
.trailing_var_arg(true)
.arg(Arg::new("parallel")
.short('p')
.long("parallel")

View file

@ -1,11 +1,11 @@
use clap::{App, ArgMatches};
use clap::{Command as ClapCommand, ArgMatches};
use crate::error::ColmenaError;
use crate::nix::NixCheck;
use crate::nix::evaluator::nix_eval_jobs::get_pinned_nix_eval_jobs;
pub fn subcommand() -> App<'static> {
App::new("nix-info")
pub fn subcommand() -> ClapCommand<'static> {
ClapCommand::new("nix-info")
.about("Show information about the current Nix installation")
}

View file

@ -1,6 +1,6 @@
use std::time::Duration;
use clap::{App, AppSettings, ArgMatches};
use clap::{Command as ClapCommand, ArgMatches};
use tokio::time;
use crate::error::{ColmenaError, ColmenaResult};
@ -14,10 +14,10 @@ macro_rules! node {
}
}
pub fn subcommand() -> App<'static> {
App::new("test-progress")
pub fn subcommand() -> ClapCommand<'static> {
ClapCommand::new("test-progress")
.about("Run progress spinner tests")
.setting(AppSettings::Hidden)
.hide(true)
}
pub async fn run(_global_args: &ArgMatches, _local_args: &ArgMatches) -> Result<(), ColmenaError> {

View file

@ -1,12 +1,12 @@
use clap::{Arg, App};
use clap::{Arg, Command as ClapCommand};
use crate::util;
use super::apply;
pub use super::apply::run;
pub fn subcommand() -> App<'static> {
let command = App::new("upload-keys")
pub fn subcommand() -> ClapCommand<'static> {
let command = ClapCommand::new("upload-keys")
.about("Upload keys to remote hosts")
.long_about(r#"Upload keys to remote hosts

View file

@ -1,7 +1,7 @@
//! Progress spinner output.
use std::collections::HashMap;
use std::time::Instant;
use std::time::{Duration, Instant};
use async_trait::async_trait;
use indicatif::{MultiProgress, ProgressStyle, ProgressBar};
@ -95,7 +95,7 @@ impl SpinnerOutput {
.with_style(self.get_spinner_style(style));
let bar = self.multi.add(bar);
bar.enable_steady_tick(100);
bar.enable_steady_tick(Duration::from_millis(100));
bar
}
@ -173,7 +173,7 @@ impl SpinnerOutput {
impl ProgressOutput for SpinnerOutput {
async fn run_until_completion(mut self) -> ColmenaResult<Self> {
let meta_bar = self.multi.add(self.meta_bar.clone());
meta_bar.enable_steady_tick(100);
meta_bar.enable_steady_tick(Duration::from_millis(100));
loop {
let message = self.receiver.recv().await;
@ -234,11 +234,13 @@ fn get_spinner_style(label_width: usize, style: LineStyle) -> ProgressStyle {
ProgressStyle::default_spinner()
.tick_chars("🕛🕐🕑🕒🕓🕔🕕🕖🕗🕘🕙🕚✅")
.template(&template)
.unwrap()
}
LineStyle::Failure => {
ProgressStyle::default_spinner()
.tick_chars("❌❌")
.template(&template)
.unwrap()
}
}
}

View file

@ -3,7 +3,7 @@ use std::path::PathBuf;
use std::process::Stdio;
use async_trait::async_trait;
use clap::{App, Arg, ArgMatches};
use clap::{Command as ClapCommand, Arg, ArgMatches};
use futures::future::join3;
use serde::de::DeserializeOwned;
use tokio::io::{AsyncRead, AsyncBufReadExt, BufReader};
@ -257,7 +257,7 @@ pub async fn hive_from_args(args: &ArgMatches) -> ColmenaResult<Hive> {
Ok(hive)
}
pub fn register_selector_args(command: App) -> App {
pub fn register_selector_args(command: ClapCommand) -> ClapCommand {
command
.arg(Arg::new("on")
.long("on")