···98 See {!Store.thumbnail_path} for details. *)
99val thumbnail_path : t -> Contact.t -> Eio.Fs.dir_ty Eio.Path.t option
1000000101(** [find_by_name t name] searches for contacts by name.
102 See {!Store.find_by_name} for details. *)
103val find_by_name : t -> string -> Contact.t
···98 See {!Store.thumbnail_path} for details. *)
99val thumbnail_path : t -> Contact.t -> Eio.Fs.dir_ty Eio.Path.t option
100101+(** [png_thumbnail_path t contact] returns the path to the PNG version of a contact's thumbnail.
102+ See {!Store.png_thumbnail_path} for details. *)
103+val png_thumbnail_path : t -> Contact.t -> Eio.Fs.dir_ty Eio.Path.t option
104+105(** [find_by_name t name] searches for contacts by name.
106 See {!Store.find_by_name} for details. *)
107val find_by_name : t -> string -> Contact.t
+14
sortal/lib/core/sortal_cmd.ml
···42 0
43 | None -> Logs.err (fun m -> m "Contact not found: %s" handle); 1
44000000000000045let search_cmd query xdg =
46 let store = Sortal_store.create_from_xdg xdg in
47 match Sortal_store.search_all store query with
···314(* Command info and args *)
315let list_info = Cmd.info "list" ~doc:"List all contacts"
316let show_info = Cmd.info "show" ~doc:"Show detailed information about a contact"
0317let search_info = Cmd.info "search" ~doc:"Search contacts by name"
318let stats_info = Cmd.info "stats" ~doc:"Show statistics about the contact database"
319let sync_info = Cmd.info "sync" ~doc:"Synchronize and normalize contact data"
···42 0
43 | None -> Logs.err (fun m -> m "Contact not found: %s" handle); 1
4445+let thumbnail_cmd handle xdg =
46+ let store = Sortal_store.create_from_xdg xdg in
47+ match Sortal_store.lookup store handle with
48+ | None -> Logs.err (fun m -> m "Contact not found: %s" handle); 1
49+ | Some c ->
50+ match Sortal_store.thumbnail_path store c with
51+ | Some path ->
52+ Printf.printf "%s\n" (Eio.Path.native_exn path);
53+ 0
54+ | None ->
55+ Logs.err (fun m -> m "No thumbnail for contact: %s" handle);
56+ 1
57+58let search_cmd query xdg =
59 let store = Sortal_store.create_from_xdg xdg in
60 match Sortal_store.search_all store query with
···327(* Command info and args *)
328let list_info = Cmd.info "list" ~doc:"List all contacts"
329let show_info = Cmd.info "show" ~doc:"Show detailed information about a contact"
330+let thumbnail_info = Cmd.info "thumbnail" ~doc:"Print the thumbnail file path for a contact"
331let search_info = Cmd.info "search" ~doc:"Search contacts by name"
332let stats_info = Cmd.info "stats" ~doc:"Show statistics about the contact database"
333let sync_info = Cmd.info "sync" ~doc:"Synchronize and normalize contact data"
+11
sortal/lib/core/sortal_cmd.mli
···23 @param handle The contact handle to display *)
24val show_cmd : string -> (Xdge.t -> int)
250000000026(** [search_cmd query] creates a command to search contacts by name.
2728 @param query The search query string *)
···120121(** [show_info] is the command info for the show command. *)
122val show_info : Cmdliner.Cmd.info
000123124(** [search_info] is the command info for the search command. *)
125val search_info : Cmdliner.Cmd.info
···23 @param handle The contact handle to display *)
24val show_cmd : string -> (Xdge.t -> int)
2526+(** [thumbnail_cmd handle] prints the thumbnail file path for a contact.
27+28+ Returns exit code 0 and prints the path if the contact has a thumbnail,
29+ or exit code 1 if the contact is not found or has no thumbnail.
30+31+ @param handle The contact handle to look up *)
32+val thumbnail_cmd : string -> (Xdge.t -> int)
33+34(** [search_cmd query] creates a command to search contacts by name.
3536 @param query The search query string *)
···128129(** [show_info] is the command info for the show command. *)
130val show_info : Cmdliner.Cmd.info
131+132+(** [thumbnail_info] is the command info for the thumbnail command. *)
133+val thumbnail_info : Cmdliner.Cmd.info
134135(** [search_info] is the command info for the search command. *)
136val search_info : Cmdliner.Cmd.info