Skip to content

Commit

Permalink
Use colourful theme consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
ja573 committed Jan 28, 2025
1 parent 50e73a5 commit e0834d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/bin/commands/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ lazy_static! {
pub fn register(arguments: &clap::ArgMatches) -> ThothResult<()> {
let pool = get_pg_pool(arguments);

let name = Input::new()
let name = Input::with_theme(&ColorfulTheme::default())
.with_prompt("Enter given name")
.interact_on(&Term::stdout())?;
let surname = Input::new()
let surname = Input::with_theme(&ColorfulTheme::default())
.with_prompt("Enter family name")
.interact_on(&Term::stdout())?;
let email = Input::new()
let email = Input::with_theme(&ColorfulTheme::default())
.with_prompt("Enter email address")
.interact_on(&Term::stdout())?;
let password = password_input()?;
let is_superuser: bool = Input::new()
let is_superuser: bool = Input::with_theme(&ColorfulTheme::default())
.with_prompt("Is this a superuser account")
.default(false)
.interact_on(&Term::stdout())?;
let is_bot: bool = Input::new()
let is_bot: bool = Input::with_theme(&ColorfulTheme::default())
.with_prompt("Is this a bot account")
.default(false)
.interact_on(&Term::stdout())?;
Expand Down Expand Up @@ -85,15 +85,15 @@ fn email_selection(pool: &PgPool) -> ThothResult<String> {
}

fn password_input() -> ThothResult<String> {
Password::new()
Password::with_theme(&ColorfulTheme::default())
.with_prompt("Enter password")
.with_confirmation("Confirm password", "Passwords do not match")
.interact_on(&Term::stdout())
.map_err(Into::into)
}

fn is_admin_input(publisher_name: &str) -> ThothResult<bool> {
Input::new()
Input::with_theme(&ColorfulTheme::default())
.with_prompt(format!("Make user an admin of '{}'?", publisher_name))
.default(false)
.interact_on(&Term::stdout())
Expand Down Expand Up @@ -123,7 +123,7 @@ fn select_and_link_publishers(pool: &PgPool, account: &Account) -> ThothResult<(
})
.collect();

let chosen: Vec<usize> = MultiSelect::new()
let chosen: Vec<usize> = MultiSelect::with_theme(&ColorfulTheme::default())
.with_prompt("Select publishers to link this account to")
.items_checked(&items_checked)
.interact_on(&Term::stdout())?;
Expand Down
4 changes: 2 additions & 2 deletions src/bin/commands/cache.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::arguments;
use crate::commands::get_redis_pool;
use clap::{ArgMatches, Command};
use dialoguer::{console::Term, MultiSelect};
use dialoguer::{console::Term, theme::ColorfulTheme, MultiSelect};
use lazy_static::lazy_static;
use thoth::{
api::redis::{del, scan_match},
Expand All @@ -20,7 +20,7 @@ lazy_static! {

pub fn delete(arguments: &ArgMatches) -> ThothResult<()> {
let pool = get_redis_pool(arguments);
let chosen: Vec<usize> = MultiSelect::new()
let chosen: Vec<usize> = MultiSelect::with_theme(&ColorfulTheme::default())
.items(&ALL_SPECIFICATIONS)
.with_prompt("Select cached specifications to delete")
.interact_on(&Term::stdout())?;
Expand Down

0 comments on commit e0834d7

Please sign in to comment.