diff --git a/deps/db/src/logseq/db/frontend/property.cljs b/deps/db/src/logseq/db/frontend/property.cljs index c57e65bc1f..ca4f015531 100644 --- a/deps/db/src/logseq/db/frontend/property.cljs +++ b/deps/db/src/logseq/db/frontend/property.cljs @@ -773,6 +773,11 @@ ;; Disallow tags or page refs as they would create unreferenceable page names (not (re-find #"^(#|\[\[)" s))) +(defn built-in-closed-values + "Gets :closed-values for given built-in property ident" + [ident] + (get-in built-in-properties [ident :closed-values])) + (defn get-closed-property-values [db property-id] (when db diff --git a/src/main/logseq/cli/command/list.cljs b/src/main/logseq/cli/command/list.cljs index fa459aebfb..9cac6d258c 100644 --- a/src/main/logseq/cli/command/list.cljs +++ b/src/main/logseq/cli/command/list.cljs @@ -7,7 +7,8 @@ [logseq.cli.server :as cli-server] [logseq.cli.transport :as transport] [logseq.common.util :as common-util] - [promesa.core :as p])) + [promesa.core :as p] + [logseq.db.frontend.property :as db-property])) (def ^:private list-common-spec {:expand {:desc "Include expanded metadata" @@ -126,9 +127,12 @@ (merge-with merge list-common-spec - {:status {:desc "Filter by task status"} + {:status {:desc "Filter by task status" + :values (mapv (comp string/lower-case :value) + (db-property/built-in-closed-values :logseq.property/status))} :priority {:desc "Filter by task priority" - :validate #{"low" "medium" "high" "urgent"}} + :validate (set (map (comp string/lower-case :value) + (db-property/built-in-closed-values :logseq.property/priority)))} :content {:desc "Filter by task title content" :alias :c} :sort {:validate (set (keys list-task-field-map))} @@ -147,8 +151,11 @@ (merge-with merge list-common-spec - {:tags {:desc "Filter by tags (comma separated selectors)"} - :properties {:desc "Filter by properties (comma separated selectors)"} + {:tags {:desc "Filter by tags (comma separated selectors)" + ;; Autocomplete first tag until there is comma-delimited tags completion + :complete :tags} + :properties {:desc "Filter by properties (comma separated selectors)" + :complete :properties} :sort {:validate (set (keys list-node-field-map))} :fields {:multiple-values (keys list-node-field-map)}})) diff --git a/src/main/logseq/cli/command/upsert.cljs b/src/main/logseq/cli/command/upsert.cljs index c23bdd4f09..65e010f1e2 100644 --- a/src/main/logseq/cli/command/upsert.cljs +++ b/src/main/logseq/cli/command/upsert.cljs @@ -10,7 +10,8 @@ [logseq.common.graph :as common-graph] [logseq.common.util :as common-util] [logseq.db.frontend.property.type :as db-property-type] - [promesa.core :as p])) + [promesa.core :as p] + [logseq.db.frontend.property :as db-property])) (def ^:private upsert-block-spec {:id {:desc "Source block db/id (forces update mode) [update only]" @@ -67,7 +68,9 @@ :complete :pages} :pos {:desc "Position. Default: last-child" :validate #{"first-child" "last-child" "sibling"}} - :status {:desc "Set task status"} + :status {:desc "Set task status" + :values (mapv (comp string/lower-case :value) + (db-property/built-in-closed-values :logseq.property/status))} :priority {:desc "Set task priority"} :scheduled {:desc "Set task scheduled datetime"} :deadline {:desc "Set task deadline datetime"}