Skip to content

Understanding the CLI

Evan Tann edited this page Jul 21, 2016 · 8 revisions

The Abot CLI (Command Line Interface) helps you quickly perform common tasks, whether you're starting a new Abot project, building and publishing a plugin, or updating installed dependencies. It's heavily influenced by the CLIs from rails and npm to be immediately familiar to those developers.

Commands

abot new {name}

Creates a new Abot project at the specified directory. This can be anywhere in your $GOPATH.

$ abot new mybot
Success. Created mybot

abot server

Compiles and runs your Abot project according to the preferences stored in the project directory's abot.env.

$ abot server
$ ABOT_DEBUG=true PORT=3000 abot server

abot install

Installs plugins in your plugins.json file. This must be run from the directory containing the plugins.json file.

$ abot install
Fetching 4 plugins...
Installing 4 plugins...
Success!

abot search {plugin}

Searches for a plugin by name. The search term must be at least 3 letters long. abot search supports fuzzy matches.

$ abot search weather
NAME    DESCRIPTION                     DOWNLOADS
Weather Get weather reports for cit...  563

abot update

Updates plugins contained in plugins.json.

$ abot update
Updating plugins...
Success!

TODO: Add support for updating private repos

abot generate {name}

Generates plugin scaffolding containing everything you need to get started in developing your own plugins.

$ abot generate weather
Created weather in ~/go/src/github.com/yourname/weather

abot test

Tests all of the plugins installed to your current Abot project using the tests found in each of their plugin.json (which are inlined into the project's plugins.go on abot install).

$ abot test
expected [demo], got "I'm not sure I understand you." for "Show me a demo"
$ abot test
OK

TODO: Ensure that plugins.json's dependencies match plugins.go's when running

abot publish {go-get-path}

Publishes a plugin to https://www.itsabot.org/plugins. If the plugin runs and its tests pass, it will be indexed and searchable via the CLI or directly via itsabot.org.

$ abot publish github.com/itsabot/plugin_weather
Email: evan@example.com
Password:
> Establishing connection with server...
> Fetching plugin...
OK
> Testing plugin...
OK
Successfully published plugin at https://www.itsabot.org/plugins/105021

TODO: Guide on publishing a plugin

abot login

Logs into https://www.itsabot.org with your email and password, caching access tokens in ~/.abot.conf to prevent needing to login repeatedly. You probably won't need to run this command, as anything that requires you to be logged in (such as publishing plugins) will ask directly.

$ abot login
Email: evan@example.com
Password:
Success!

abot console {url} {phone-number}

Starts the Abot console to communicate with Abot. The URL and phone number are optional, defaulting to http://localhost:$PORT and +15555551234. If you do provide a phone number, it must begin with a leading +.

$ abot console
> What's the weather outside?
It's 78 and sunny today.
$ abot console https://www.example.com +15553335555
> Hi
Hi there. :)

abot dbconsole

Connects to the database console for the project.

$ abot dbconsole
yourproject=> SELECT * FROM users;