he/him : you may know me as @mountain_ghosts on twitter : I wrote some books you can buy from shop.jcoglan.com

2025-06-16

do I know anyone that's going to brighton ruby this week?

2025-06-16

@glenjamin as I detailed elsewhere, yargs is the most broken of any of the things I've tried, unfortunately

2025-06-16

@mcc this is the most tempting thing for me to put effort into at least, just because its parsing approach doesn't seem fundamentally broken

2025-06-16

@mcc the issue is that if you declare an argument, it seems to become required, which would mean I'd need to change my program's interface. might be possible, I'm not sure, but it's also a symptom of this library assuming you want to use it to define a bunch of subcommands

2025-06-16

the joint effects of semver and the node.js release process making people think they don't need to support old software, when node.js itself is remarkably stable and runs stuff I wrote 10+ years ago, continues to drive me mad

2025-06-16

my options right now:

- live with the deprecation warning on posix-argv-parser which actually works
- use utils.parseArgs() and drop support for node versions released as little as 2 years ago
- write my own parser

these are all, bad

2025-06-16

@clementd I don't even need "commands". I need an option parser but nobody makes on of those

2025-06-16

support for positional args was regarded as "opinionated" and dismissed out of hand github.com/tj/commander.js/iss

2025-06-16

@clementd yeah these APIs are incredibly annoying to migrate my application between to try them all out, so much so I often end up writing a transformer from the nopt API

2025-06-16

(commander parses switches properly, but is a mess on positional arguments, and steps out of scope by calling process.exit() which is not its job)

2025-06-16

a parsing library should not exit the process of its own volition, what on earth are you doing

2025-06-16

node.js when you're making a web app: you don't need a framework, glue these libraries together

node.js when you want to parse a command-line: it looks like you want an application framework

2025-06-16

@mcc it also crashes your process on errors b/c it wants to be an "application framework" instead of a parsing library

2025-06-16

@mcc this certainly looks more promising in terms of parsing switches with values correctly, but I can't figure out how to get positional args out of it. do you know how?

2025-06-16

like this is fundamentally not how you approach parsing. I'd expect *some* libraries to make this design error, but all of them? literally every single popular one?

2025-06-16

I am absolutely baffled that every single option parsing library in node.js makes the same fundamental design mistake of guessing the options from user input

2025-06-16

the security warning on minimist is like, yeah, that'll happen if you let the options be defined by user input instead of by the program, so why does every library do the former npmjs.com/package/minimist

2025-06-16

yargs is just incompatible with software engineering since it effectively makes it impossible to unit test your program

2025-06-16

parseArgs() is the least actively broken one in that it can be made to understand when a value looks like a switch, except it forces the user to use '=' to express this, its output is the cleanest and it doesn't make any guesses

2025-06-16

I think my best option is to use util.parseArgs(), and accept this forces me to drop some older node versions, which actively sucks considering I had put prior effort in elsewhere to keep them working? seems like a bad trade off

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst