Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
* Introduction section.
* Improve installation instructions.
* CI section.
  • Loading branch information
WillJCJ committed Jul 14, 2018
1 parent 1fc7acb commit 1794bd2
Showing 1 changed file with 92 additions and 36 deletions.
128 changes: 92 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,56 @@

[![Build Status](https://travis-ci.com/WillJCJ/param.svg?branch=master)](https://travis-ci.com/WillJCJ/param)

A cli tool for talking to AWS Parameter Store. Copy parameters directly to your clipboard.

- [Introduction](#introduction)
- [Install](#install)
- [Usage](#usage)
- [Shell Completion](#shell-completion)
- [Docs](#docs)
- [Todo](#todo)

## Introduction

A cli tool for talking to AWS Parameter Store. Copy parameters directly to your clipboard.

`param` uses [Cobra](https://github.com/spf13/cobra), a library providing a simple
interface to create powerful CLI interfaces similar to git & go tools.

`param` works with Linux and MacOS. It also supports `bash` and `zsh` completion.

## Install

go get github.com/willjcj/param
You can install `param` by downloading the latest binary from the [Releases](https://github.com/WillJCJ/param/releases)
page or by compiling from source with `go`.

```console
go get github.com/willjcj/param
```

This should build a binary at `$GOPATH/bin/param`

Add `$GOPATH/bin` to your `PATH`, or move param to somewhere
already on your `PATH`.

### Curl

Run the below command to download the 1.3.0 binary and add it to `/usr/local/bin`.

#### Linux

```console
curl -LO https://github.com/WillJCJ/param/releases/download/1.3.0/param-linux-amd64 && \
chmod +x param-linux-amd64 && \
sudo mv param-linux-amd64 /usr/local/bin/param
```

#### MacOS

```console
curl -LO https://github.com/WillJCJ/param/releases/download/1.3.0/param-darwin-amd64 && \
chmod +x param-darwin-amd64 && \
sudo mv param-darwin-amd64 /usr/local/bin/param
```

## Usage

Make sure your terminal session has the correct AWS credentials.
Expand All @@ -27,35 +60,42 @@ Make sure your terminal session has the correct AWS credentials.

Copy a parameter to your clipboard:

$ param copy parameter_name
```console
$ param copy parameter_name
```

You can optionally show the parameter value in your console with the `-v` flag:

$ param copy parameter_name -v
password123
```console
$ param copy parameter_name -v
password123
```

### List

Get a sorted list of parameters in SSM with optional prefix(es):

$ param list
parameter.name.key
parameter2.name.password
...
```console
$ param list
parameter.name.key
parameter2.name.password
...
```

$ param list -p prefix1,prefix2
prefix1.dev.password
prefix1.prod.password
prefix2.key
```console
$ param list -p prefix1,prefix2
prefix1.dev.password
prefix1.prod.password
prefix2.key
```

## Shell Completion

`param completion` outputs shell completion code for the specified shell (`bash` or `zsh`).
`param completion (bash|zsh)` outputs shell completion code for the specified shell (`bash` or `zsh`).
The shell code must be evaluated to provide interactive completion of
param commands.
This can be done by sourcing it from `~/.bashrc` or `~/.zshrc`


### Installation

#### bash
Expand All @@ -64,27 +104,33 @@ Source the bash completion script every time you start a shell
by adding a line to your `~/.bashrc` file:

```bash
printf "
# param shell completion
source <(param completion bash)
" >> $HOME/.bashrc
source $HOME/.bashrc
source <(param completion bash)
```

You can also run this command to append it for you:

```console
printf "
# param shell completion
source <(param completion bash)
" >> $HOME/.bashrc
source $HOME/.bashrc
```

### Caching

Because the call to SSM can be quite slow, `param copy` caches the list of
parameter names by exporting an array named `PARAM_CACHE`.

You can clear the cache by unsetting the cache variable:
You can clear the cache by unsetting the cache array:
```bash
unset PARAM_CACHE
unset PARAM_CACHE
```

You can stop caching entirely by setting the `PARAM_NO_CACHE` variable:
You can stop caching entirely by setting the `PARAM_NO_CACHE` variable to `1`:

```bash
export PARAM_NO_CACHE=1
export PARAM_NO_CACHE=1
```

## Docs
Expand All @@ -93,16 +139,26 @@ Docs for each command can be found at [`/docs`](docs/param.md)

They are automatically generated by Cobra.

## CI

`param` uses Travis CI to test each commit. It also handles GitHub releases when
a new tag is pushed to GitHub.

## TODO

- Set command - Command to set parameters
- Delete command - Command to delete parameters
- Show command - Like `copy -v` without copying to clipboard
- `param copy` bash completion populated from `param list`
- Common SSM service instead of duplicated in all commands.
- Write tests!
- Write about how to set up AWS variables/profile.
- Add a flag to specify parameter type. Currently only works with `SecureString`s.
- `zsh` completion doesn't seem to work.
- Update or delete the bash completion cache after creating/deleting parameters
- Add bash completion for other subcommands and flags.
- New Commands
- Set command - Command to set parameters
- Delete command - Command to delete parameters
- Show command - Like `copy -v` without copying to clipboard
- Improvements
- Add a flag to specify parameter type. Currently only works with `SecureString`s.
- Shell Completion
- `zsh` completion doesn't seem to work.
- Update or delete the bash completion cache after creating/deleting parameters
- Add bash completion for other subcommands and flags.
- Write Tests
- Improve Documentation
- More Examples
- Write about how to set up AWS variables/profile.
- Refactor
- Common SSM service instead of duplicated in all commands.

0 comments on commit 1794bd2

Please sign in to comment.