Categorygithub.com/talbright/cli
modulepackage
5.10.3+incompatible
Repository: https://github.com/talbright/cli.git
Documentation: pkg.go.dev

# README

Heroku CLI

Heroku logo

Circle CI Build status MIT License Go Report Card codebeat badge

The Heroku CLI is used to manage Heroku apps from the command line.

For more about Heroku see https://www.heroku.com/home

To get started see https://devcenter.heroku.com/start

Overview

This is the next generation Go/Node-based Heroku CLI. The goals of this project were to make plugins more flexible, remove Ruby as a runtime dependency, and make the CLI faster.

It has identical functionality to the old Ruby CLI. Under the hood, it is a modular CLI made up of node.js plugins.

For more on developing plugins, read Developing CLI Plugins

Issues

For problems directly related to the CLI, add an issue on GitHub.

For other issues, submit a support ticket.

Contributors

Developing

Developing the CLI locally requires go and node.

To run the CLI locally, use the ./bin/run script. If you want to install the dev version of the CLI, run make install.

# Functions

AllCommands gets all go/core/user commands.
AllTopics gets all go/core/user topics.
BuildContext builds a context object based on a command and args.
CommandUsage generates the usage for a command.
Debugf is used to print debugging information It will be added to the logfile in ~/.cache/heroku/error.log and stderr if HEROKU_DEBUG is set.
Debugln is used to print debugging information It will be added to the logfile in ~/.cache/heroku/error.log and stderr if HEROKU_DEBUG is set.
DownloadCLI downloads a CLI update to a given path.
Err just calls `fmt.Fprint(Stderr, a...)` but can be mocked out for testing.
Errf just calls `fmt.Fprintf(Stderr, a...)` but can be mocked out for testing.
Errln just calls `fmt.Fprintln(Stderr, a...)` but can be mocked out for testing.
Error shows a message with excalamation points prepended to stderr.
Exit just calls os.Exit, but can be mocked out for testing.
ExitWithMessage shows an error message then exits with status code 2 It does not emit to rollbar.
FileExists returns whether or not path exists.
GetUpdateManifest loads the manifest.json for a channel.
IsUpdateNeeded checks if an update is available.
Log is used to print debugging information It will be added to the logfile in ~/.cache/heroku/error.log or printed out if HEROKU_DEBUG is set.
Logf is used to print debugging information It will be added to the logfile in ~/.cache/heroku/error.log.
LogIfError logs out an error if one arises.
Logln is used to print debugging information It will be added to the logfile in ~/.cache/heroku/error.log.
ParseFlag parses a flag from argument inputs.
Print is used to replace `fmt.Print()` but can be mocked out for testing.
Printf is used to replace `fmt.Printf()` but can be mocked out for testing.
Println is used to replace `fmt.Println()` but can be mocked out for testing.
RubyPlugins lists all the ruby plugins.
ShowCursor displays the cursor.
ShowDebugInfo prints debugging information if HEROKU_DEBUG=1.
ShowVersion shows the version and exits.
Start the CLI.
SubmitAnalytics sends the analytics info to the analytics service.
TriggerBackgroundUpdate will trigger an update to the client in the background.
Update updates the CLI and plugins.
Warn shows a message with excalamation points prepended to stderr.
WarnIfError is a helper that prints out formatted error messages it will emit to rollbar it does not exit.

# Constants

HELP is "help".
ONE is the string 1.
WINDOWS is "windows".

# Variables

AppDir is the subdirectory the binary is running from.
AppFlag is --app.
Args is os.Args.
Autoupdate is a flag to enable/disable CLI autoupdating.
BinPath is the running executable.
CacheHome is XDG_CACHE_HOME/heroku or equivalent.
Channel is the git branch the code was compiled on.
CLITopics are all the command topics This list is all the Go topics, the Node topics are filled in later.
ConfigHome is XDG_CONFIG_HOME/heroku or equivalent.
CorePlugins are built in plugins.
DataHome is XDG_CONFIG_HOME/heroku or equivalent.
Debugging is HEROKU_DEBUG.
DebuggingHeaders is HEROKU_DEBUG_HEADERS.
ErrLogPath is the location of the error log.
ErrorArrow is the triangle or bang that prefixes errors.
ExitFn is used to mock os.Exit.
GitSHA is the git sha of the build This is set by a build flag in the `Rakefile`.
HomeDir is the user's home directory.
NpmRegistry is the npm registry to use.
OrgFlag is --org.
RemoteFlag is --remote for --app.
Stderr is to mock stderr for testing.
Stdout is used to mock stdout for testing.
UpdateLockPath is the path to the updating lock file.
UserPlugins are user-installable plugins.
Version is the version of the cli.

# Structs

AnalyticsCommand represents an analytics command.
APIRequest is for requests to api.heroku.com.
Arg defines an argument for a command.
Build is a part of a Manifest.
Command represents a CLI command.
Config interacts with the config.json.
Context is a struct that is passed to a Command's Run function.
Flag defines a flag for a command.
Guess is used with `heroku _`.
Manifest is the manifest.json for releases.
NpmPackage represents an npm package.
Plugin represents a javascript plugin.
Plugins represents either core or user plugins.
Topic represents a CLI topic.

# Type aliases

Commands is a slice of Command structs with some helper methods.
Flags are a list of flags.
Topics are a list of topics.