Skip to content

Instantly share code, notes, and snippets.

@jkbrzt
Last active December 20, 2015 04:29
Show Gist options
  • 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,[email protected]:myorg/app.git,rev=hash \
--repo name=myapp2,version=1.0,vcs=git,branch=master,[email protected]: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 \
[email protected]:opbeat/opbeatcli.git \
rev=hash \
--repo \
name=myapp2 \
version=1.0 \
vcs=git \
branch=master \
[email protected]: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/[email protected]
git+ssh://[email protected]/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 [email protected]:myorg/[email protected] \
   myapp2 [email protected]:myorg/[email protected]

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