mirror of
https://github.com/logseq/logseq.git
synced 2026-04-26 07:05:10 +00:00
impl 002-logseq-cli-subcommands.md
This commit is contained in:
@@ -18,7 +18,7 @@ node ./static/db-worker-node.js
|
||||
## Run the CLI
|
||||
|
||||
```bash
|
||||
node ./static/logseq-cli.js graph-list --base-url http://127.0.0.1:9101
|
||||
node ./static/logseq-cli.js graph list --base-url http://127.0.0.1:9101
|
||||
```
|
||||
|
||||
## Configuration
|
||||
@@ -38,28 +38,41 @@ CLI flags take precedence over environment variables, which take precedence over
|
||||
## Commands
|
||||
|
||||
Graph commands:
|
||||
- `graph-list` - list all db graphs
|
||||
- `graph-create --graph <name>` - create a new db graph and switch to it
|
||||
- `graph-switch --graph <name>` - switch current graph
|
||||
- `graph-remove --graph <name>` - remove a graph
|
||||
- `graph-validate --graph <name>` - validate graph data
|
||||
- `graph-info [--graph <name>]` - show graph metadata (defaults to current graph)
|
||||
- `graph list` - list all db graphs
|
||||
- `graph create --graph <name>` - create a new db graph and switch to it
|
||||
- `graph switch --graph <name>` - switch current graph
|
||||
- `graph remove --graph <name>` - remove a graph
|
||||
- `graph validate --graph <name>` - validate graph data
|
||||
- `graph info [--graph <name>]` - show graph metadata (defaults to current graph)
|
||||
|
||||
Graph content commands:
|
||||
- `add --content <text> [--page <name>] [--parent <uuid>]` - add blocks; defaults to today’s journal page if no page is given
|
||||
- `add --blocks <edn> [--page <name>] [--parent <uuid>]` - insert blocks via EDN vector
|
||||
- `add --blocks-file <path> [--page <name>] [--parent <uuid>]` - insert blocks from an EDN file
|
||||
- `remove --block <uuid>` - remove a block and its children
|
||||
- `remove --page <name>` - remove a page and its children
|
||||
- `search --text <query> [--limit <n>]` - search block titles (Datalog includes?)
|
||||
- `tree --page <name> [--format text|json|edn]` - show page tree
|
||||
- `tree --block <uuid> [--format text|json|edn]` - show block tree
|
||||
Block commands:
|
||||
- `block add --content <text> [--page <name>] [--parent <uuid>]` - add blocks; defaults to today’s journal page if no page is given
|
||||
- `block add --blocks <edn> [--page <name>] [--parent <uuid>]` - insert blocks via EDN vector
|
||||
- `block add --blocks-file <path> [--page <name>] [--parent <uuid>]` - insert blocks from an EDN file
|
||||
- `block remove --block <uuid>` - remove a block and its children
|
||||
- `block remove --page <name>` - remove a page and its children
|
||||
- `block search --text <query> [--limit <n>]` - search block titles (Datalog includes?)
|
||||
- `block tree --page <name> [--format text|json|edn]` - show page tree
|
||||
- `block tree --block <uuid> [--format text|json|edn]` - show block tree
|
||||
|
||||
Help output:
|
||||
|
||||
```
|
||||
Subcommands:
|
||||
block add [options] Add blocks
|
||||
block remove [options] Remove block or page
|
||||
block search [options] Search blocks
|
||||
block tree [options] Show tree
|
||||
```
|
||||
|
||||
Output formats:
|
||||
- Global `--output <human|json|edn>` (also accepted per subcommand)
|
||||
|
||||
Examples:
|
||||
|
||||
```bash
|
||||
node ./static/logseq-cli.js graph-create --graph demo --base-url http://127.0.0.1:9101
|
||||
node ./static/logseq-cli.js add --page TestPage --content "hello world"
|
||||
node ./static/logseq-cli.js search --text "hello"
|
||||
node ./static/logseq-cli.js tree --page TestPage --format json
|
||||
node ./static/logseq-cli.js graph create --graph demo --base-url http://127.0.0.1:9101
|
||||
node ./static/logseq-cli.js block add --page TestPage --content "hello world"
|
||||
node ./static/logseq-cli.js block search --text "hello"
|
||||
node ./static/logseq-cli.js block tree --page TestPage --format json --output json
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user