hk

command module
v0.0.0-...-04ad16d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2014 License: MIT Imports: 41 Imported by: 0

README

hk

A fast Heroku CLI client.

Overview

hk is a command line client to the Heroku runtime platform, designed to be as fast as possible.

Disclaimer

This is beta software. It may still undergo substantial changes during the coming months. You should expect that some functionality may break or be altered without warning.

Motivation

Fast as a feature
## version

$ time heroku version >/dev/null
real	0m1.813s

$ time hk version >/dev/null
real	0m0.016s

## list

$ time heroku apps >/dev/null
real	0m3.830s

$ time hk apps >/dev/null
real	0m0.785s
Iterative Development

A release mechanism was created for hk in the beginning: the binary updates itself. This gives us confidence in iterative development, which we value highly, because it gives us the ability to release very often knowing users will see the updates in a timely manner.

The power of Go

hk demonstrates the power of the Go language, runtime, systems access, and distribution story (a single, statically linked binary with no dependencies) which are all very appealing to Heroku.

Unix

Heroku loves Unix. This client should reflect that. Commands map to their unix ancestors’ names and flags where applicable.

Installation

Please note that versions of hk installed from source are unsupported and should only be installed for development purposes.

Mac OS X, Linux, BSD

Pre-built binaries are available for Mac OS X, Linux, and BSD. Once installed, these binaries will automatically update themselves when new releases are available.

To install a pre-built binary release, run the following one-liner:

$ L=/usr/local/bin/hk && curl -sL -A "`uname -sp`" https://hk.heroku.com/hk.gz | zcat >$L && chmod +x $L

The URL https://hk.heroku.com/hk.gz will attempt to detect your OS and CPU architecture based on the User-Agent, then redirect you to the latest release for your platform.

Windows

Currently, you need to have a Go development environment to install hk on Windows. Compiled binaries with automatic updating are available for Windows, but the installer is not ready yet.

$ go get github.com/heroku/hk

Please note that this installation method is unsupported.

Usage

The basic usage of hk is:

Usage: hk <command> [-a app] [options] [arguments]

For more details, and to learn about differences between hk and the Heroku Ruby CLI, please see the getting started guide.

Shell Completion

Shell completion scripts for hk have been written for zsh and bash. Both files are located in ./contrib.

The zsh completion script completes all command names and help topics. It also completes flags and other arguments for many commands:

The bash completion script completes only command names at this time.

Config

hk allows some configuration using git config.

Use strict flag ordering / disable interspersed flags and non-flag arguments

Enable:

$ git config --global --bool hk.strict-flag-ordering true

Disable:

$ git config --global --unset hk.strict-flag-ordering

Plugins

hk currently has a minimal plugin system. It may see substantial changes in the future, and those changes may break existing plugins or change the architecture at any time. Use this functionality at your own risk.

Plugins are executables located in HKPATH or, if HKPATH does not exist, in /usr/local/lib/hk/plugin. They are executed when hk does not know command X and an installed plugin X exists. The special case default plugin will be executed if hk has no command or installed plugin named X.

hk will set these environment variables for a plugin:

  • HEROKU_API_URL - The url containing the username, password, and host to the api endpoint.
  • HKAPP - The app as determined by the git heroku remote, if available.
  • HKUSER - The username from either HEROKU_API_URL or .netrc
  • HKPASS - The password from either HEROKU_API_URL or .netrc
  • HKHOST - The hostname for the API endpoint

Development

hk requires Go 1.2 or later and uses Godep to manage dependencies.

$ cd hk
$ vim main.go
$ godep go build
$ ./hk apps

Please follow the contribution guidelines before submitting a pull request.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Godeps
_workspace/src/bitbucket.org/kardianos/osext
Extensions to the standard "os" package.
Extensions to the standard "os" package.
_workspace/src/code.google.com/p/go-uuid/uuid
The uuid package generates and inspects UUIDs.
The uuid package generates and inspects UUIDs.
_workspace/src/github.com/bgentry/heroku-go
Package heroku is a client interface to the Heroku API.
Package heroku is a client interface to the Heroku API.
_workspace/src/github.com/bgentry/pflag
pflag is a drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.
pflag is a drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.
_workspace/src/github.com/bgentry/testnet
This package provides helpers for testing interactions with an HTTP API in the Go (#golang) programming language.
This package provides helpers for testing interactions with an HTTP API in the Go (#golang) programming language.
_workspace/src/github.com/gorilla/context
Package gorilla/context stores values shared during a request lifetime.
Package gorilla/context stores values shared during a request lifetime.
_workspace/src/github.com/gorilla/mux
Package gorilla/mux implements a request router and dispatcher.
Package gorilla/mux implements a request router and dispatcher.
_workspace/src/github.com/inconshreveable/go-update
Package update allows a program to "self-update", replacing its executable file with new bytes.
Package update allows a program to "self-update", replacing its executable file with new bytes.
_workspace/src/github.com/kr/binarydist
Package binarydist implements binary diff and patch as described on http://www.daemonology.net/bsdiff/.
Package binarydist implements binary diff and patch as described on http://www.daemonology.net/bsdiff/.
_workspace/src/github.com/kr/s3
Package s3 signs HTTP requests for Amazon S3 and compatible services.
Package s3 signs HTTP requests for Amazon S3 and compatible services.
_workspace/src/github.com/kr/s3/s3cp
Command s3cp copies a file to or from Amazon S3.
Command s3cp copies a file to or from Amazon S3.
_workspace/src/github.com/kr/s3/s3util
Package s3util provides streaming transfers to and from Amazon S3.
Package s3util provides streaming transfers to and from Amazon S3.
_workspace/src/github.com/kr/secureheader
Package secureheader adds some HTTP header fields widely considered to improve safety of HTTP requests.
Package secureheader adds some HTTP header fields widely considered to improve safety of HTTP requests.
_workspace/src/github.com/mgutz/ansi
Small, fast library to create ANSI colored strings and codes.
Small, fast library to create ANSI colored strings and codes.
Command hkdist provides services for distributing hk binaries and updates.
Command hkdist provides services for distributing hk binaries and updates.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL