mirror of
https://github.com/logseq/logseq.git
synced 2026-05-18 01:42:19 +00:00
772 lines
53 KiB
Clojure
772 lines
53 KiB
Clojure
[
|
|
{:id "global-help"
|
|
:cmds ["{{cli}} --help"]
|
|
:expect {:exit 0
|
|
:stdout-contains ["Usage: logseq <command> [options]"
|
|
"graph create"
|
|
"completion"]}
|
|
:covers {:options {:global ["--help"]}}
|
|
:tags [:global :smoke]}
|
|
|
|
{:id "global-version"
|
|
:cmds ["{{cli}} --version"]
|
|
:expect {:exit 0
|
|
:stdout-contains ["Build time:" "Revision:"]}
|
|
:covers {:options {:global ["--version"]}}
|
|
:tags [:global :smoke]}
|
|
|
|
{:id "verbose-graph-list-json"
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json --verbose graph list"]
|
|
:expect {:exit 0
|
|
:stderr-contains [":cli/parsed-options"]
|
|
:stdout-json-paths {[:status] "ok"}}
|
|
:covers {:commands ["graph list"]
|
|
:options {:global ["--config" "--data-dir" "--output" "--verbose"]}}
|
|
:tags [:global :graph]}
|
|
|
|
{:id "graph-create-and-info-json"
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph info --graph {{graph-arg}}"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :graph] "{{graph}}"}}
|
|
:covers {:commands ["graph create" "graph info"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:graph :smoke]}
|
|
|
|
{:id "graph-list-human"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human graph list"]
|
|
:expect {:exit 0
|
|
:stdout-contains ["{{graph}}"]}
|
|
:covers {:commands ["graph list"]
|
|
:options {:global ["--config" "--data-dir" "--output"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:graph]}
|
|
|
|
{:id "graph-list-edn"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output edn graph list"]
|
|
:expect {:exit 0
|
|
:stdout-edn-paths {[:status] :ok
|
|
[:data :graphs] ["{{graph}}"]}}
|
|
:covers {:commands ["graph list"]
|
|
:options {:global ["--config" "--data-dir" "--output"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:graph]}
|
|
|
|
{:id "graph-switch-json"
|
|
:vars {:other-graph "graph-two"
|
|
:other-graph-arg "graph-two"}
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{other-graph-arg}} >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph switch --graph {{other-graph-arg}}"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :message] "switched to graph-two"}}
|
|
:covers {:commands ["graph switch"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{other-graph-arg}}"]
|
|
:tags [:graph]}
|
|
|
|
{:id "graph-validate-fix-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph validate --graph {{graph-arg}} --fix"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :result :errors] nil}}
|
|
:covers {:commands ["graph validate"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:graph ["--fix"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:graph]}
|
|
|
|
{:id "graph-export-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page ExportHome >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph export --graph {{graph-arg}} --type edn --file {{export-path-arg}}"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"}
|
|
:stdout-contains ["{{export-path}}"]}
|
|
:covers {:commands ["graph export"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:graph ["--type" "--file"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:graph]}
|
|
|
|
{:id "graph-import-json"
|
|
:vars {:source-graph "source-graph"
|
|
:source-graph-arg "source-graph"}
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{source-graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{source-graph-arg}} --page ImportSeed >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph export --graph {{source-graph-arg}} --type edn --file {{export-path-arg}} >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph import --graph {{graph-arg}} --type edn --input {{export-path-arg}}"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"}
|
|
:stdout-contains ["Imported edn from" "{{export-path}}"]}
|
|
:covers {:commands ["graph import"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:graph ["--type" "--input"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{source-graph-arg}}"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:graph]}
|
|
|
|
{:id "graph-backup-lifecycle-json"
|
|
:vars {:restore-graph "backup-restore"
|
|
:restore-graph-arg "backup-restore"}
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page BackupSeed >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph backup create --graph {{graph-arg}} --name nightly >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph backup list"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph backup restore --src \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph backup list | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"backups\"][0][\"name\"])')\" --dst {{restore-graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph backup remove --src \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph backup list | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"backups\"][0][\"name\"])')\""]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"}}
|
|
:covers {:commands ["graph backup create"
|
|
"graph backup list"
|
|
"graph backup restore"
|
|
"graph backup remove"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:graph ["--name" "--src" "--dst"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{restore-graph-arg}}"]
|
|
:tags [:graph]}
|
|
|
|
{:id "page-upsert-and-list-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list page --graph {{graph-arg}} --fields title,id --sort updated-at --order desc --limit 1"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :items 0 :block/title] "Home"}}
|
|
:covers {:commands ["upsert page" "list page"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:upsert ["--page"]
|
|
:list ["--fields" "--limit" "--sort" "--order"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:upsert :list :smoke]}
|
|
|
|
{:id "block-upsert-and-show-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json show --graph {{graph-arg}} --page Home --level 2 --linked-references false"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :root :block/children 0 :block/title] "Alpha block"}}
|
|
:covers {:commands ["upsert block" "show"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:upsert ["--target-page" "--content"]
|
|
:show ["--page" "--level" "--linked-references"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:upsert :show :smoke]}
|
|
|
|
{:id "tag-upsert-and-list-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert tag --graph {{graph-arg}} --name TagOne >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list tag --graph {{graph-arg}} --with-properties --sort updated-at --order desc --limit 1"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :items 0 :block/title] "TagOne"}}
|
|
:covers {:commands ["upsert tag" "list tag"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:upsert ["--name"]
|
|
:list ["--with-properties" "--sort" "--order" "--limit"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:upsert :list]}
|
|
|
|
{:id "property-upsert-and-list-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name score --type number --cardinality one >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list property --graph {{graph-arg}} --with-type --sort updated-at --order desc --limit 1"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :items 0 :block/title] "score"
|
|
[:data :items 0 :logseq.property/type] "number"
|
|
[:data :items 0 :db/cardinality] "db.cardinality/one"}}
|
|
:covers {:commands ["upsert property" "list property"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:upsert ["--name" "--type" "--cardinality"]
|
|
:list ["--with-type" "--sort" "--order" "--limit"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:upsert :list]}
|
|
|
|
{:id "list-tag-expand-offset-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert tag --graph {{graph-arg}} --name TagA >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert tag --graph {{graph-arg}} --name TagB >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list tag --graph {{graph-arg}} --expand --with-extends --sort updated-at --order desc --offset 0 --limit 20"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"}
|
|
:stdout-contains ["TagA" "TagB"]}
|
|
:covers {:commands ["list tag"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:list ["--expand" "--with-extends" "--offset" "--sort" "--order" "--limit"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:list]}
|
|
|
|
{:id "list-property-classes-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name alpha --type number --cardinality one >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name beta --type number --cardinality one >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list property --graph {{graph-arg}} --with-classes --sort updated-at --order desc --offset 0 --limit 20"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"}
|
|
:stdout-contains ["alpha" "beta"]}
|
|
:covers {:commands ["list property"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:list ["--with-classes" "--sort" "--order" "--offset" "--limit"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:list]}
|
|
|
|
{:id "list-page-journal-only-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list page --graph {{graph-arg}} --journal-only"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :items] []}}
|
|
:covers {:commands ["list page"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:list ["--journal-only"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:list]}
|
|
|
|
{:id "search-block-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SearchBlockTarget >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} search block --content blocktarget --output json --graph {{graph-arg}}"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"}
|
|
:stdout-contains ["SearchBlockTarget"]}
|
|
:covers {:commands ["search block"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:search ["--content"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:search :smoke]}
|
|
|
|
{:id "search-page-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SearchPageTarget >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json search page --content target --graph {{graph-arg}}"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"}
|
|
:stdout-contains ["SearchPageTarget"]}
|
|
:covers {:commands ["search page"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:search ["--content"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:search]}
|
|
|
|
{:id "search-property-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name SearchOwner --type default >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json search property --content owner --graph {{graph-arg}}"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"}
|
|
:stdout-contains ["SearchOwner"]}
|
|
:covers {:commands ["search property"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:search ["--content"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:search]}
|
|
|
|
{:id "search-tag-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert tag --graph {{graph-arg}} --name SearchTagTarget >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json search tag --content target --graph {{graph-arg}}"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"}
|
|
:stdout-contains ["SearchTagTarget"]}
|
|
:covers {:commands ["search tag"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:search ["--content"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:search]}
|
|
|
|
{:id "block-upsert-blocks-file-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Anchor block' >/dev/null"
|
|
"printf '[{:block/title \"Inserted from file\"}]' > {{export-path-arg}}"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human upsert block --graph {{graph-arg}} --target-id \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"Anchor block\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\" --blocks-file {{export-path-arg}} --pos sibling >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human show --graph {{graph-arg}} --page Home"]
|
|
:expect {:exit 0
|
|
:stdout-contains ["Inserted from file"]}
|
|
:covers {:commands ["upsert block"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:upsert ["--blocks-file" "--target-id" "--pos"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:upsert]}
|
|
|
|
{:id "block-upsert-target-uuid-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Anchor block' >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human upsert block --graph {{graph-arg}} --target-uuid \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?uuid . :where [?e :block/title \"Anchor block\"] [?e :block/uuid ?uuid]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\" --content 'Inserted by uuid' >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human show --graph {{graph-arg}} --page Home"]
|
|
:expect {:exit 0
|
|
:stdout-contains ["Inserted by uuid"]}
|
|
:covers {:commands ["upsert block"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:upsert ["--target-uuid"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:upsert]}
|
|
|
|
{:id "block-upsert-update-id-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human upsert block --graph {{graph-arg}} --id \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"Alpha block\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\" --content 'Updated by id' --status doing --update-tags '[:logseq.class/Quote-block]' --update-properties '{:logseq.property/publishing-public? true}' >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human show --graph {{graph-arg}} --page Home"]
|
|
:expect {:exit 0
|
|
:stdout-contains ["Updated by id"]}
|
|
:covers {:commands ["upsert block"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:upsert ["--id" "--status" "--update-tags" "--update-properties"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:upsert]}
|
|
|
|
{:id "block-upsert-update-id-custom-many-property-json"
|
|
:vars {:prop-name "Reproducible steps"}
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name '{{prop-name}}' --type default --cardinality many --public true >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --id \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"Alpha block\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\" --update-properties '{\"{{prop-name}}\" [\"Step 1\" \"Step 2\" \"Step 3\"]}' >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human show --graph {{graph-arg}} --id \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"Alpha block\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\""]
|
|
:expect {:exit 0
|
|
:stdout-contains ["{{prop-name}}" "Step 1" "Step 2" "Step 3"]}
|
|
:covers {:commands ["upsert block" "show"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:upsert ["--id" "--target-page" "--content" "--update-properties"]
|
|
:show ["--id"]}}
|
|
:tags [:upsert :show]}
|
|
|
|
{:id "block-upsert-update-uuid-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' --update-tags '[:logseq.class/Quote-block]' --update-properties '{:logseq.property/publishing-public? true}' >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human upsert block --graph {{graph-arg}} --uuid \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?uuid . :where [?e :block/title \"Alpha block\"] [?e :block/uuid ?uuid]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\" --content 'Updated by uuid' --remove-tags '[:logseq.class/Quote-block]' --remove-properties '[:logseq.property/publishing-public?]' >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human show --graph {{graph-arg}} --page Home"]
|
|
:expect {:exit 0
|
|
:stdout-contains ["Updated by uuid"]}
|
|
:covers {:commands ["upsert block"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:upsert ["--uuid" "--remove-tags" "--remove-properties"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:upsert]}
|
|
|
|
{:id "property-upsert-update-id-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name score --type number --cardinality one >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --id \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list property --graph {{graph-arg}} --fields title,id --limit 200 --sort updated-at --order desc | python3 -c 'import sys,json; print(next(item[\"db/id\"] for item in json.load(sys.stdin)[\"data\"][\"items\"] if item[\"block/title\"] == \"score\"))')\" --hide true --public false"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"}}
|
|
:covers {:commands ["upsert property"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:upsert ["--id" "--hide" "--public"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:upsert]}
|
|
|
|
{:id "query-custom-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?title . :where [?b :block/title ?title] [(= ?title \"Alpha block\")]]'"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :result] "Alpha block"}}
|
|
:covers {:commands ["query"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:query ["--query"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:query]}
|
|
|
|
{:id "query-named-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --name recent-updated --inputs '[1]'"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"}}
|
|
:covers {:commands ["query"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:query ["--name" "--inputs"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:query]}
|
|
|
|
{:id "query-list-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query list --graph {{graph-arg}}"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :queries 0 :name] "list-priority"}}
|
|
:covers {:commands ["query list"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:query]}
|
|
|
|
{:id "example-show-human"
|
|
:cmds ["{{cli}} --output human example show"]
|
|
:expect {:exit 0
|
|
:stdout-contains ["Selector: show"
|
|
"Matched commands:"
|
|
"show"
|
|
"Examples:"]}
|
|
:covers {:commands ["example show"]
|
|
:options {:global ["--output"]}}
|
|
:tags [:example]}
|
|
|
|
{:id "example-upsert-page-json"
|
|
:cmds ["{{cli}} --output json example upsert page"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :selector] "upsert page"
|
|
[:data :matched-commands 0] "upsert page"}}
|
|
:covers {:commands ["example upsert page"]
|
|
:options {:global ["--output"]}}
|
|
:tags [:example]}
|
|
|
|
{:id "example-upsert-prefix-json"
|
|
:cmds ["{{cli}} --output json example upsert"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :selector] "upsert"
|
|
[:data :matched-commands 0] "upsert block"}}
|
|
:covers {:commands ["example upsert"]
|
|
:options {:global ["--output"]}}
|
|
:tags [:example]}
|
|
|
|
{:id "example-list-prefix-json"
|
|
:cmds ["{{cli}} --output json example list"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :selector] "list"
|
|
[:data :matched-commands 0] "list page"}}
|
|
:covers {:commands ["example list"]
|
|
:options {:global ["--output"]}}
|
|
:tags [:example]}
|
|
|
|
{:id "example-list-page-json"
|
|
:cmds ["{{cli}} --output json example list page"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :selector] "list page"
|
|
[:data :matched-commands] ["list page"]}}
|
|
:covers {:commands ["example list page"]
|
|
:options {:global ["--output"]}}
|
|
:tags [:example]}
|
|
|
|
{:id "example-query-prefix-json"
|
|
:cmds ["{{cli}} --output json example query"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :selector] "query"
|
|
[:data :matched-commands 0] "query"}}
|
|
:covers {:commands ["example query"]
|
|
:options {:global ["--output"]}}
|
|
:tags [:example]}
|
|
|
|
{:id "example-query-list-json"
|
|
:cmds ["{{cli}} --output json example query list"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :selector] "query list"
|
|
[:data :matched-commands] ["query list"]}}
|
|
:covers {:commands ["example query list"]
|
|
:options {:global ["--output"]}}
|
|
:tags [:example]}
|
|
|
|
{:id "example-remove-prefix-json"
|
|
:cmds ["{{cli}} --output json example remove"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :selector] "remove"
|
|
[:data :matched-commands 0] "remove block"}}
|
|
:covers {:commands ["example remove"]
|
|
:options {:global ["--output"]}}
|
|
:tags [:example]}
|
|
|
|
{:id "example-remove-page-json"
|
|
:cmds ["{{cli}} --output json example remove page"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :selector] "remove page"
|
|
[:data :matched-commands] ["remove page"]}}
|
|
:covers {:commands ["example remove page"]
|
|
:options {:global ["--output"]}}
|
|
:tags [:example]}
|
|
|
|
{:id "example-search-prefix-json"
|
|
:cmds ["{{cli}} --output json example search"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :selector] "search"
|
|
[:data :matched-commands 0] "search block"}}
|
|
:covers {:commands ["example search"]
|
|
:options {:global ["--output"]}}
|
|
:tags [:example]}
|
|
|
|
{:id "example-search-block-edn"
|
|
:cmds ["{{cli}} --output edn example search block"]
|
|
:expect {:exit 0
|
|
:stdout-edn-paths {[:status] :ok
|
|
[:data :selector] "search block"
|
|
[:data :matched-commands] ["search block"]}}
|
|
:covers {:commands ["example search block"]
|
|
:options {:global ["--output"]}}
|
|
:tags [:example]}
|
|
|
|
{:id "show-id-human"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --graph {{graph-arg}} --output human show --id \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --graph {{graph-arg}} --output human query --query '[:find ?e . :where [?e :block/title \"Alpha block\"]]')\""]
|
|
:expect {:exit 0
|
|
:stdout-contains ["Alpha block"]}
|
|
:covers {:commands ["show"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:show ["--id"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:show]}
|
|
|
|
{:id "show-uuid-human"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --graph {{graph-arg}} --output human show --uuid \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --graph {{graph-arg}} --output json query --query '[:find ?uuid . :where [?e :block/title \"Alpha block\"] [?e :block/uuid ?uuid]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\""]
|
|
:expect {:exit 0
|
|
:stdout-contains ["Alpha block"]}
|
|
:covers {:commands ["show"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:show ["--uuid"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:show]}
|
|
|
|
{:id "show-stdin-id-human"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --graph {{graph-arg}} --output human query --query '[:find [?e ...] :in $ ?q :where [?e :block/title ?title] [(clojure.string/includes? ?title ?q)]]' --inputs '[\"Alpha\"]' | {{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --graph {{graph-arg}} --output human show --id"]
|
|
:expect {:exit 0
|
|
:stdout-contains ["Alpha block"]}
|
|
:covers {:commands ["show"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:show ["stdin:--id"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:show :pipe]}
|
|
|
|
{:id "debug-pull-id-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json debug pull --graph {{graph-arg}} --id \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"Home\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\""]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :entity :block/title] "Home"}}
|
|
:covers {:commands ["debug pull"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:debug ["--id"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:debug]}
|
|
|
|
{:id "debug-pull-uuid-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json debug pull --graph {{graph-arg}} --uuid \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?uuid . :where [?e :block/title \"Home\"] [?e :block/uuid ?uuid]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\""]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :entity :block/title] "Home"}}
|
|
:covers {:commands ["debug pull"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:debug ["--uuid"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:debug]}
|
|
|
|
{:id "debug-pull-ident-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json debug pull --graph {{graph-arg}} --ident :logseq.class/Tag"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :entity :db/ident] "logseq.class/Tag"}}
|
|
:covers {:commands ["debug pull"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:debug ["--ident"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:debug]}
|
|
|
|
{:id "debug-pull-current-graph-fallback-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json debug pull --id \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"Home\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\""]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :entity :block/title] "Home"}}
|
|
:covers {:commands ["debug pull"]
|
|
:options {:global ["--config" "--data-dir" "--output"]
|
|
:debug ["--id"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:debug]}
|
|
|
|
{:id "remove-page-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json remove page --graph {{graph-arg}} --page Home"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :result] true}}
|
|
:covers {:commands ["remove page"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:remove ["--page"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:remove]}
|
|
|
|
{:id "graph-remove-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}} >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph remove --graph {{graph-arg}}"]
|
|
:expect {:exit 1
|
|
:stdout-contains ["graph-not-removed"]}
|
|
:covers {:commands ["graph remove"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]}}
|
|
:tags [:graph :remove]}
|
|
|
|
{:id "remove-block-uuid-human"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human remove block --graph {{graph-arg}} --uuid \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?uuid . :where [?e :block/title \"Alpha block\"] [?e :block/uuid ?uuid]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\" >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human show --graph {{graph-arg}} --page Home --linked-references false"]
|
|
:expect {:exit 0
|
|
:stdout-not-contains ["Alpha block"]}
|
|
:covers {:commands ["remove block"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:remove ["--uuid"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:remove]}
|
|
|
|
{:id "remove-tag-name-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert tag --graph {{graph-arg}} --name TagOne >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json remove tag --graph {{graph-arg}} --name TagOne >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list tag --graph {{graph-arg}} --fields title,id"]
|
|
:expect {:exit 0
|
|
:stdout-not-contains ["TagOne"]}
|
|
:covers {:commands ["remove tag"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:remove ["--name"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:remove]}
|
|
|
|
{:id "remove-property-id-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name score --type number --cardinality one >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json remove property --graph {{graph-arg}} --id \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list property --graph {{graph-arg}} --fields title,id --limit 200 --sort updated-at --order desc | python3 -c 'import sys,json; print(next(item[\"db/id\"] for item in json.load(sys.stdin)[\"data\"][\"items\"] if item[\"block/title\"] == \"score\"))')\" >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list property --graph {{graph-arg}} --fields title,id"]
|
|
:expect {:exit 0
|
|
:stdout-not-contains ["score"]}
|
|
:covers {:commands ["remove property"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:remove ["--id"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:remove]}
|
|
|
|
{:id "server-status-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server status --graph {{graph-arg}}"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :repo] "{{graph}}"
|
|
[:data :status] "ready"}}
|
|
:covers {:commands ["server status"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:server ["--graph"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:server]}
|
|
|
|
{:id "server-list-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server list"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :servers 0 :repo] "{{graph}}"}}
|
|
:covers {:commands ["server list"]
|
|
:options {:global ["--config" "--data-dir" "--output"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:server]}
|
|
|
|
{:id "server-restart-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server restart --graph {{graph-arg}}"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :repo] "{{graph}}"
|
|
[:data :owned?] true}}
|
|
:covers {:commands ["server restart"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:server ["--graph"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:server]}
|
|
|
|
{:id "server-stop-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :repo] "{{graph}}"}}
|
|
:covers {:commands ["server stop"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:server ["--graph"]}}
|
|
:tags [:server]}
|
|
|
|
{:id "server-start-json"
|
|
:setup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"
|
|
"{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}} >/dev/null"]
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server start --graph {{graph-arg}}"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :repo] "{{graph}}"
|
|
[:data :owned?] true}}
|
|
:covers {:commands ["server start"]
|
|
:options {:global ["--config" "--graph" "--data-dir" "--output"]
|
|
:server ["--graph"]}}
|
|
:cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]
|
|
:tags [:server]}
|
|
|
|
{:id "completion-zsh"
|
|
:cmds ["{{cli}} completion zsh"]
|
|
:expect {:exit 0
|
|
:stdout-contains ["#compdef logseq"
|
|
"Auto-generated by `logseq completion zsh`"]}
|
|
:covers {:commands ["completion"]
|
|
:options {:completion ["zsh"]}}
|
|
:tags [:completion :smoke]}
|
|
|
|
{:id "completion-bash-flag"
|
|
:cmds ["{{cli}} completion --shell bash"]
|
|
:expect {:exit 0
|
|
:stdout-contains ["Auto-generated by `logseq completion bash`"
|
|
"_logseq_json_names_bash"]}
|
|
:covers {:commands ["completion"]
|
|
:options {:completion ["--shell" "bash"]}}
|
|
:tags [:completion]}
|
|
|
|
{:id "completion-invalid-shell"
|
|
:cmds ["{{cli}} completion fish"]
|
|
:expect {:exit 1
|
|
:stdout-contains ["unsupported shell: fish"]}
|
|
:covers {:commands ["completion"]}
|
|
:tags [:completion]}
|
|
|
|
{:id "doctor-dev-script-json"
|
|
:cmds ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json doctor --dev-script"]
|
|
:expect {:exit 0
|
|
:stdout-json-paths {[:status] "ok"
|
|
[:data :status] "ok"
|
|
[:data :checks 0 :id] "db-worker-script"}
|
|
:stdout-contains ["static/db-worker-node.js"]}
|
|
:covers {:commands ["doctor"]
|
|
:options {:global ["--config" "--data-dir" "--output"]
|
|
:doctor ["--dev-script"]}}
|
|
:tags [:doctor :smoke]}
|
|
]
|