@hackmd/codimd-cli
v1.0.3
Published
codimd-cli - The CodiMD Command Line Tool ===
Downloads
11
Readme
codimd-cli - The CodiMD Command Line Tool
Usage
$ npm install -g @hackmd/codimd-cli
$ codimd-cli COMMAND
running command...
$ codimd-cli (-v|--version|version)
@hackmd/codimd-cli/1.0.3 linux-x64 node-v8.17.0
$ codimd-cli --help [COMMAND]
USAGE
$ codimd-cli COMMAND
...
Configuration
codimd-cli
support both JSON file config and environment variable config.
The config file is located at ~/.codimd/config.json
, it should be like this:
{
"serverUrl": "https://my.codimd-domain.dev"
}
Change the serverUrl value to your hosted CodiMD instance URL.
You can also speicify config as environment variable. For example, append this line to your .bashrc
:
export CMD_CLI_SERVER_URL=https://my.codimd-domain.dev
All available configurations are listed in the table below.
| Config key | Environment Variable | Data Type | Example Value | Description |
| ------------ |:--------------------- | ---------- | ------------------------------ | ------------------------------------ |
| serverUrl
| CMD_CLI_SERVER_URL
| string
| https://my.codimd-domain.dev
| The CodiMD instance URL |
| cookiePath
| CMD_CLI_COOKIE_PATH
| string
| ~/.codimd/cookies.json
| File for storing login cookie states |
Commands
codimd-cli export [NOTEID] [OUTPUT]
codimd-cli help [COMMAND]
codimd-cli history
codimd-cli import [FILE]
codimd-cli login
codimd-cli logout
codimd-cli whoami
codimd-cli export [NOTEID] [OUTPUT]
Export note to local file
USAGE
$ codimd-cli export [NOTEID] [OUTPUT]
OPTIONS
-h, --help show CLI help
--html
--md
--pdf
EXAMPLE
$ codimd-cli export [--pdf|--md|--html] <note_id> <output_file>
See code: src/commands/export.ts
codimd-cli help [COMMAND]
display help for codimd-cli
USAGE
$ codimd-cli help [COMMAND]
ARGUMENTS
COMMAND command to show help for
OPTIONS
--all see all commands in CLI
See code: @oclif/plugin-help
codimd-cli history
List history
USAGE
$ codimd-cli history
OPTIONS
-h, --help show CLI help
-x, --extended show extra columns
--columns=columns only show provided columns (comma-separated)
--csv output is csv format [alias: --output=csv]
--filter=filter filter property by partial string matching, ex: name=foo
--no-header hide table header from output
--no-truncate do not truncate output to fit screen
--output=csv|json|yaml output in a more machine friendly format
--sort=sort property to sort by (prepend '-' for descending)
EXAMPLE
$ codimd-cli history
ID Name
A58r8ehYTlySO94oiC_MUA Note1
EeNHDGocSTi70ytMMGQaaQ Note2
See code: src/commands/history.ts
codimd-cli import [FILE]
Create a note from markdown file
USAGE
$ codimd-cli import [FILE]
OPTIONS
-h, --help show CLI help
EXAMPLE
$ codimd-cli import /path/to/markdown/file.md
Your note is available at https://codimd.domain/note-url
See code: src/commands/import.ts
codimd-cli login
Login HackMD instance from CLI
USAGE
$ codimd-cli login
OPTIONS
-h, --help show CLI help
-u, --email=email Login email
EXAMPLE
$ codimd-cli login
Enter your email: [email protected]
Enter your password: *******
Login as HMD successfully!
See code: src/commands/login.ts
codimd-cli logout
Logout from CLI
USAGE
$ codimd-cli logout
OPTIONS
-h, --help show CLI help
EXAMPLE
$ codimd-cli logout
You've logged out successfully
See code: src/commands/logout.ts
codimd-cli whoami
Show logged in account info
USAGE
$ codimd-cli whoami
OPTIONS
-h, --help show CLI help
EXAMPLE
$ codimd-cli whoami
You are logged in codimd.domain as {YOUR NAME} [user-id]
See code: src/commands/whoami.ts
codimd-cli
piping mode
You can create a note by piping text stream to codimd-cli
USAGE
$ codimd-cli [COMMAND]
EXAMPLE
$ cat README.md | codimd-cli
Your note is available at https://codimd.domain/note-url
License
MIT