{"slug": "rewrote-command-line-argument-handling", "title": "Rewrote Command Line Argument Handling", "summary": "A developer replaced the Rust `clap` crate with LLM-generated argument-parsing code written by Gemini 3.8 Flash via OpenRouter, cutting the compiled executable size by 300 kB and argument parsing time from 20 microseconds to about 1 microsecond. The developer wrote a 120-line Markdown spec and paid roughly $0.02 per generation, needing two attempts after the first omitted an argument. The replacement handles the important command line arguments but does not cover edge cases as well as `clap`.", "body_md": "My **Rust program** used the `clap` crate to handle command line arguments, and it worked well. But I wanted to try using an LLM to **generate some custom code** to replace it, to see if there would be any performance improvements or reductions in bloat.\n\nI wrote a 120-line **spec**, complete with examples, in **Markdown**, and set **Gemini 3.8 Flash** (on OpenRouter) to implementing the code. The first time, I forgot an argument, so I had to generate it twice. Each generation cost me about $0.02, so it was affordable.\n\nSome **observations**:\n\n• Removing `clap` from my program reduced the compiled executable file size by 300 kB, and reduced the time required in argument parsing from 20 microseconds to about 1 microsecond.\n\n• My vibe-coded replacement function does not handle edge cases as well, but it handles all the important command line arguments I needed.", "url": "https://wpnews.pro/news/rewrote-command-line-argument-handling", "canonical_source": "https://www.dotnetperls.com/2026_9_30_rewrote-command-line-arguments", "published_at": "2026-09-30 07:00:00+00:00", "updated_at": "2026-09-30 15:47:12.925650+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "generative-ai", "developer-tools"], "entities": ["Rust", "clap", "Gemini 3.8 Flash", "OpenRouter"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/rewrote-command-line-argument-handling", "markdown": "https://wpnews.pro/news/rewrote-command-line-argument-handling.md", "text": "https://wpnews.pro/news/rewrote-command-line-argument-handling.txt", "jsonld": "https://wpnews.pro/news/rewrote-command-line-argument-handling.jsonld"}}