Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pepabo/facade

A utility that provides git-like sub command feature with one line of code
https://github.com/pepabo/facade

Last synced: about 1 month ago
JSON representation

A utility that provides git-like sub command feature with one line of code

Awesome Lists containing this project

README

        

# façade

This library adds a git-like sub command feature into your command.

## Usage

Just call `facade.Run()` in your main file like below:

```go
package main

import (
"github.com/pepabo/facade"
)

func main() {
f := &facade.Facade{}

// If `Env` set, the key-values will be injected into the environment
// variables which affects sub command.
f.Env = map[string]string{
"FACADE_FOO": "123",
"FACADE_BAR": "Bar Value",
}
f.Run()
}
```

## Sub Command

1. If you name your command `your-command` and run it with `your-command foo bar baz`, façade regards `foo` as sub command and the rest of the arguments as ones for the sub command.
2. Then execute `your-command-foo` with arguments `bar baz`.

## Builtin Commands

façade provides some builtin commands.

### `help`

Shows usage of the command.

### `list`

Lists up all sub commands.

## Logging

façade takes over STDOUT and STDERR of sub command and emits outputs from them in some pretty manner.

## License

MIT