Stop writing if statements for your CLI flags

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

Traditional CLI development often involves writing repetitive runtime validation logic to manage complex dependencies between various flags and options. While modern TypeScript-first libraries have improved individual option parsing, they frequently fail to encode these inter-dependencies into the type system, resulting in loose types that necessitate manual checks. Optique solves this problem through its conditional combinator, which treats option relationships as a primary architectural concern. By utilizing a discriminator value to select specific branches of a parser, it enables the automatic inference of precise discriminated unions. This ensures that certain flags are strictly required or forbidden based on the values of other options, effectively shifting validation logic from runtime to the compiler. Whether modeling database connection strings or authentication protocols, the structure of the parser serves as the ultimate constraint. This methodology eliminates the need for manual validation code and ensures that the type system remains the single source of truth throughout the application's lifecycle. Embracing structural parsing over manual validation significantly enhances the reliability and maintainability of sophisticated command-line tools.

Read more →
7

레고를 뿌리고 뿌린 레고들을 쌓고 있습니다.

음악 작곡에서 시작해 몽골학을 거쳐, 지금은 컴퓨터 공학과 친해지려고 노력하고 있습니다. 한때 지평선을 넓히는 데 집중했다면, 이제는 뿌리를 내려 깊어지려고 노력 중입니다.

Hi, I'm who's behind Fedify, Hollo, BotKit, and this website, Hackers' Pub! My main account is at @hongminhee洪 民憙 (Hong Minhee) :nonbinary:.

Fedify, Hollo, BotKit, 그리고 보고 계신 이 사이트 Hackers' Pub을 만들고 있습니다. 제 메인 계정은: @hongminhee洪 民憙 (Hong Minhee) :nonbinary:.

FedifyHolloBotKit、そしてこのサイト、Hackers' Pubを作っています。私のメインアカウントは「@hongminhee洪 民憙 (Hong Minhee) :nonbinary:」に。

An intersectionalist, feminist, and socialist 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: 메인테이너. , , , 等으로 自由 소프트웨어 만듦.

()