mirror of
https://github.com/logseq/logseq.git
synced 2026-05-29 15:09:41 +00:00
enhance(cli): completion for 2 new options to list node
Also bring back :status completion for task commands
This commit is contained in:
5
deps/db/src/logseq/db/frontend/property.cljs
vendored
5
deps/db/src/logseq/db/frontend/property.cljs
vendored
@@ -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
|
||||
|
||||
@@ -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)}}))
|
||||
|
||||
|
||||
@@ -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"}
|
||||
|
||||
Reference in New Issue
Block a user