Skip to content

Instantly share code, notes, and snippets.

@jkbrzt
Last active December 20, 2015 04:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkbrzt/6070786 to your computer and use it in GitHub Desktop.
Save jkbrzt/6070786 to your computer and use it in GitHub Desktop.
Opbeat CLI syntax survey
#
# Opbeat is looking for the best CLI syntax for the `opbeat'
# command that sends deployment info to the Opbeat API.
#
# Users should be able to specify repositories that the app being deployed
# consists of and their attributes.
#
# The attributes are "name", "version", "vcs", "rev", "branch", "remote_url".
#
# We are considering these syntaxes:
#
### 1. --repo takes one argument, a string of comma-separated key=value pairs:
$ opbeat deployment \
--repo name=myapp,version=1.0,vcs=git,branch=master,remote_url=git@github.com:myorg/app.git,rev=hash \
--repo name=myapp2,version=1.0,vcs=git,branch=master,remote_url=git@github.com:myorg/app2.git,rev=hash
### 2. --repo takes multiple arguments, each is a key=value pair.
$ opbeat deployment \
--repo \
name=myapp \
version=1.0 \
vcs=git \
branch=master \
remote_url=git@github.com:opbeat/opbeatcli.git \
rev=hash \
--repo \
name=myapp2 \
version=1.0 \
vcs=git \
branch=master \
remote_url=git@github.com:myorg/app2.git \
rev=hash
#
# Please let us know what you think. Thanks!
#
@keleshev
Copy link

You could make it shorter by borrowing the syntax from pip:

git://git.myproject.org/MyProject.git@master
git+http://git.myproject.org/MyProject@v1.0
git+ssh://git@myproject.org/MyProject.git@da39a3ee5e6b

This includes vcs, version/branch/hash and remote-url.

@keleshev
Copy link

Then, I would probably implement it as:

Usage: opbeat deployment (<name> <url>)...

Arguments:
  <name>  Repository name.
  <url>   Pip-style URL.

And use it as:

$ opbeat deployment \   
   myapp git@github.com:myorg/app.git@v1.0 \
   myapp2 git@github.com:myorg/app2.git@v1.0

Assuming versions are tags.

@jkbrzt
Copy link
Author

jkbrzt commented Jul 24, 2013

It's a good suggestion but we need it to be extensible (more fields can be added in the future).

@dideler
Copy link

dideler commented Aug 1, 2013

#1 is easier to type, but #2 is easier to read. I prefer #2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment