# Architectural advice for CLI tool

**URL:** <https://discourse.haskell.org/t/architectural-advice-for-cli-tool/15097>\
**Category:** Learn\
**Created:** [November 15, 2026, 1:00am UTC](https://discourse.haskell.org/t/architectural-advice-for-cli-tool/15097 "2026-11-15T01:00:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![krystalcode](https://avatars.discourse-cdn.com/v4/letter/k/a8b319/32.png) [@krystalcode](https://discourse.haskell.org/u/krystalcode)\
**Post date:** [November 15, 2026, 1:00am UTC](https://discourse.haskell.org/t/architectural-advice-for-cli-tool/15097/1 "2026-11-15T01:00:53Z")

</div>

I’m returning to Haskell after many years and I want to write a CLI tool. Firstly, how is CLI tooling these days? One of the main reasons I have been considering Rust is much better libraries for CLI programs. There was Iris, but it’s abandoned. Other options? From a quick look I have not found anything new.

The main question is: I want an extensible architecture, which means that I want to allow plugins to be added to the program. For example, the program works with containers and I want it to work with Podman if a plugin is added or with Docker if another plugin is added.

I do not want to recompile it with Podman or Docker capabilities. For packaging and distribution, I want them to be separate packages e.g. `my-program`, another OS package `my-program-podman`, another `my-program-docker` etc. The main program would pass information to the additional package which would build and run a command that would then be run accordingly i.e. via Podman or Docker, then pass information back to the main program. Another example, if you use TMUX you can install an additional package `my-program-tmux` and that would add a subcommand `my-program tmux` to the main program.

Are there any examples of such architecture in Haskell, or any framework that would allow for that? So that I focus more on my program rather than solving this problem.

---

<div class="post-metadata">

**Author:** ![brandonchinn178](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/brandonchinn178/32/5103_2.png) [@brandonchinn178](https://discourse.haskell.org/u/brandonchinn178)\
**Post date:** [November 15, 2026, 1:21am UTC](https://discourse.haskell.org/t/architectural-advice-for-cli-tool/15097/2 "2026-11-15T01:21:08Z")

</div>

At a fundamental level, if you see a subcommand `foo`, simply look for `my-program-foo` on PATH. optparse-applicative is still the go-to CLI library; you’d probably add a subcommand group and fallback to a positional argument with `<|>`.

---

<div class="post-metadata">

**Author:** ![simonmic](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/simonmic/32/1796_2.png) [@simonmic](https://discourse.haskell.org/u/simonmic)\
**Post date:** [November 15, 2026, 5:02am UTC](https://discourse.haskell.org/t/architectural-advice-for-cli-tool/15097/3 "2026-11-15T05:02:02Z")

</div>

Yes, I think cabal does this, so you could look at that.

hledger also does it, and is probably the best example you’ll find of trying to make it seamless and ergonomic, with consistent command line UX across the core program and the subprograms. Be warned, not a simple task..

(Separate executables aren’t as plugged-in as traditional plugins, so I call them addon commands).

Check Hackage for the available command line-parsing libs. Usually there are two full-featured contenders: optparse-applicative and cmdargs.

---

<div class="post-metadata">

**Author:** ![krystalcode](https://avatars.discourse-cdn.com/v4/letter/k/a8b319/32.png) [@krystalcode](https://discourse.haskell.org/u/krystalcode)\
**Post date:** [November 15, 2026, 9:21pm UTC](https://discourse.haskell.org/t/architectural-advice-for-cli-tool/15097/4 "2026-11-15T21:21:37Z")

</div>

Yeah, I think that would be the most realistic approach, thank you both for the suggestions! I’ll be looking into the `cabal` and `hledger` source code. I’ve used both `optparse-applicative` and `cmdargs` in the past so I should be good there too.
