How to use the hammerspoon CLI?

Viewed 321

I'd like to be able to run a command like hs -m foo -c bar -- baz and run some code using bar and/or baz. The hs -h help message says that baz should be available via _cli._args or _cli.args, but I can't figure out where the _cli value exists.

Here's the code I have:

local ipc = require('hs.ipc')

local port

function fooHandler()
    print('Hello, World!')
end

port = ipc.localPort('foo', fooHandler)

The output of hs -m foo -c bar -- baz is:

-- Legacy mode enabled --
nil

I'm sure there's a simple answer, but I can't find it.

0 Answers
Related