MQTT 3.1 and 5 in OCaml using Eio
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

switch to nox-xdg for now

+18 -18
+1 -1
dune-project
··· 22 22 nox-ca-certs 23 23 (cmdliner (>= 1.2)) 24 24 nox-tls 25 - nox-xdge 25 + nox-xdg 26 26 nox-toml 27 27 (logs (>= 0.7)) 28 28 (fmt (>= 0.9))
+1 -1
lib/cmd/dune
··· 4 4 (libraries 5 5 mqtte 6 6 mqtte_eio 7 - nox-xdge 7 + nox-xdg.eio 8 8 nox-toml 9 9 nox-toml.eio 10 10 eio
+10 -10
lib/cmd/mqtte_cmd.ml
··· 139 139 None 140 140 141 141 let load xdg = 142 - match Xdge.config_file xdg "config.toml" with 142 + match Xdg_eio.config_file xdg "config.toml" with 143 143 | Some path -> load_from_path path 144 144 | None -> 145 145 Log.debug (fun m -> m "No config.toml found in XDG config directories"); ··· 328 328 329 329 (** {1 Main Term} *) 330 330 331 - type parsed = { mqtt : t; xdg : Xdge.t; xdg_config : Xdge.Cmd.t } 331 + type parsed = { mqtt : t; xdg : Xdg_eio.t; xdg_config : Xdg_eio.Cmd.t } 332 332 333 333 let term_with_config ~app_name ~fs ~config:file_config () = 334 - (* Xdge.Cmd.term provides XDG paths with command-line override support *) 335 - let xdg_term = Xdge.Cmd.term app_name fs ~dirs:[ `Config ] () in 334 + (* Xdg_eio.Cmd.term provides XDG paths with command-line override support *) 335 + let xdg_term = Xdg_eio.Cmd.term app_name fs ~dirs:[ `Config ] () in 336 336 let make (xdg, xdg_config) connection config pool_config = 337 337 { mqtt = { connection; config; pool_config }; xdg; xdg_config } 338 338 in ··· 344 344 345 345 let term ~app_name ~fs () = 346 346 (* Create XDG context to read config file defaults at term construction time. *) 347 - let xdg = Xdge.v fs app_name in 347 + let xdg = Xdg_eio.v fs app_name in 348 348 let file_config = 349 349 match Config_file.load xdg with Some c -> c | None -> Config_file.empty 350 350 in ··· 374 374 375 375 (** {1 XDG Access} *) 376 376 377 - let xdg ~app_name ~fs = Xdge.v fs app_name 377 + let xdg ~app_name ~fs = Xdg_eio.v fs app_name 378 378 379 379 (** {1 Documentation Helpers} *) 380 380 ··· 476 476 |} 477 477 478 478 let write_default_config xdg = 479 - let config_dir = Xdge.config_dir xdg in 479 + let config_dir = Xdg_eio.config_dir xdg in 480 480 let config_path = Eio.Path.(config_dir / "config.toml") in 481 481 try 482 482 if Eio.Path.is_file config_path then ··· 490 490 with exn -> Error (Printexc.to_string exn) 491 491 492 492 let config_path xdg = 493 - let config_dir = Xdge.config_dir xdg in 493 + let config_dir = Xdg_eio.config_dir xdg in 494 494 Eio.Path.(config_dir / "config.toml") 495 495 496 496 (** {1 Init Config Subcommand} *) 497 497 498 498 let init_config_term ~app_name ~fs = 499 499 let run force = 500 - let xdg = Xdge.v fs app_name in 500 + let xdg = Xdg_eio.v fs app_name in 501 501 let path = config_path xdg in 502 502 let exists = Eio.Path.is_file path in 503 503 if exists && not force then begin ··· 543 543 544 544 let show_config_term ~app_name ~fs = 545 545 let run () = 546 - let xdg = Xdge.v fs app_name in 546 + let xdg = Xdg_eio.v fs app_name in 547 547 let path = config_path xdg in 548 548 Fmt.pr "Configuration file: %s@.@." (Eio.Path.native_exn path); 549 549 if Eio.Path.is_file path then begin
+5 -5
lib/cmd/mqtte_cmd.mli
··· 59 59 60 60 (** {1 Cmdliner Terms} *) 61 61 62 - type parsed = { mqtt : t; xdg : Xdge.t; xdg_config : Xdge.Cmd.t } 62 + type parsed = { mqtt : t; xdg : Xdg_eio.t; xdg_config : Xdg_eio.Cmd.t } 63 63 (** Result of parsing command-line arguments, including MQTT configuration and 64 64 XDG context for accessing application directories. *) 65 65 ··· 124 124 125 125 (** {1 XDG Access} *) 126 126 127 - val xdg : app_name:string -> fs:Eio.Fs.dir_ty Eio.Path.t -> Xdge.t 127 + val xdg : app_name:string -> fs:Eio.Fs.dir_ty Eio.Path.t -> Xdg_eio.t 128 128 (** [xdg ~app_name ~fs] creates an XDG context for the application. 129 129 130 130 This can be used to access other XDG directories (data, cache, state, etc.) ··· 185 185 {!mqtt_codec} and {!pool_codec} separately to compose with 186 186 application-specific sections. *) 187 187 188 - val load : Xdge.t -> t option 188 + val load : Xdg_eio.t -> t option 189 189 (** [load xdg] attempts to load [config.toml] from the XDG config directory. 190 190 Returns [None] if the file doesn't exist or cannot be parsed. *) 191 191 ··· 254 254 255 255 (** {1 Configuration File Management} *) 256 256 257 - val config_path : Xdge.t -> Eio.Fs.dir_ty Eio.Path.t 257 + val config_path : Xdg_eio.t -> Eio.Fs.dir_ty Eio.Path.t 258 258 (** [config_path xdg] returns the path where the configuration file should be 259 259 located ([~/.config/{app_name}/config.toml]). *) 260 260 ··· 262 262 (** A default configuration file template with commented examples of all 263 263 available options. *) 264 264 265 - val write_default_config : Xdge.t -> (string, string) result 265 + val write_default_config : Xdg_eio.t -> (string, string) result 266 266 (** [write_default_config xdg] writes a default configuration file to the XDG 267 267 config directory. 268 268
+1 -1
mqtte.opam
··· 18 18 "nox-ca-certs" 19 19 "cmdliner" {>= "1.2"} 20 20 "nox-tls" 21 - "nox-xdge" 21 + "nox-xdg" 22 22 "nox-toml" 23 23 "logs" {>= "0.7"} 24 24 "fmt" {>= "0.9"}