Improve the plm instance new command

Add long arguments
Fix the help messages
Actually write to StdOut when needed
Fallback to BASE_URL first if domain is not specified
This commit is contained in:
Bat
2018-10-05 12:48:45 +01:00
parent 6723432e52
commit 0da5d2e927
3 changed files with 21 additions and 13 deletions
+3 -3
View File
@@ -5,7 +5,7 @@ extern crate plume_models;
use clap::App;
use diesel::{Connection, PgConnection};
use std::io::{self, Write};
use std::io::{self, prelude::*};
use plume_models::DB_URL;
mod instance;
@@ -28,8 +28,8 @@ fn main() {
}
pub fn ask_for(something: &str) -> String {
write!(io::stdout(), "{}", something).ok();
write!(io::stdout(), ": ").ok();
print!("{}: ", something);
io::stdout().flush().expect("Couldn't flush STDOUT");
let mut input = String::new();
io::stdin().read_line(&mut input).expect("Unable to read line");
input.retain(|c| c != '\n');