Skip to content

Commit efcdad6

Browse files
committed
Update README badges and configuration
1 parent ab4f278 commit efcdad6

File tree

1 file changed

+49
-15
lines changed

1 file changed

+49
-15
lines changed

README.md

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
codimd-cli
2-
==========
1+
# codimd-cli - The CodiMD Command Line Tool
32

43
[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
5-
[![Version](https://img.shields.io/npm/v/codimd-cli.svg)](https://npmjs.org/package/@hackmd/codimd-cli)
6-
[![Downloads/week](https://img.shields.io/npm/dw/codimd-cli.svg)](https://npmjs.org/package/@hackmd/codimd-cli)
7-
[![License](https://img.shields.io/npm/l/codimd-cli.svg)](https://github.com/hackmdio/codimd-cli/blob/master/package.json)
4+
[![Version](https://img.shields.io/npm/v/@hackmd/codimd-cli.svg)](https://npmjs.org/package/@hackmd/codimd-cli)
5+
[![Downloads/week](https://img.shields.io/npm/dw/@hackmd/codimd-cli.svg)](https://npmjs.org/package/@hackmd/codimd-cli)
6+
[![License](https://img.shields.io/npm/l/@hackmd/codimd-cli.svg)](https://github.com/hackmdio/codimd-cli/blob/master/package.json)
87

98
<!-- toc -->
109
* [Usage](#usage)
1110
* [Commands](#commands)
11+
* [Configuration](#configuration)
12+
* [License](#license)
1213
<!-- tocstop -->
13-
# Usage
14+
## Usage
1415
<!-- usage -->
1516
```sh-session
1617
$ npm install -g @hackmd/codimd-cli
@@ -24,7 +25,36 @@ USAGE
2425
...
2526
```
2627
<!-- usagestop -->
27-
# Commands
28+
29+
## Configuration
30+
31+
`codimd-cli` support both JSON file config and environment variable config.
32+
33+
The config file is located at `~/.codimd/config.json`, it should be like this:
34+
35+
```json
36+
{
37+
"serverUrl": "https://my.codimd-domain.dev"
38+
}
39+
```
40+
41+
Change the serverUrl value to your hosted CodiMD instance URL.
42+
43+
You can also speicify config as environment variable. For example, append this line to your `.bashrc`:
44+
45+
```bash
46+
export CMD_CLI_SERVER_URL=my.codimd-domain.dev
47+
```
48+
49+
All available configurations are listed in the table below.
50+
51+
| Config key | Environment Variable | Data Type | Example Value | Description |
52+
| ------------ |:--------------------- | ---------- | ------------------------ | ------------------------------------ |
53+
| `serverUrl` | `CMD_CLI_SERVER_URL` | *`string`* | `https://my.codimd-domain.dev` | The CodiMD instance URL |
54+
| `cookiePath` | `CMD_CLI_COOKIE_PATH` | *`string`* | `~/.codimd/cookies.json` | File for storing login cookie states |
55+
56+
## Commands
57+
2858
<!-- commands -->
2959
* [`codimd-cli export [NOTEID] [OUTPUT]`](#codimd-cli-export-noteid-output)
3060
* [`codimd-cli help [COMMAND]`](#codimd-cli-help-command)
@@ -34,7 +64,7 @@ USAGE
3464
* [`codimd-cli logout`](#codimd-cli-logout)
3565
* [`codimd-cli whoami`](#codimd-cli-whoami)
3666

37-
## `codimd-cli export [NOTEID] [OUTPUT]`
67+
### `codimd-cli export [NOTEID] [OUTPUT]`
3868

3969
Export note to local file
4070

@@ -54,7 +84,7 @@ EXAMPLE
5484

5585
_See code: [src/commands/export.ts](https://github.com/hackmdio/codimd-cli/blob/v1.0.0/src/commands/export.ts)_
5686

57-
## `codimd-cli help [COMMAND]`
87+
### `codimd-cli help [COMMAND]`
5888

5989
display help for codimd-cli
6090

@@ -71,7 +101,7 @@ OPTIONS
71101

72102
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v2.2.3/src/commands/help.ts)_
73103

74-
## `codimd-cli history`
104+
### `codimd-cli history`
75105

76106
List history
77107

@@ -100,7 +130,7 @@ EXAMPLE
100130

101131
_See code: [src/commands/history.ts](https://github.com/hackmdio/codimd-cli/blob/v1.0.0/src/commands/history.ts)_
102132

103-
## `codimd-cli import [FILE]`
133+
### `codimd-cli import [FILE]`
104134

105135
Create a note from markdown file
106136

@@ -119,7 +149,7 @@ EXAMPLE
119149

120150
_See code: [src/commands/import.ts](https://github.com/hackmdio/codimd-cli/blob/v1.0.0/src/commands/import.ts)_
121151

122-
## `codimd-cli login`
152+
### `codimd-cli login`
123153

124154
Login HackMD instance from CLI
125155

@@ -142,7 +172,7 @@ EXAMPLE
142172

143173
_See code: [src/commands/login.ts](https://github.com/hackmdio/codimd-cli/blob/v1.0.0/src/commands/login.ts)_
144174

145-
## `codimd-cli logout`
175+
### `codimd-cli logout`
146176

147177
Logout from CLI
148178

@@ -161,7 +191,7 @@ EXAMPLE
161191

162192
_See code: [src/commands/logout.ts](https://github.com/hackmdio/codimd-cli/blob/v1.0.0/src/commands/logout.ts)_
163193

164-
## `codimd-cli whoami`
194+
### `codimd-cli whoami`
165195

166196
Show logged in account info
167197

@@ -181,7 +211,7 @@ EXAMPLE
181211
_See code: [src/commands/whoami.ts](https://github.com/hackmdio/codimd-cli/blob/v1.0.0/src/commands/whoami.ts)_
182212
<!-- commandsstop -->
183213

184-
## `codimd-cli` piping mode
214+
### `codimd-cli` piping mode
185215

186216
You can create a note by piping text stream to codimd-cli
187217

@@ -194,3 +224,7 @@ EXAMPLE
194224
195225
Your note is available at https://codimd.domain/note-url
196226
```
227+
228+
## License
229+
230+
MIT

0 commit comments

Comments
 (0)