Comments (9)
Nice! $25 donated to EFF.
from cmdargs.
Or, indeed, avoid calling error at all.
from cmdargs.
Probably a custom exception type, and then a throw would be my guess, which would then default to not having the stack trace. Good spot.
from cmdargs.
/me adds a bounty to this issue: codemill$25
from cmdargs.
Please note that I am unable to accept bounties (the amount of paperwork from my day job would be too much hassle), so if it does get fixed to your satisfaction and you want to, please donate any money to a charity of your choice.
That said, a bounty does make it clear that it's an important issue, so it's helpful to see.
from cmdargs.
Thanks Neil. I'll reply here:
The problem is you are calling processValue, which is essentially process but with an error on the Left. > See https://hackage.haskell.org/package/cmdargs-0.10.16/docs/src/System-Console-CmdArgs-Explicit.html#processValue
I suspect you might get better results if you were to handle the error yourself doing:
case process m args of
Left x -> do hPutStrLn stderr x; exitFailure
Right x -> return x
Should I add a processValueIO that does that? My guess is that processValue will never present exactly > the UI you want.
I now understand differences betwee process/processArgs/processValue better. You're right, it's an easy fix on my side: change processValue mode args
to either errorWithoutStackTrace id $ process mode args
. So that's good. But also, I think processValue should be calling errorWithoutStackTrace. I believe processArgs already does, which I realised after some head-scratching.
Re bounty - not even a simple personal donation ? Ok, will do! I too like the signalling effect of bounties.
from cmdargs.
processArgs
does the hPutStrLn/exitFailure
combo, since it's in the IO
monad. Unfortunately processValue
isn't so it can't do that. Note that hPutStrLn
gives you more control than error
since it removes the *** Exception
prefix as well.
from cmdargs.
Ok, but is it ever the right behaviour for cmdargs to show a stack trace to command line users ?
from cmdargs.
No, it's not, I decided you are right. I've made 2 changes in the newly released 0.10.17:
Add processValueIO for more controlled error messages
#529, don't include the stack trace in processValue
from cmdargs.
Related Issues (20)
- expandArgsAt doesn't understand ~ HOT 1
- modeHelp eats blank lines HOT 1
- Generate help text if no default mode was specified HOT 2
- Wondering how to make a required argument. HOT 4
- A problem with common flags and multiple typFile resulting in "ITEM" HOT 4
- sudo-like cli: a way to instruct `cmdargs` to not look for flags in the remaining arguments HOT 2
- man and info generation
- Using `&= help` with `&= argPos` throws an error HOT 1
- Comments in args file HOT 5
- Default Lists?
- Running multiple sub-commands HOT 1
- Inconsistency in handling boolean arguments HOT 1
- Way to use multiple modes without partial record field selectors? HOT 2
- Tighter bounds base for old cmdargs HOT 1
- Is it possible to create arguments with only a single dash? HOT 1
- hidden arguments? HOT 6
- splitArgs: document quoting rules
- How can I customize --numeric-version? HOT 13
- Incorrect handling of subcommands with the same argument HOT 1
- ghc-9.6.1 runtime error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cmdargs.