diff --git a/src/apps/cli/README.md b/src/apps/cli/README.md index 02dba18..ec4a772 100644 --- a/src/apps/cli/README.md +++ b/src/apps/cli/README.md @@ -61,8 +61,8 @@ lsync [database-path] [command] [args...] ### Commands - `sync`: Run one replication cycle with the remote CouchDB. -- `mirror [vault-path]`: Bidirectional sync between the local database and a local directory (**the actual vault**). - - If `vault-path` is provided, the CLI will synchronise the database with files in that directory. +- `mirror [database-path] [vault-path]`: Bidirectional sync between the local database and a local directory (**the actual vault**). + - If `vault-path` is provided, the CLI will synchronise the database with files in the vault directory. - If `vault-path` is omitted, it defaults to `database-path` (compatibility mode). - Use this command to keep your local `.md` files in sync with the database. - `ls [prefix]`: List files currently stored in the local database. @@ -229,7 +229,8 @@ The CLI uses the same settings format as the Obsidian plugin. Create a `.livesyn ``` Usage: - livesync-cli [database-path] [options] [command] [command-args] + livesync-cli [options] [command-args] + livesync-cli init-settings [path] Arguments: database-path Path to the local database directory (required except for init-settings) @@ -238,7 +239,8 @@ Options: --settings, -s Path to settings file (default: .livesync/settings.json in local database directory) --force, -f Overwrite existing file on init-settings --verbose, -v Enable verbose logging - --help, -h Show this help message + --debug, -d Enable debug logging (includes verbose) + --help, -h Show help message Commands: init-settings [path] Create settings JSON from DEFAULT_SETTINGS @@ -248,16 +250,16 @@ Commands: p2p-host Start P2P host mode and wait until interrupted (Ctrl+C) push Push local file into local database path pull Pull file from local database into local file - pull-rev Pull specific revision into local file + pull-rev Pull specific revision into local file setup Apply setup URI to settings file - put Read text from standard input and write to local database - cat Write latest file content from local database to standard output - cat-rev Write specific revision content from local database to standard output + put Read text from standard input and write to local database path + cat Write latest file content from local database to standard output + cat-rev Write specific revision content from local database to standard output ls [prefix] List files as pathsizemtimerevision[*] - info Show file metadata including current and past revisions, conflicts, and chunk list - rm Mark file as deleted in local database - resolve Resolve conflict by keeping the specified revision - mirror Mirror local file into local database. + info Show file metadata including current and past revisions, conflicts, and chunk list + rm Mark file as deleted in local database + resolve Resolve conflict by keeping the specified revision + mirror [vaultPath] Mirror database contents to the local file system (vaultPath defaults to database-path) ``` Run via npm script: diff --git a/src/apps/cli/main.ts b/src/apps/cli/main.ts index 29a6ec4..97483d5 100644 --- a/src/apps/cli/main.ts +++ b/src/apps/cli/main.ts @@ -36,14 +36,15 @@ function printHelp(): void { Self-hosted LiveSync CLI Usage: - livesync-cli [database-path] [options] [command] [command-args] + livesync-cli [options] [command-args] + livesync-cli init-settings [path] Arguments: - database-path Path to the local database directory (required) + database-path Path to the local database directory Commands: sync Run one replication cycle and exit - p2p-peers Show discovered peers as [peer] + p2p-peers Show discovered peers as [peer]\t\t p2p-sync Sync with the specified peer-id or peer-name p2p-host Start P2P host mode and wait until interrupted @@ -54,29 +55,29 @@ Commands: put Read UTF-8 content from stdin and write to local database path cat Read file from local database and write to stdout cat-rev Read file at specific revision and write to stdout - ls [prefix] List DB files as pathsizemtimerevision[*] + ls [prefix] List DB files as path\tsize\tmtime\trevision[*] info Show detailed metadata for a file (ID, revision, conflicts, chunks) rm Mark a file as deleted in local database resolve Resolve conflicts by keeping and deleting others mirror [vault-path] Mirror database contents to the local file system (vault-path defaults to database-path) Examples: - livesync-cli ./my-database sync - livesync-cli ./my-database p2p-peers 5 - livesync-cli ./my-database p2p-sync my-peer-name 15 - livesync-cli ./my-database p2p-host - livesync-cli ./my-database --settings ./custom-settings.json push ./note.md folder/note.md - livesync-cli ./my-database pull folder/note.md ./exports/note.md - livesync-cli ./my-database pull-rev folder/note.md ./exports/note.old.md 3-abcdef - livesync-cli ./my-database setup "obsidian://setuplivesync?settings=..." - echo "Hello" | livesync-cli ./my-database put notes/hello.md - livesync-cli ./my-database cat notes/hello.md - livesync-cli ./my-database cat-rev notes/hello.md 3-abcdef - livesync-cli ./my-database ls notes/ - livesync-cli ./my-database info notes/hello.md - livesync-cli ./my-database rm notes/hello.md - livesync-cli ./my-database resolve notes/hello.md 3-abcdef - livesync-cli init-settings ./data.json - livesync-cli ./my-database --verbose + livesync-cli ./my-database sync + livesync-cli ./my-database p2p-peers 5 + livesync-cli ./my-database p2p-sync my-peer-name 15 + livesync-cli ./my-database p2p-host + livesync-cli ./my-database --settings ./custom-settings.json push ./note.md folder/note.md + livesync-cli ./my-database pull folder/note.md ./exports/note.md + livesync-cli ./my-database pull-rev folder/note.md ./exports/note.old.md 3-abcdef + livesync-cli ./my-database setup "obsidian://setuplivesync?settings=..." + echo "Hello" | livesync-cli ./my-database put notes/hello.md + livesync-cli ./my-database cat notes/hello.md + livesync-cli ./my-database cat-rev notes/hello.md 3-abcdef + livesync-cli ./my-database ls notes/ + livesync-cli ./my-database info notes/hello.md + livesync-cli ./my-database rm notes/hello.md + livesync-cli ./my-database resolve notes/hello.md 3-abcdef + livesync-cli init-settings ./data.json + livesync-cli ./my-database --verbose `); }