console
console copied to clipboard
Minor usability tweaks
First off, thanks for a great library 🎉
I'm currently working on integrating this into my project dottie and this is the accumulated fixes / improvements i've made along the way
- Pass in a base
context.Contextto(*console.Console).Start()allowing for application/command wide context keys can propagate properly when running commands - Print errors to
ErrOrStderrinstead ofStdout - Correctly surface cancellation cause in
console.execute()- it was previously alwayscontext.Canceledsince you need to callcontext.Cause()to get the underlying real error - Use explicit
return errinconsole.execute()to simplify debugging - Implement custom error types for most errors to ease detection and tracking of them
- Reuse
AddHistorySourceinAddHistorySourceFileinstead of duplicating logic - Reset flag values (in particular Slice flags) values between runs so they don't accumulate