Comments (2)
I have been prototyping this out, but I am not sure how it would work. Filters only return true or false. So we could execute shell commands against the data that came from an event, but we don't have the ability to transform that data (this sounds like an action). Does that make sense?
Here is the working example I have:
{
"Filter":{
"Name":"piped",
"Options":[
{ "Name":"text",
"Value":"echo '{{.text}}' | grep -o . | sort -n | tr -d '\n'"
}
]
}
},
func (filter *PipedFilter) Passes(data interface{}, value interface{}) bool {
log.Println("data : ", data)
log.Println("value: ", value)
filter.command = value.(string)
if filter.command == "" {
log.Println("Cannot execute empty command")
return false
}
filter.command = strings.Replace(filter.command, "{{.text}}", data.(string), 1)
log.Println("New command: ", filter.command)
cmd := exec.Command("/bin/sh", "-c", filter.command)
out, err := cmd.Output()
if err != nil {
log.Println(err)
return false
}
log.Println("output was: ", string(out))
// string(out) now holds the sorted text, BUT we have no way to update the event from here
return true
}
from beehive.
The filter doesn't need to transform data. It only needs to return false (didn't pass filter) or true (passed filter). This might work just fine by the looks.
from beehive.
Related Issues (20)
- Twitch 'Go live' event HOT 1
- Loading via IP gives blank page HOT 1
- Feature Request: allow set custom cookie for website bee
- Oauth authentication to 2FA websites
- go-bindata issue on Raspberry Pi HOT 1
- Wallabag bee
- twitch issue
- Tumblr post types HOT 1
- Telegram bee stopped working HOT 6
- Pocket (formerly Read It Later) bee
- Mastodon: "Fatal chain event" on post HOT 5
- panic happened when click save "bees - changes" action
- Install with go get fails compiling HOT 1
- Migrate Twitter to APIv2
- Make description of bee optional HOT 1
- Is this project maintained? HOT 10
- Build error on MacBook Pro M1 system
- Schedule email of weather
- Bug: Multiple CORS header 'Access-Control-Allow-Origin'
- Vulnerability of dependency "golang.org/x/image"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from beehive.