···1818```
1919$ sudo zpool destroy shelter && sudo zpool create shelter /var/shelter.img && sudo rm -rf ~/.cache/shelter
2020```
2121+2222+## Shl files
2323+2424+You can run both the main shelter program and the passthrough mode via a series of actions in a `.shl` file.
+27-8
src/bin/main.ml
···66end
7788module Pass = Shelter.Make (History) (Shelter_passthrough)
99-module Shelter = Shelter.Make (Shelter_main.History) (Shelter_main)
99+module Main = Shelter.Make (Shelter_main.History) (Shelter_main)
10101111let home = Unix.getenv "HOME"
1212···17171818(* Command Line *)
1919open Cmdliner
2020+2121+let cmd_file =
2222+ let doc = "Path to a file containing a series of commands." in
2323+ Arg.(
2424+ value
2525+ & opt (some file) None
2626+ & info [ "f"; "file" ] ~docv:"COMMAND_FILE" ~doc)
20272128let main =
2222- let run config =
2929+ let run config cmd_file =
2330 Eio_posix.run @@ fun env ->
3131+ let cmd_file = Option.map (Eio.Path.( / ) env#fs) cmd_file in
2432 let dir = state_dir env#fs "shelter" in
2525- Shelter.main config env#fs env#clock env#process_mgr dir
3333+ Main.main config env#fs env#clock env#process_mgr dir cmd_file
2634 in
2727- let t = Term.(const run $ Shelter_main.config_term) in
3535+ let t = Term.(const run $ Shelter_main.config_term $ cmd_file) in
2836 let man =
2937 [
3038 `P
···3745 (Cmd.v info t, t, info)
38463947let passthrough =
4040- let run config =
4848+ let run config cmd_file =
4149 Eio_posix.run @@ fun env ->
5050+ let cmd_file = Option.map (Eio.Path.( / ) env#fs) cmd_file in
4251 let dir = state_dir env#fs "passthrough" in
4343- Pass.main config env#fs env#clock env#process_mgr dir
5252+ Pass.main config env#fs env#clock env#process_mgr dir cmd_file
4453 in
4545- let t = Term.(const run $ Shelter_passthrough.config_term) in
5454+ let t = Term.(const run $ Shelter_passthrough.config_term $ cmd_file) in
4655 let info = Cmd.info "passthrough" in
4756 Cmd.v info t
48575858+let extract_commands =
5959+ let run cmd_file =
6060+ Eio_posix.run @@ fun env ->
6161+ let cmd_file = Eio.Path.( / ) env#fs (Option.get cmd_file) in
6262+ Shelter.Script.to_commands cmd_file |> List.iter (Fmt.pr "%s\n")
6363+ in
6464+ let t = Term.(const run $ cmd_file) in
6565+ let info = Cmd.info "extract" in
6666+ Cmd.v info t
6767+4968let cmds =
5069 let cmd, term, info = main in
5151- let cmds = [ cmd; passthrough ] in
7070+ let cmds = [ cmd; passthrough; extract_commands ] in
5271 Cmd.group ~default:term info cmds
53725473let () =