Remove empty options for subcommands

This commit is contained in:
i1i1 2023-08-11 15:41:41 +03:00 committed by Zhaofeng Li
parent c79a872438
commit 303cf14fc6
3 changed files with 17 additions and 30 deletions

View file

@ -182,8 +182,17 @@ This subcommand behaves as if you invoked `apply` with the pseudo `keys` goal."#
deploy: DeployOpts, deploy: DeployOpts,
}, },
Exec(command::exec::Opts), Exec(command::exec::Opts),
Repl(command::repl::Opts), #[command(
NixInfo(command::nix_info::Opts), about = "Start an interactive REPL with the complete configuration",
long_about = r#"Start an interactive REPL with the complete configuration
In the REPL, you can inspect the configuration interactively with tab
completion. The node configurations are accessible under the `nodes`
attribute set."#
)]
Repl,
#[command(about = "Show information about the current Nix installation")]
NixInfo,
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
#[command(about = "Run progress spinner tests", hide = true)] #[command(about = "Run progress spinner tests", hide = true)]
TestProgress, TestProgress,
@ -276,8 +285,8 @@ pub async fn run() {
Command::ApplyLocal(args) => r(command::apply_local::run(hive, args), opts.config).await, Command::ApplyLocal(args) => r(command::apply_local::run(hive, args), opts.config).await,
Command::Eval(args) => r(command::eval::run(hive, args), opts.config).await, Command::Eval(args) => r(command::eval::run(hive, args), opts.config).await,
Command::Exec(args) => r(command::exec::run(hive, args), opts.config).await, Command::Exec(args) => r(command::exec::run(hive, args), opts.config).await,
Command::NixInfo(args) => r(command::nix_info::run(args), opts.config).await, Command::NixInfo => r(command::nix_info::run(), opts.config).await,
Command::Repl(args) => r(command::repl::run(hive, args), opts.config).await, Command::Repl => r(command::repl::run(hive), opts.config).await,
Command::TestProgress => r(command::test_progress::run(), opts.config).await, Command::TestProgress => r(command::test_progress::run(), opts.config).await,
Command::Build { deploy } => { Command::Build { deploy } => {
let args = command::apply::Opts { let args = command::apply::Opts {

View file

@ -1,17 +1,8 @@
use clap::Args; use crate::error::ColmenaResult;
use crate::error::ColmenaError;
use crate::nix::evaluator::nix_eval_jobs::get_pinned_nix_eval_jobs; use crate::nix::evaluator::nix_eval_jobs::get_pinned_nix_eval_jobs;
use crate::nix::NixCheck; use crate::nix::NixCheck;
#[derive(Debug, Args)] pub async fn run() -> ColmenaResult<()> {
#[command(
name = "nix-info",
about = "Show information about the current Nix installation"
)]
pub struct Opts {}
pub async fn run(_: Opts) -> Result<(), ColmenaError> {
let check = NixCheck::detect().await; let check = NixCheck::detect().await;
check.print_version_info(); check.print_version_info();
check.print_flakes_info(false); check.print_flakes_info(false);

View file

@ -1,26 +1,13 @@
use std::io::Write; use std::io::Write;
use clap::Args;
use tempfile::Builder as TempFileBuilder; use tempfile::Builder as TempFileBuilder;
use tokio::process::Command; use tokio::process::Command;
use crate::error::ColmenaError; use crate::error::ColmenaResult;
use crate::nix::info::NixCheck; use crate::nix::info::NixCheck;
use crate::nix::Hive; use crate::nix::Hive;
#[derive(Debug, Args)] pub async fn run(hive: Hive) -> ColmenaResult<()> {
#[command(
name = "repl",
about = "Start an interactive REPL with the complete configuration",
long_about = r#"Start an interactive REPL with the complete configuration
In the REPL, you can inspect the configuration interactively with tab
completion. The node configurations are accessible under the `nodes`
attribute set."#
)]
pub struct Opts {}
pub async fn run(hive: Hive, _: Opts) -> Result<(), ColmenaError> {
let nix_check = NixCheck::detect().await; let nix_check = NixCheck::detect().await;
let nix_version = nix_check.version().expect("Could not detect Nix version"); let nix_version = nix_check.version().expect("Could not detect Nix version");