Add introductory message to command-line app
This commit is contained in:
parent
4ba6581714
commit
d04db02ee0
3 changed files with 29 additions and 12 deletions
|
@ -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<String> = Lazy::new(|| {
|
||||
rand::thread_rng().sample_iter(&Alphanumeric).take(128).map(char::from).collect::<String>()
|
||||
});
|
||||
|
@ -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(
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue