From 4804f98e46fe10744b1632841e60302926a0a24a Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Wed, 24 Apr 2024 12:42:51 +0100 Subject: [PATCH] docs: Update the CLI docs to reference the published NPM package --- docs/docs/09-command-line.md | 93 ++++++++++++++++++++++++++++++++++-- docs/docs/10-import.md | 4 +- 2 files changed, 90 insertions(+), 7 deletions(-) diff --git a/docs/docs/09-command-line.md b/docs/docs/09-command-line.md index 8c568adb..d72f5487 100644 --- a/docs/docs/09-command-line.md +++ b/docs/docs/09-command-line.md @@ -1,26 +1,109 @@ # Command Line Tool (CLI) -Hoarder comes with a simple CLI for those users who want to do more advanced manipulation. Currently, the CLI comes packaged as a docker container. You can run it with: +Hoarder comes with a simple CLI for those users who want to do more advanced manipulation. + +## Features + +- Manipulate bookmarks, lists and tags +- Mass import/export of bookmarks + +## Installation (NPM) + +``` +npm install -g @hoarderapp/cli +``` + + +## Installation (Docker) ``` docker run --rm ghcr.io/mohamedbassem/hoarder-cli:release --help ``` +## Usage + +``` +hoarder +``` + +``` +Usage: hoarder [options] [command] + +A CLI interface to interact with the hoarder api + +Options: + --api-key the API key to interact with the API (env: HOARDER_API_KEY) + --server-addr the address of the server to connect to (env: HOARDER_SERVER_ADDR) + -V, --version output the version number + -h, --help display help for command + +Commands: + bookmarks manipulating bookmarks + lists manipulating lists + tags manipulating tags + whoami returns info about the owner of this API key + help [command] display help for command +``` + +And some of the subcommands: + +``` +hoarder bookmarks +``` + +``` +Usage: hoarder bookmarks [options] [command] + +Manipulating bookmarks + +Options: + -h, --help display help for command + +Commands: + add [options] creates a new bookmark + get fetch information about a bookmark + update [options] updates bookmark + list [options] list all bookmarks + delete delete a bookmark + help [command] display help for command + +``` + +``` +hoarder lists +``` + +``` +Usage: hoarder lists [options] [command] + +Manipulating lists + +Options: + -h, --help display help for command + +Commands: + list lists all lists + delete deletes a list + add-bookmark [options] add a bookmark to list + remove-bookmark [options] remove a bookmark from list + help [command] display help for command +``` + +## Optaining an API Key + To use the CLI, you'll need to get an API key from your hoarder settings. You can validate that it's working by running: ``` -docker run --rm ghcr.io/mohamedbassem/hoarder-cli:release --api-key --server-addr whoami +hoarder --api-key --server-addr whoami ``` For example: ``` -docker run --rm ghcr.io/mohamedbassem/hoarder-cli:release --api-key mysupersecretkey --server-addr https://try.hoarder.app whoami +hoarder --api-key mysupersecretkey --server-addr https://try.hoarder.app whoami { id: 'j29gnbzxxd01q74j2lu88tnb', name: 'Test User', email: 'test@gmail.com' } ``` - -Check the help for the other available commands, but the main usecase for the CLI is to enable mass manipulation of your bookmarks. E.g. mass importing of bookmarks, mass deletions, etc. diff --git a/docs/docs/10-import.md b/docs/docs/10-import.md index 0de0c282..f0e6ee35 100644 --- a/docs/docs/10-import.md +++ b/docs/docs/10-import.md @@ -16,7 +16,7 @@ Currently importing bookmarks requires some technical knowledge and might not be Run the following command to import all the links from `all_links.txt`: ``` -cat all_links.txt | xargs -I{} docker run --rm ghcr.io/mohamedbassem/hoarder-cli:release --api-key --server-addr bookmarks add --link {} +cat all_links.txt | xargs -I{} hoarder --api-key --server-addr bookmarks add --link {} ``` ## Import from other platforms @@ -24,5 +24,5 @@ cat all_links.txt | xargs -I{} docker run --rm ghcr.io/mohamedbassem/hoarder-cli If you can get your bookmarks in a text file with one link per line, you can use the following command to import them using the [hoarder cli](https://docs.hoarder.app/command-line): ``` -cat all_links.txt | xargs -I{} docker run --rm ghcr.io/mohamedbassem/hoarder-cli:release --api-key --server-addr bookmarks add --link {} +cat all_links.txt | xargs -I{} hoarder --api-key --server-addr bookmarks add --link {} ```