Originally Posted by kingsinger
Is it possible to filter by a perspective?
Not yet - that would be nice though!
The nearest you can get is to use the filtering to include/exclude the same (or a similar set) of tasks that you see in your perspective.
ofexport -p 'text="Proj1|Proj2"' -E -a done=any --open -o ~/Desktop/x.taskpaper
Would do the trick, but you'd have to keep it up to date with what projects are current. I have a bunch of little fragments like this that I put in dedicated bash scripts.
Alternatively, a lower maintenance scheme is to "tag" the projects you want to appear in your report by adding something to the notes in your current projects in OmniFocus.
For example by adding "#current" to the notes of a few of your projects you could then use:
ofexport -p 'note="#current"' -E -a done=any --open -o ~/Desktop/x.taskpaper
I use this trick for exporting certain items to my calendar.
The problem with ofexport directly using perspectives is that I think the each perspective is stored as a rule that has to be executed in order to derive what's visible in it - and there are several aspects of the visibility of items in the omnifocus database that I've yet to understand (such as if a project/context is paused, or what the next action is). Until I've decoded those I can't really replicate a perspective faithfully.
Detecting the paused/on-hold status is next on my list of things to decipher.