Detailed and colorful output - #15
Conversation
|
Thanks for the PR! I finally had time to review it, and before merging could you fix some issues first?
Those depend on being executed in the auto-execute section, which introduces a silent dependency of print.ahk being in a specific location in the code. It'd be better to either avoid modifying prototypes at all, or move them somewhere they are guaranteed to execute even when code is later moved around/changed.
|
FreeConsole returns a non-0 integer on success, and a non-0 callback result for OnExit prevents script exit, thus Aris wouldn't quit?
|
This is a common issue with cleaning up DLL calls at exit. It's solved by pointing OnExit at a tiny shim function/method which does the actual cleanup calls. Here's a stripped example I use to implement my database library as a subclass without it hanging on exit: initDB(pathToDB?,journal_mode := "wal",synchronous := 0){
;truncated for clarity
pathToDB ??= A_ScriptDir "\cache\" StrReplace(A_ScriptName,".ahk") ".db"
this.acDB := SQriLiteDB()
this.acDB.openDB(pathToDB)
OnExit (*) => this._cleanup()
}
_cleanup(){
this.CloseDB()
}
CloseDB(){
this.acDB.exec("PRAGMA optimize;")
return this.acDb.CloseDB()
}Hope that helps! |


Colorful output
After messing around with colors for Launcher project I found a way to make fast color-formatting for console output.

String.Prototype.Color()inAris/Lib/Print.ahknow applies ANSI codes to the target message andPrint()outputs formatted message to theCONOUT$(*). I also added wrappers for warnings and errors inAris/Lib/Print.ahk.Help message
For some reason Aris misses very important
--help,-hswitch. Now it can display help message:I don't understand how
--aliasworks, so it's missing here, please add it. Also I don't understand other switches:--global,--local,--main. Please revise help message.