How can I write vim mappings to stdout?

I would like to write the output of :map to stdout from the vim cli so I can read my vim keymaps from a script and do something with them. How can I accomplish this?

I've tried vim -c map > out.txt and vim -c "map|q" > out.txt as text cases, but neither work. :map opens a pager while inside vim, I think I may need a way to bypass this.


Based on https://stackoverflow.com/a/33190693/355325 I came up with this:

vim -e +"redir>>/dev/stdout | map | redir END" -scq