←back to thread

3 points biodiscus | 2 comments | | HN request time: 0.451s | source

A lightweight (5 kB) alternative to yargs-parser (85 kB). Supports all standard flag formats. https://github.com/webdiscus/flaget
Show context
FerkiHN ◴[] No.44474746[source]
Bro, cool program, I wish you good luck in further development, I gave you a star on GitHub, I hope there will be more of them, and by the way, here are the improvements I found:

1. Strict typing & validation — support ranges, regex, custom types (dates, emails).

2. Better error messages — clear feedback on invalid args.

3. Auto-generated help — built-in --help with descriptions and examples.

4. Advanced aliases — support multiple aliases and priority handling.

5. Nested options — parse flags like --db.host into objects.

6. Async validators & transformers — for things like file existence checks.

7. Config file support — load defaults from JSON/YAML files.

8. Named positional args — support and validate ordered params.

9. Localization (i18n) — multi-language error/help messages.

10. Performance optimization — handle large numbers of args fast.

11. Test integration — utilities for easy CLI testing with frameworks.

replies(1): >>44475715 #
biodiscus ◴[] No.44475715[source]
Thanks for the * and your cool suggestions!

There are already big "do-it-all" CLI libraries like "yargs-parser" (85 kB), "meow" (419 kB), "minimist" (55kB), etc.

Flaget is intentionally minimal — small size is the killer feature. I want to keep it as compact as possible without bloating it with rarely needed functionality.

The e18e community focuses on optimising npm packages by replacing heavy dependencies with smaller alternatives.

Still, some of your ideas are very useful, and I may add:

- Named positional

- Nested options

But others are outside the scope of a small library like this.

replies(2): >>44478545 #>>44478587 #
FerkiHN ◴[] No.44478545[source]
I'm glad some of my tips were useful, and I understand that you are making minimalist libraries, I also like to keep everything minimal and optimized.

By the way, if you can, please help me promote my repository. I've also been doing different things and my project is of course not ready yet, but could you please put a star on my repository?

https://github.com/Ferki-git-creator/phono-in-terminal-image...

replies(1): >>44479305 #
1. biodiscus ◴[] No.44479305[source]
Thanks for sharing your PIT repo, I starred it!

It would be great to have an option to save the ASCII output to a file, e.g.:

--output, -o <file>

replies(1): >>44479435 #
2. FerkiHN ◴[] No.44479435[source]
I love the NN community, I don't know what I would do without you.

You are the best, it motivates me to improve further PIT.