From d04db02ee093477e0104cc060daa54f4aaca0681 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Fri, 24 Jun 2022 16:33:12 +0100 Subject: [PATCH] Add introductory message to command-line app --- src/cli/mod.rs | 16 ++++++++++++++++ src/cli/start.rs | 13 +------------ src/cnf/mod.rs | 12 ++++++++++++ 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 19275e99..fc7df59e 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -5,11 +5,25 @@ mod log; mod start; mod version; +use crate::cnf::LOGO; use clap::{Arg, Command}; use once_cell::sync::Lazy; use rand::distributions::Alphanumeric; use rand::Rng; +const INFO: &str = " +To get started using SurrealDB, and for guides on connecting to and building applications +on top of SurrealDB, check out the SurrealDB documentation (https://surrealdb.com/docs). + +If you have questions or ideas, join the SurrealDB community (https://surrealdb.com/community). + +If you find a bug, submit an issue on Github (https://github.com/surrealdb/surrealdb/issues). + +We would love it if you could star the repository (https://github.com/surrealdb/surrealdb). + +---------- +"; + static PASS: Lazy = Lazy::new(|| { rand::thread_rng().sample_iter(&Alphanumeric).take(128).map(char::from).collect::() }); @@ -109,6 +123,8 @@ fn key_valid(v: &str) -> Result<(), String> { pub fn init() { let setup = Command::new("SurrealDB command-line interface and server") + .about(INFO) + .before_help(LOGO) .disable_version_flag(true) .arg_required_else_help(true) .arg( diff --git a/src/cli/start.rs b/src/cli/start.rs index 895e2fb9..92b31998 100644 --- a/src/cli/start.rs +++ b/src/cli/start.rs @@ -1,18 +1,7 @@ +use crate::cnf::LOGO; use crate::err::Error; use crate::net; -const LOGO: &str = " - .d8888b. 888 8888888b. 888888b. -d88P Y88b 888 888 'Y88b 888 '88b -Y88b. 888 888 888 888 .88P - 'Y888b. 888 888 888d888 888d888 .d88b. 8888b. 888 888 888 8888888K. - 'Y88b. 888 888 888P' 888P' d8P Y8b '88b 888 888 888 888 'Y88b - '888 888 888 888 888 88888888 .d888888 888 888 888 888 888 -Y88b d88P Y88b 888 888 888 Y8b. 888 888 888 888 .d88P 888 d88P - 'Y8888P' 'Y88888 888 888 'Y8888 'Y888888 888 8888888P' 8888888P' - -"; - pub fn init(matches: &clap::ArgMatches) -> Result<(), Error> { // output SurrealDB logo println!("{}", LOGO); diff --git a/src/cnf/mod.rs b/src/cnf/mod.rs index 1adf8705..d1675409 100644 --- a/src/cnf/mod.rs +++ b/src/cnf/mod.rs @@ -1,3 +1,15 @@ +pub const LOGO: &str = " + .d8888b. 888 8888888b. 888888b. +d88P Y88b 888 888 'Y88b 888 '88b +Y88b. 888 888 888 888 .88P + 'Y888b. 888 888 888d888 888d888 .d88b. 8888b. 888 888 888 8888888K. + 'Y88b. 888 888 888P' 888P' d8P Y8b '88b 888 888 888 888 'Y88b + '888 888 888 888 888 88888888 .d888888 888 888 888 888 888 +Y88b d88P Y88b 888 888 888 Y8b. 888 888 888 888 .d88P 888 d88P + 'Y8888P' 'Y88888 888 888 'Y8888 'Y888888 888 8888888P' 8888888P' + +"; + // The name and version of this build pub const PKG_NAME: &str = env!("CARGO_PKG_NAME"); pub const PKG_VERS: &str = env!("CARGO_PKG_VERSION");