Skip to content

Commit

Permalink
Init code.
Browse files Browse the repository at this point in the history
  • Loading branch information
pyrooka committed Apr 28, 2019
1 parent cfacc6c commit 5a021fe
Show file tree
Hide file tree
Showing 8 changed files with 1,143 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# envman
Envman (environment variable manager) is a simple tool which stores your environment variables so you can easily load them when you want to continue your work.

## Usage
```
envman [global options] command [command options] [arguments...]
COMMANDS:
list, ls List the environments or variables in the environment
load, l Load and environment to the current one
save, s Save environment variables to an environment
remove, rm Remove a full environment or just a variable
cleanup Cleanup the backend, delete all the created files
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--backend value, -b value Use and set a different backend as default
--help, -h show help
--version, -v print the version
```

## Sample commands
`envman ls`
`envman ls ENV_NAME`
`envman save ENV_NAME VAR_1 VAR_2`
`envman load ENV_NAME`
`envman rm ENV_NAME`
`envman rm ENV_NAME VAR_1`

## Backend development
- Implement the Backend interface.
- If want to use config for your backend add it to the Config struct.
- In the main package declare it in backend parsing.

## TODO
- Autocomplete
- Security: E.g. AES encrypt any text which is uploaded.
- Display better error messages?
- Option to rename env?
### Backends
#### GitHub Gist
- Refactor (GraphQL?)
15 changes: 15 additions & 0 deletions backend/backend.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package backend

import (
"github.com/pyrooka/envman/config"
)

// IBackend is an interface what show what should implement if you want to create a new storage service.
type IBackend interface {
Init(c *config.Config) (err error) // Initialize the backend.
List(envName string) ([]string, error) // Returns a list with the variables in the env or the environments in the backend if the name is empty string.
Get(envName string) (vars map[string]string, err error) // Gets the variables for the environment.
Update(envName string, vars map[string]string) (err error) // Updates variables in the environment.
Delete(envName string, vars []string) (err error) // Deletes the given variables or the full environment if an empty slice given.
CleanUp() (err error) // Removes all the created things.
}
Loading

0 comments on commit 5a021fe

Please sign in to comment.