Golang的过滤器包
Golang的过滤器包
Go 其它杂项
共10Star
详细介绍
Filters
Filters Package for Golang
The Filters package is designed to allow the chaining of cli commands using stdin and stdout.
The command allows setting the commands explicitly or loading from a yaml file.
Filter
A Filter is any cli command, but primarily focused on the idea of unix cli commands being used as byte filters used to mangle and transform text and piping commands together.
Chain
A Chain is a sequential list of Filters with each piping its output into the next.
Exec
From either a chain or filter an Exec can be generated.
Input for an Exec is provided as a io.Reader and output is assigned as an io.Writer.
On an Exec from a chain, input is assigned to the first process and output assigned to the last. Everything in between is automatically piped to the next Filter.
Chains
Chains allow the application to load multiple chains in one yaml file and retrive them by title.
Yaml file definitions
Filter YAML Example
Name: 'cat'
Domain: 'bash'
Version: '1.0'
Command: 'cat'
Arguments:
Chain YAML Example
Chain:
- Name: 'cat'
Domain: 'bash'
Version: '1.0'
Command: 'cat'
Arguments:
- Name: 'grep'
Domain: 'bash'
Version: '1.0'
Command: 'grep'
Arguments:
- 'wrong'
- Name: 'xargs'
Domain: 'bash'
Version: '1.0'
Command: 'xargs'
Arguments:
- '-n'
- '3'
Chains YAML Example
FirstChain:
Chain:
- Name: 'ls'
Domain: 'bash'
Version: '1.0'
Command: 'ls'
Arguments:
VCS:
Type: 'git'
Location: 'github.com'
- Name: 'grep'
Domain: 'bash'
Version: '1.0'
Command: 'grep'
Arguments:
- 'filters'
VCS:
Type: 'git'
Location: 'github.com'
- Name: 'xargs'
Domain: 'bash'
Version: '1.0'
Command: 'xargs'
Arguments:
- '-n'
- '4'
VCS:
Type: 'git'
Location: 'github.com'
SecondChain:
Chain:
- Name: 'ls'
Domain: 'bash'
Version: '1.0'
Command: 'ls'
Arguments:
VCS:
Type: 'git'
Location: 'github.com'
- Name: 'grep'
Domain: 'bash'
Version: '1.0'
Command: 'grep'
Arguments:
- 'filters'
VCS:
Type: 'git'
Location: 'github.com'
- Name: 'xargs'
Domain: 'bash'
Version: '1.0'
Command: 'xargs'
Arguments:
- '-n'
- '4'
VCS:
Type: 'git'
Location: 'github.com'
See the godocs for more information and examples.
-
19 Star
-
23 Star
-
0 Star
-
50 Star
-
1362 Star
-
142 Star
-
0 Star
-
1 Star
-
0 Star
-
0 Star