Skip to content

Commit 720e0bf

Browse files
James TsaiJames Tsai
authored andcommitted
Update README with accessToken-based login and logout commands
1 parent f516a92 commit 720e0bf

File tree

1 file changed

+50
-15
lines changed

1 file changed

+50
-15
lines changed

README.md

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,14 @@ USAGE
3434
### Set access token
3535
Access token should be set before using `hackmd-cli`. It can be created by landing [hackmd.io](https://hackmd.io) -> Setting -> API -> Create API token. Copy the token and set it as config variable.
3636
#### Example:
37-
Set environment variable in your shell profile:
37+
38+
Set environment variable by command:
39+
```sh-session
40+
$ hackmd-cli login
41+
Enter your accesstoken: My_ACCESS_TOKEN
42+
```
43+
44+
Or in your shell profile:
3845
```bash
3946
export HMD_API_ACCESS_TOKEN=MY_ACCESS_TOKEN
4047
```
@@ -79,6 +86,8 @@ All available configurations are listed in the table below.
7986
<!-- commands -->
8087
* [`hackmd-cli help [COMMAND]`](#hackmd-cli-help-command)
8188
* [`hackmd-cli history`](#hackmd-cli-history)
89+
* [`hackmd-cli login`](#hackmd-cli-login)
90+
* [`hackmd-cli logout`](#hackmd-cli-logout)
8291
* [`hackmd-cli notes`](#hackmd-cli-notes)
8392
* [`hackmd-cli notes:create`](#hackmd-cli-notescreate)
8493
* [`hackmd-cli notes:delete`](#hackmd-cli-notesdelete)
@@ -137,6 +146,46 @@ EXAMPLE
137146

138147
_See code: [src/commands/history.ts](https://github.com/hackmdio/hackmd-cli/blob/v2.0.0/src/commands/history.ts)_
139148

149+
## `hackmd-cli login`
150+
151+
Login to HackMD server from CLI
152+
153+
```
154+
USAGE
155+
$ hackmd-cli login
156+
157+
OPTIONS
158+
-h, --help Show CLI help.
159+
160+
EXAMPLE
161+
$ hackmd-cli login
162+
163+
Enter your access token: MY_ACCESS_TOKEN
164+
165+
Login successfully
166+
```
167+
168+
_See code: [src/commands/login.ts](https://github.com/hackmdio/hackmd-cli/blob/v2.0.0/src/commands/login.ts)_
169+
170+
## `hackmd-cli logout`
171+
172+
Login to HackMD server from CLI
173+
174+
```
175+
USAGE
176+
$ hackmd-cli logout
177+
178+
OPTIONS
179+
-h, --help Show CLI help.
180+
181+
EXAMPLE
182+
$ hackmd-cli logout
183+
184+
You've logged out successfully
185+
```
186+
187+
_See code: [src/commands/logout.ts](https://github.com/hackmdio/hackmd-cli/blob/v2.0.0/src/commands/logout.ts)_
188+
140189
## `hackmd-cli notes`
141190

142191
HackMD notes commands
@@ -410,20 +459,6 @@ EXAMPLE
410459
_See code: [src/commands/whoami.ts](https://github.com/hackmdio/hackmd-cli/blob/v2.0.0/src/commands/whoami.ts)_
411460
<!-- commandsstop -->
412461

413-
## `hackmd-cli` piping mode
414-
415-
You can create a note by piping text stream to hackmd-cli
416-
417-
```
418-
USAGE
419-
$ hackmd-cli [COMMAND]
420-
421-
EXAMPLE
422-
$ cat README.md | hackmd-cli
423-
424-
Your note is available at https://hackmd.io/note-url
425-
```
426-
427462
## License
428463

429464
MIT

0 commit comments

Comments
 (0)