You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[codimd-cli - The CodiMD Command Line Tool](#codimd-cli---the-codimd-command-line-tool)
10
9
*[Usage](#usage)
11
10
*[Commands](#commands)
12
11
*[Configuration](#configuration)
@@ -15,67 +14,87 @@ codimd-cli - The CodiMD Command Line Tool
15
14
## Usage
16
15
<!-- usage -->
17
16
```sh-session
18
-
$ npm install -g @hackmd/codimd-cli
19
-
$ codimd-cli COMMAND
17
+
$ npm install -g @hackmd/hackmd-cli
18
+
$ hackmd-cli COMMAND
20
19
running command...
21
-
$ codimd-cli (-v|--version|version)
22
-
@hackmd/codimd-cli/1.0.3 linux-x64 node-v8.17.0
23
-
$ codimd-cli --help [COMMAND]
20
+
$ hackmd-cli (-v|--version|version)
21
+
@hackmd/hackmd-cli/1.1.0 linux-x64 node-v12.16.2
22
+
$ hackmd-cli --help [COMMAND]
24
23
USAGE
25
-
$ codimd-cli COMMAND
24
+
$ hackmd-cli COMMAND
26
25
...
27
26
```
28
27
<!-- usagestop -->
29
28
30
29
## Configuration
31
30
32
-
`codimd-cli`support both JSON file config and environment variable config.
31
+
`hackmd-cli`operates on official HackMD instance(`hackmd.io`) by default. If you want to use cli with a self-hosted [CodiMD](https://github.com/hackmdio/codimd) or a [HackMD EE](https://hackmd.io/pricing) instance, you will need to configure `hackmd-cli` by either environment variable or JSON configuration.
33
32
34
-
The config file is located at `~/.codimd/config.json`, it should be like this:
33
+
### Example 1: Use with self-hosted CodiMD instance
|`serverUrl`|`HMD_CLI_SERVER_URL` or `CMD_CLI_SERVER_URL`|*`string`*|`https://my.codimd-domain.dev`| The instance URL |
73
+
|`cookiePath`|`HMD_CLI_COOKIE_PATH` or `CMD_CLI_COOKIE_PATH`|*`string`*|`~/.hackmd/cookies.json`| File for storing login cookie states |
74
+
|`enterprise`|_n/a_|*`boolean`*|`true`| Set whether the instance is enterise version expclitly. This config can only be set in JSON based config. When providing server url with environment variable, `enterprise` will be automatically set by checking the env prefix(`HMD` or `CMD`) |
75
+
|_n/a_|`HMD_CLI_ID` or `CMD_CLI_ID`|*`string`*|`[email protected]`| Login username/email |
76
+
|_n/a_|`HMD_CLI_PASSWORD` or `CMD_CLI_PASSWORD`|*`string`*|`dragon`| Login password |
{"version":"1.0.3","commands":{"export":{"id":"export","description":"Export note to local file","pluginName":"@hackmd/codimd-cli","pluginType":"core","aliases":[],"examples":["$ codimd-cli export [--pdf|--md|--html] <note_id> <output_file>"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"pdf":{"name":"pdf","type":"boolean","allowNo":false},"md":{"name":"md","type":"boolean","allowNo":false},"html":{"name":"html","type":"boolean","allowNo":false}},"args":[{"name":"noteId"},{"name":"output"}]},"history":{"id":"history","description":"List history","pluginName":"@hackmd/codimd-cli","pluginType":"core","aliases":[],"examples":["$ codimd-cli history\n\nID Name\nA58r8ehYTlySO94oiC_MUA Note1\nEeNHDGocSTi70ytMMGQaaQ Note2"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"columns":{"name":"columns","type":"option","description":"only show provided columns (comma-separated)"},"sort":{"name":"sort","type":"option","description":"property to sort by (prepend '-' for descending)"},"filter":{"name":"filter","type":"option","description":"filter property by partial string matching, ex: name=foo"},"csv":{"name":"csv","type":"boolean","description":"output is csv format [alias: --output=csv]","allowNo":false},"output":{"name":"output","type":"option","description":"output in a more machine friendly format","options":["csv","json","yaml"]},"extended":{"name":"extended","type":"boolean","char":"x","description":"show extra columns","allowNo":false},"no-truncate":{"name":"no-truncate","type":"boolean","description":"do not truncate output to fit screen","allowNo":false},"no-header":{"name":"no-header","type":"boolean","description":"hide table header from output","allowNo":false}},"args":[]},"import":{"id":"import","description":"Create a note from markdown file","pluginName":"@hackmd/codimd-cli","pluginType":"core","aliases":[],"examples":["$ codimd-cli import /path/to/markdown/file.md\n\nYour note is available at https://codimd.domain/note-url\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"file"}]},"login":{"id":"login","description":"Login HackMD instance from CLI","pluginName":"@hackmd/codimd-cli","pluginType":"core","aliases":[],"examples":["$ codimd-cli login\n\nEnter your email: [email protected]\nEnter your password: *******\n\nLogin as HMD successfully!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"email":{"name":"email","type":"option","char":"u","description":"Login email"}},"args":[]},"logout":{"id":"logout","description":"Logout from CLI","pluginName":"@hackmd/codimd-cli","pluginType":"core","aliases":[],"examples":["$ codimd-cli logout\n\nYou've logged out successfully\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"whoami":{"id":"whoami","description":"Show logged in account info","pluginName":"@hackmd/codimd-cli","pluginType":"core","aliases":[],"examples":["$ codimd-cli whoami\n\nYou are logged in codimd.domain as {YOUR NAME} [user-id]\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]}}}
1
+
{"version":"1.1.0","commands":{"export":{"id":"export","description":"Export note to local file or stdout(if the output_file param is omitted)","pluginName":"@hackmd/hackmd-cli","pluginType":"core","aliases":[],"examples":["$ hackmd-cli export [--pdf|--md|--html] <note_id> <output_file>"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"pdf":{"name":"pdf","type":"boolean","allowNo":false},"md":{"name":"md","type":"boolean","allowNo":false},"html":{"name":"html","type":"boolean","allowNo":false}},"args":[{"name":"noteId"},{"name":"output"}]},"history":{"id":"history","description":"List history","pluginName":"@hackmd/hackmd-cli","pluginType":"core","aliases":[],"examples":["$ hackmd-cli history\n\nID Name\nA58r8ehYTlySO94oiC_MUA Note1\nEeNHDGocSTi70ytMMGQaaQ Note2"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"columns":{"name":"columns","type":"option","description":"only show provided columns (comma-separated)"},"sort":{"name":"sort","type":"option","description":"property to sort by (prepend '-' for descending)"},"filter":{"name":"filter","type":"option","description":"filter property by partial string matching, ex: name=foo"},"csv":{"name":"csv","type":"boolean","description":"output is csv format [alias: --output=csv]","allowNo":false},"output":{"name":"output","type":"option","description":"output in a more machine friendly format","options":["csv","json","yaml"]},"extended":{"name":"extended","type":"boolean","char":"x","description":"show extra columns","allowNo":false},"no-truncate":{"name":"no-truncate","type":"boolean","description":"do not truncate output to fit screen","allowNo":false},"no-header":{"name":"no-header","type":"boolean","description":"hide table header from output","allowNo":false}},"args":[]},"import":{"id":"import","description":"Create a note from markdown file","pluginName":"@hackmd/hackmd-cli","pluginType":"core","aliases":[],"examples":["$ hackmd-cli import /path/to/markdown/file.md\n\nYour note is available at https://hackmd.io/note-url\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"file"}]},"login":{"id":"login","description":"Login to HackMD/CodiMD server from CLI","pluginName":"@hackmd/hackmd-cli","pluginType":"core","aliases":[],"examples":["$ hackmd-cli login\n\nEnter your email: [email protected]\nEnter your password: *******\n\nLogin as HMD successfully!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"id":{"name":"id","type":"option","char":"u","description":"Login email/username"},"ldap":{"name":"ldap","type":"boolean","allowNo":false}},"args":[]},"logout":{"id":"logout","description":"Logout from CLI","pluginName":"@hackmd/hackmd-cli","pluginType":"core","aliases":[],"examples":["$ hackmd-cli logout\n\nYou've logged out successfully\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"whoami":{"id":"whoami","description":"Show logged in account info","pluginName":"@hackmd/hackmd-cli","pluginType":"core","aliases":[],"examples":["$ hackmd-cli whoami\n\nYou are logged in hackmd.io as {YOUR NAME} [user-id]\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]}}}
0 commit comments