Stop writing CLI validation. Parse it right the first time.

洪 民憙 (Hong Minhee) @hongminhee@hackers.pub

This post introduces Optique, a new library created to address the pervasive problem of repetitive and often messy validation code in CLI tools. The author was motivated by the observation that nearly every CLI tool reinvents the wheel with similar validation patterns for dependent options, mutually exclusive options, and environment-specific requirements. Optique leverages parser combinators and TypeScript's type inference to ensure that CLI arguments are parsed directly into valid configurations, eliminating the need for manual validation. By describing the desired CLI configuration with Optique, TypeScript automatically infers the types and constraints, catching potential bugs at compile time. The author shares their experience of deleting large chunks of validation code and simplifying refactoring tasks. Optique aims to provide a more robust and maintainable approach to CLI argument parsing, potentially saving developers from writing the same validation logic repeatedly.

Read more →
19
3
1

Neovim Super villain. 풀스택 엔지니어 내지는 프로덕트 엔지니어라고 스스로를 소개하지만 사실상 잡부를 담당하는 사람. CLI 도구를 만드는 것에 관심이 많습니다.

Hackers' Pub에서는 자발적으로 바이럴을 담당하고 있는 사람. Hackers' Pub의 무궁무진한 발전 가능성을 믿습니다.

그 외에도 개발자 커뮤니티 생태계에 다양한 시도들을 합니다. 지금은 https://vim.kr / https://fedidev.kr 디스코드 운영 중

Haze Lee but also known as Kihan Park

  • 💻 Make stuff with Computer
  • 💉 Living with Migraine more than 10y, Migraine Advocate [Headache Place]
  • 💬 🇰🇷, Also 🇯🇵 & 🇬🇧🇺🇸

아무거나 만드는 소프트웨어 엔지니어

월급루팡 아님. 월급 장발장~
(。▼皿▼)
빨간 날은 쉽니다. 토요일은 기계랑 멀어짐.

Accessibility, F/OSS, WWW, Jeju, 歷史, 한글, 한국어

math. programming. fancy types. haskell.
6d03.info

A nonbinary fox working on DOM in Gecko. Not a guy in any form, not even in "you guys" form

An intersectionalist, feminist, and socialist guy living in Seoul (UTC+09:00). @tokolovesme금강토's spouse. Who's behind @fedifyFedify: ActivityPub server framework, @holloHollo :hollo:, and @botkitBotKit by Fedify :botkit:. Write some free software in , , , & . They/them.

서울에 사는 交叉女性主義者이자 社會主義者. 金剛兔(@tokolovesme금강토)의 配偶者. @fedifyFedify: ActivityPub server framework, @holloHollo :hollo:, @botkitBotKit by Fedify :botkit: 메인테이너. , , , 等으로 自由 소프트웨어 만듦.

()