2 ms·
Kind of my line of thinking as well. I would never pull in a library with a 100 features when my software only needs 2 of those features. I write those 2 featur
by erikbye 6y ago
Kind of my line of thinking as well. I would never pull in a library with a 100 features when my software only needs 2 of those features. I write those 2 features myself.
- notretarded 6y agoThat's dumb. What a waste of time.
- SideburnsOfDoom 6y agoa) Which of those libraries do they use only 2% of the features from? One the template is filled out, won't it be higher. b) There are certain things that look simple, but you _do not_ want to waste your time coding the corner cases yourself when this is a solved problem. e.g. You might think that commandline args is simple, but it is very much not. if you '-file foo.txt' working, how will you handle '-file "C:\Program Files (x86)\bar\foo bar.txt" ' ? If you get `-message hello` ? working, will your code handle `-message "hello, "friend""` ? Having this prebuilt is useful.
- Arnavion 6y agoNeither of your examples requires anything from the program regardless of what language it's written in, let alone what arg-parsing library it uses. Quotes are evaluated by the shell; your program gets an argv. (Yes, Windows is complicated by having two different built-in parsers for argv [CRT and shellapi] because the kernel itself doesn't have a concept of argv. But if we're talking about .Net programs then the runtime makes that choice and gives your entrypoint an argv, so again quote-evaluation is not in the program's purview.)
- SideburnsOfDoom 6y agoMy example may not be the best, but .NET Commandline handling libraries contain significant quote-handline code. I know because I have relied on it. I'm less familiar with the library that OP is using, but it seems to be here: https://github.com/spectresystems/spectre.console/blob/main/src/Spectre.Console/Cli/Internal/Parsing/CommandTreeTokenizer.cs#L92 https://github.com/spectresystems/spectre.console/blob/main/... Going in the other direction, generating command lines: https://github.com/natemcmaster/CommandLineUtils/blob/main/src/CommandLineUtils/Utilities/ArgumentEscaper.cs https://github.com/natemcmaster/CommandLineUtils/blob/main/s... I don't recommend re-inventing this