~fd/beetboard

08f54cec7f4b2a9f977b834802b994e3e5683158 — Ersei Saggi 8 months ago 29a5bb4
Final qol
2 files changed, 7 insertions(+), 4 deletions(-)

M src/lib.rs
M src/strings.rs
M src/lib.rs => src/lib.rs +6 -3
@@ 7,7 7,7 @@ use time::{OffsetDateTime, PrimitiveDateTime};
use entities::{prelude::*, *};

use sea_orm::*;
use split_unquoted_char::split_unquoted_char;
use split_unquoted_char::split_unquoted_whitespace;

use argon2::{
    password_hash::{rand_core::OsRng, PasswordHash, PasswordHasher, PasswordVerifier, SaltString},


@@ 108,7 108,10 @@ impl BeetClient {
        if self.user.is_none() || self.user_id.is_none() {
            return strings::UNAUTHED.to_owned() + strings::PROMPT;
        }
        if command.len() == 1 || command.len() > 3 {
        if command.len() == 1
            || command.len() > 3
            || (command.len() == 2 && strings::HELP_COMMANDS.contains(&command[2]))
        {
            return strings::POST_HELP.to_owned() + strings::PROMPT;
        }
        let body = if command.get(2).is_none() {


@@ 289,7 292,7 @@ impl BeetClient {

    pub async fn step(&mut self, input: &str) -> String {
        let input = input.trim_end_matches('\n');
        let command: Vec<&str> = split_unquoted_char(input, ' ')
        let command: Vec<&str> = split_unquoted_whitespace(input)
            .unwrap_quotes(true)
            .into_iter()
            .collect();

M src/strings.rs => src/strings.rs +1 -1
@@ 26,7 26,7 @@ pub const HELP_UNAUTHED: &str =
    "Type (login) to log in, (register) to register, (exit) to exit, and (help) for help.\n";

// TODO: Need Moar Help
pub const HELP: &str = "Type (logout) to log out, (exit) to exit, and (help) for help.\n";
pub const HELP: &str = "Type (logout) to log out, (exit) to exit, and (help) for help.\nSee (post help), (show help), (read help), (comment help) for more.\n";

pub const HELP_COMMANDS: [&str; 3] = ["help", "h", "?"];