gridcli – A command line interface to The Grid

The Grid is a command line social network that is fast, modular, and simple.

To install:

gem install gridcli

Signup

To create account (writes username/auth token to ~/.grid/config):

grid signup <username>

Profile

To show your profile:

grid profile

To update your profile:

grid profile [--github-username <username>] [--name <name>] [--avatar <avatar text file>]

If you want a profile pic, use a program like jp2a to convert a jpeg image to ascii format first.

To show someone else’s profile:

grid profile <username>

Friending

To add a friend:

grid befriend <username> [--message|-m <message>]

To list your friends:

grid friends

To list the friends of a friend:

grid friends <username>

Messaging

To send a message to a list of users:

grid message <username>[,<username>,...] [-s <subject>] [-b <body>] [-f <body file>]

If you don’t give a -b/-f option, an editor will open allowing you to type your message.

To send a status update, like, or dislike to your friends:

grid status <status message>
grid like <like message>
grid dislike <dislike message>

Updating

To update all messages / likes / dislikes / etc, run:

grid update

Searching

You can search any type (or all types) for something.

grid search <like|dislike|message|status|all> "ruby gem" [<when>]

The <when> parameter is free form text and can be a range (“x to y”). For instance:

grid search like "chronic" today
grid search like "chronic" yesterday
grid search message "chronic" "two weeks ago to today"
grid search all "the grid" "1 month ago to last week"

You can see your messages in your ~/.grid directory. For instance, if you want to search all likes using grep:

grep -RiI ~/.grid/like "grid"

Listing Posts

You can list any type (or all types) of posts.

grid list <like|dislike|message|status|all> [<when>]

The <when> parameter is free form text and can be a range (“x to y”). For instance:

grid list like today
grid list like yesterday
grid list message "two weeks ago to today"
grid list all "1 month ago to last week"

Blocking Users

To block another user:

grid block <user>

This will “unfriend” them and they will no longer see your posts.

Subgrids

Subgrids are groups that you manage and are defined in a local config file.

To create a subgrid, use:

grid subgrid @mygroup bob,john,snakeplisskin

To see what subgrids exist:

grid subgrid

To see what users are in a particular subgrid:

grid subgrid @mygroup

You can then use the group as though it were a user. For instance, to send a message to @mygroup:

grid message @mygroup -s "hey guys" -b "Let's go make a rum ham."

If you prefer to simply edit the config file, you can do so (the file is located at ~/.grid/subgrids).

Aliases

It’s possible to create command aliases much like aliases in .gitconfig. For instance, if you add a section to your ~/.grid/config file:

...
alias:
  recent: list all "yesterday to now"

Then you can now run:

grid recent

Which is the equivalent of running:

grid list all "yesterday to now"

Plugins

Plugins are easy to create and can register hooks. To install/uninstall a plugin, use:

grid plugin install <name>
grid plugin uninstall <name>

To see a list of installed plugins:

grid plugin

An example plugin is the echo plugin:

grid plugin install echo

This command will install the gem “grid-plugin-echo” and load it each time the gridcli gem is loaded. It uses the available hooks:

  • before_post_creation(post_hash)

  • before_signup(username)

  • before_update

  • after_update

and prints out a message whenever a user signs up, a post is created, or the update command is called. You can see the code for the echo module at github.com/bmuller/grid-plugin-echo.