TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: OpenAPI-like interface definition language for CLIs?

1 pointsby mieubrisseover 1 year ago
Hey folks, I&#x27;ve been thinking recently about how CLIs are just functions, and the config (flags, envvars, config files) are just parameters.<p>Yet, I&#x27;ve never heard of an interface definition language for CLIs. It strikes me as potentially being very valuable:<p>- You could generate code that would allow the CLI to accept and handle the resolution of all three of envvars, flags, and config files (to enable full human and machine readability)<p>- The developer wouldn&#x27;t have to manually deal with generating the &#x27;PROPERTY1_2_SUBPROPERTY&#x27; syntax that 12-factor app development advocates for, but is a pain to understand<p>- It would allow for a formal API for the CLI, allowing for API breaks to be clear (for those who programmatically call the CLI)<p>- The idea of &quot;routes&quot; maps quite nicely to the &quot;cli $subcommand [$subcommand] $verb ...flags...&quot; pattern that docker and kubectl have set<p>- You could use it to generate language-specific CLI framework bindings, like Go&#x27;s Cobra<p>- You could do documentation generation<p>- You could do generation of language-specific bindings for calling the CLI, so that calling the CLI as a subprocess is a function call in another language (rather than subprocess.call([&quot;some&quot;,&quot;random&quot;,&quot;strings&quot;]))<p>- You can calculate if changes to the CLI break the API for someone (thereby allowing for automatic semver)<p>Has anyone heard of something like this? Or should I build it?

no comments

no comments