Skip to content

get-todos can select tasks by the kind of page their block stands on #118

Closed

Description

@muellerei

A caller can list only the tasks whose block stands on a Journal Page, or only those that stand on any other page, in the two cases that no existing option covers.

What happens today

One case already works: get-todos --to D --no-follow-refs follows no ((block-ref)), so a task counts in the range only by the day of the page its block stands on, and tasks on ordinary pages drop out. "Journal tasks older than a year" is therefore one call, but the option's name says nothing about it, and it also turns off the references information.

Two cases have no option:

  • A selection without a range. "All open tasks that stand on Journal Pages" (or only on other pages). Without --from/--to, --no-follow-refs filters nothing. The workaround is jq on journal_day, which is present when the task's block stands on a Journal Page and absent otherwise. It has two gaps (both read from the code, not measured on a graph): count in the JSON still reports the number before the second filter ran, and plain-text output does not show journal_day, so there is nothing to filter on.
  • Carried tasks inside a range. With --from/--to, a task counts in the range when its own page, or any page it was carried to by a ((block-ref)), is in the range. There is no way to ask for only the tasks from ordinary pages that were carried into the range.

What changes for a caller

get-todos takes --page-type journal|page (case does not matter):

logseq-cli get-todos --page-type journal --state open
logseq-cli get-todos --page-type page --from 2026-03-01 --to 2026-03-31
logseq-cli get-todos --page-type journal --no-follow-refs --to 2025-10-06
  • journal keeps tasks whose block stands on a Journal Page. page keeps the rest.
  • The block counts, not the pages it was carried to. A task on Project Alpha that a journal only references is a page task.
  • The option only narrows the result and combines with the other filters (--page, --state, --from/--to, …) like they do with each other. It does not change how a range is read: --page-type journal --from 2026-03-05 still returns a journal task written earlier if a ((block-ref)) carries it into a day on or after that date, because that is where the task stands in that range.
  • To measure the range by the day of the block's own page, add --no-follow-refs, as in the third example. The help says so.
  • references and references_withheld are untouched; count is the filtered count. An empty result is not an error.
  • Without the option, output does not change.

The option keeps its name when get-todos is renamed as part of #92.

How to tell it is done

  • --page-type journal and --page-type page return disjoint, non-empty sets whose union is what the call returns without the option, with and without --from/--to.
  • A task whose block stands on an ordinary page and that appears in a journal only through a ((block-ref)) is returned by --page-type page and not by journal, also when the range includes that journal.
  • --page-type journal --no-follow-refs --to D returns exactly the tasks on Journal Pages up to D, and --page-type page --no-follow-refs --to D returns none.
  • With --page, both filters apply.
  • A value other than journal or page is refused and the message names both.
  • --help and the command reference describe the option, including that the block counts, that the range rule is unchanged, what page means ("any page that is not a Journal Page"), and the --no-follow-refs recipe.

Not part of this issue

  • Other commands (find-block, smart-query, analyze-*).
  • Measuring a range by the block's own day as an effect of this option. --no-follow-refs does that already, and the option stays a plain filter like --page and --tag.

Activity

  1. muellerei commented on Oct 6, 2026

    @muellerei
    OwnerAuthor

    Implemented in #119: get-todos --page-type journal|page, an option that only narrows. With --no-follow-refs it gives the "journal tasks older than a date" recipe by the block's own day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions