drawrect is a CLI debugging OS X tool that draws NS/CGRects on screen
drawrect
is a simple command line OS X app that draws rectangles on the screen.
It was originally designed to aid debugging Shortcat by visualising CGRect
s or NSRect
s from within lldb
.
It also serves as an example on how to build a command line app with RubyMotion.
drawrect
was designed to be used from within lldb
dr object.bounds
- draws a rect at object.bounds using bottom-left origindrf object.bounds
- draws a rect at object.bounds using top-left origindrc
- clears all rectsYou can use it from the command line as well.
Usage:
drawrect rect <rect> [label] [colour] [opacity] - draws a rect with bottom left origin
drawrect flipped_rect <rect> [label] [colour] [opacity] - draws a rect with top left origin
drawrect clear - clears all rects
drawrect quit - quits server
curl -L https://github.com/chendo/drawrect/releases/download/v1.0/drawrect > /usr/local/bin/drawrect && chmod +x /usr/local/bin/drawrect
lldb
script:
mkdir -p ~/Library/lldb; curl -L https://github.com/chendo/drawrect/raw/master/drawrect.py > ~/Library/lldb/drawrect.py
echo "command script import ~/Library/lldb/drawrect.py" >> ~/.lldbinit
drawrect
server will exit after an hour of inactivity.lldb
quits. I couldn’t seem to find hooks for process termination or resuming execution.drawrect
is written in RubyMotion, so you’ll need that to compile it.
$ rake build:development # binary will get built at `build/MacOSX*/drawrect.app/MacOS/drawrect`
See LICENSE for details.