@@ -54,6 +54,7 @@ fn db_path() -> PathBuf {
5454 }
5555}
5656
57+ /// Prints the resolved SQLite database path.
5758pub fn print_db_path ( ) {
5859 println ! ( "{}" , db_path( ) . display( ) ) ;
5960}
@@ -273,6 +274,7 @@ async fn add_friend(friend_info: FriendInfo) {
273274 }
274275}
275276
277+ /// Removes a friend by exact name.
276278pub async fn remove_friend ( name : String ) {
277279 let mut config = match read_config ( ) . await {
278280 Ok ( config) => config,
@@ -294,6 +296,7 @@ pub async fn remove_friend(name: String) {
294296 }
295297}
296298
299+ /// Edits friend name and/or level.
297300pub async fn edit_friend ( name : String , new_name : Option < String > , new_level : Option < String > ) {
298301 if new_name. is_none ( ) && new_level. is_none ( ) {
299302 println ! ( "No changes requested" ) ;
@@ -340,24 +343,28 @@ pub async fn edit_friend(name: String, new_name: Option<String>, new_level: Opti
340343 }
341344}
342345
346+ /// Adds an `aji` friend.
343347pub async fn add_aji ( name : String ) {
344348 if let Some ( friend_info) = make_friend ( name, "aji" ) {
345349 add_friend ( friend_info) . await ;
346350 }
347351}
348352
353+ /// Adds a `ki` friend.
349354pub async fn add_ki ( name : String ) {
350355 if let Some ( friend_info) = make_friend ( name, "ki" ) {
351356 add_friend ( friend_info) . await ;
352357 }
353358}
354359
360+ /// Adds a `chi` friend.
355361pub async fn add_chi ( name : String ) {
356362 if let Some ( friend_info) = make_friend ( name, "chi" ) {
357363 add_friend ( friend_info) . await ;
358364 }
359365}
360366
367+ /// Adds multiple friends with the same level.
361368pub async fn add_many_friends ( level : String , names : Vec < String > ) {
362369 if names. is_empty ( ) {
363370 println ! ( "Please specify at least one name" ) ;
@@ -402,6 +409,7 @@ pub async fn add_many_friends(level: String, names: Vec<String>) {
402409 }
403410}
404411
412+ /// Lists friends, optionally filtered by level and/or sorted by chance.
405413pub async fn list_friends ( level_filter : Option < String > , sort_chance : bool ) {
406414 let config = match read_config ( ) . await {
407415 Ok ( config) => config,
@@ -423,6 +431,7 @@ pub async fn list_friends(level_filter: Option<String>, sort_chance: bool) {
423431 println ! ( "{rendered_list}" ) ;
424432}
425433
434+ /// Searches friends by case-insensitive partial name.
426435pub async fn search_friends ( query : String ) {
427436 let config = match read_config ( ) . await {
428437 Ok ( config) => config,
@@ -435,6 +444,7 @@ pub async fn search_friends(query: String) {
435444 println ! ( "{}" , utils:: search_friends( & config, & query) ) ;
436445}
437446
447+ /// Suggests one friend using weighted random chance.
438448pub async fn suggest ( ) {
439449 let config = match read_config ( ) . await {
440450 Ok ( config) => config,
@@ -506,22 +516,27 @@ async fn add_memory(kind: &str, reduction: f64, names: &[String]) {
506516 }
507517}
508518
519+ /// Records a `hangout` memory.
509520pub async fn add_hangout ( names : & [ String ] ) {
510521 add_memory ( "hangout" , default_reduction:: HANGOUT , names) . await
511522}
512523
524+ /// Records a `video-call` memory.
513525pub async fn add_video_call ( names : & [ String ] ) {
514526 add_memory ( "video-call" , default_reduction:: VIDEO_CALL , names) . await
515527}
516528
529+ /// Records a `call` memory.
517530pub async fn add_call ( names : & [ String ] ) {
518531 add_memory ( "call" , default_reduction:: CALL , names) . await
519532}
520533
534+ /// Records a `text` memory.
521535pub async fn add_text ( names : & [ String ] ) {
522536 add_memory ( "text" , default_reduction:: TEXT , names) . await
523537}
524538
539+ /// Undoes the latest recorded memory.
525540pub async fn undo_memory ( ) {
526541 let memories = match read_memories ( ) . await {
527542 Ok ( memories) => memories,
@@ -552,6 +567,7 @@ pub async fn undo_memory() {
552567 }
553568}
554569
570+ /// Removes a memory by database id.
555571pub async fn remove_memory ( id : i64 ) {
556572 match delete_memory ( id) . await {
557573 Ok ( true ) => { }
0 commit comments