Appearance
Interactive console
hailer-cli starts a Node.js REPL connected to Hailer. On login it fetches the list of available endpoints from the server and exposes them as the api object.
bash
hailer-cli --user you@example.comIf --password is omitted you are prompted for it.
Arguments
| Argument | Description |
|---|---|
--user | Email address used to log in |
--password | Password. Omit to be prompted |
--host | Backend server. Defaults to the HOST environment variable, then https://api.hailer.com |
--quiet | Suppress the login status line |
--insecure | Skip SSL certificate verification |
--help, -h | Show help and exit |
The REPL environment
The prompt is a JavaScript REPL. These variables are available:
| Variable | Description |
|---|---|
api | All endpoints as async functions, e.g. api.wall2.new_post(...), api.v3.activity.create(...) |
result | Result of the last call |
history | All results as an array, newest first |
error | Last error |
upload(path) | Upload a local file, returns the file id |
cli | The underlying Client instance |
help() | Print usage and the full endpoint tree |
The response of v2.core.init is also merged into the context, so state such as users, networks, and processes is available directly.
Tab completion works on the api tree. Typing a method without calling it prints its signature and documentation.
Examples
Create a wall post, then remove it using result:
javascript
await api.wall2.new_post({ subject: 'This is a wall post.', text: 'Made from the CLI.' })
await api.wall2.remove_post(result._id)Upload a file and attach it to a post:
javascript
fileId = await upload('myfile.jpg')
await api.wall2.new_post({ subject: 'With attachment', text: 'File included.', files: [fileId] })Live signals
The console prints signals from Hailer as they happen: new wall posts, comments, created activities, and discussion syncs are formatted; other signals are printed with their name and metadata.