From fae58994e44d94d19778ce645c73bf7796fdc7c4 Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Thu, 18 Nov 2021 13:15:20 -0800 Subject: [PATCH] Prepare for 0.2.0 release --- Cargo.lock | 23 ++++++++++++++++++++++- Cargo.toml | 3 ++- default.nix | 6 +++--- src/cli.rs | 38 ++++++++++++++++++++++++++++++++++++-- 4 files changed, 63 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3295533..530b072 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -120,13 +120,14 @@ dependencies = [ [[package]] name = "colmena" -version = "0.1.0" +version = "0.2.0-pre" dependencies = [ "ansi-to-html", "async-trait", "atty", "clap", "console 0.13.0", + "const_format", "env_logger", "futures", "glob", @@ -179,6 +180,26 @@ dependencies = [ "winapi", ] +[[package]] +name = "const_format" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22bc6cd49b0ec407b680c3e380182b6ac63b73991cb7602de350352fc309b614" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef196d5d972878a48da7decb7686eded338b4858fbabeed513d63a7c98b2b82d" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + [[package]] name = "doc-comment" version = "0.3.3" diff --git a/Cargo.toml b/Cargo.toml index bbc2631..5e3e560 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "colmena" -version = "0.1.0" +version = "0.2.0-pre" authors = ["Zhaofeng Li "] edition = "2018" @@ -12,6 +12,7 @@ async-trait = "0.1.42" atty = "0.2" clap = "2.33.3" console = "0.13.0" +const_format = "0.2.22" env_logger = "0.8.2" futures = "0.3.8" glob = "0.3.0" diff --git a/default.nix b/default.nix index 10d937e..b92ad2d 100644 --- a/default.nix +++ b/default.nix @@ -11,15 +11,15 @@ in { stdenv = pkgs.stdenv; rustPlatform = pkgs.rustPlatform; in rustPlatform.buildRustPackage { - name = "colmena-dev"; - version = "0.1.0"; + name = "colmena"; + version = "0.2.0-pre"; src = lib.cleanSourceWith { filter = name: type: !(type == "directory" && builtins.elem (baseNameOf name) [ "target" "manual" ]); src = lib.cleanSource ./.; }; - cargoSha256 = "sha256-JDJQnKO0j1DegOyuZi3WU4wVnotucSVPbwbn25R8Jb8="; + cargoSha256 = "sha256-cpxvhP9TVEaIaiIZ+X22bDREqALpgWtW6koucVfMLwY="; postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) '' mkdir completions diff --git a/src/cli.rs b/src/cli.rs index 6644f19..8b69fea 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,16 +1,49 @@ //! Global CLI Setup. use clap::{App, AppSettings, Arg, ArgMatches, SubCommand}; +use const_format::concatcp; use lazy_static::lazy_static; use crate::command; +/// Base URL of the manual, without the trailing slash. +const MANUAL_URL_BASE: &'static str = "https://zhaofengli.github.io/colmena"; + +/// URL to the manual. +/// +/// We maintain CLI and Nix API stability for each minor version. +/// This ensures that the user always sees accurate documentations, and we can +/// easily perform updates to the manual after a release. +const MANUAL_URL: &'static str = concatcp!(MANUAL_URL_BASE, "/", env!("CARGO_PKG_VERSION_MAJOR"), ".", env!("CARGO_PKG_VERSION_MINOR")); + +/// The note shown when the user is using a pre-release version. +/// +/// API stability cannot be guaranteed for pre-release versions. +/// Links to the version currently in development automatically +/// leads the user to the unstable manual. +const MANUAL_DISCREPANCY_NOTE: &'static str = "Note: You are using a pre-release version of Colmena, so the supported options may be different from what's in the manual."; + lazy_static! { + static ref LONG_ABOUT: String = { + let mut message = format!(r#"NixOS deployment tool + +Colmena helps you deploy to multiple hosts running NixOS. +For more details, read the manual at <{}>. + +"#, MANUAL_URL); + + if env!("CARGO_PKG_VERSION_PRE").len() != 0 { + message += &MANUAL_DISCREPANCY_NOTE; + } + + message + }; + static ref CONFIG_HELP: String = { format!(r#"If this argument is not specified, Colmena will search upwards from the current working directory for a file named "flake.nix" or "hive.nix". This behavior is disabled if --config/-f is given explicitly. -For a sample configuration, see . -"#, env!("CARGO_PKG_VERSION")) +For a sample configuration, check the manual at <{}>. +"#, MANUAL_URL) }; } @@ -42,6 +75,7 @@ pub fn build_cli(include_internal: bool) -> App<'static, 'static> { .version(version) .author("Zhaofeng Li ") .about("NixOS deployment tool") + .long_about(LONG_ABOUT.as_str()) .global_setting(AppSettings::ColoredHelp) .setting(AppSettings::ArgRequiredElseHelp) .arg(Arg::with_name("config")