Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to call a function with params inside program when a action triggered?a #338

Open
lucasjinreal opened this issue Sep 11, 2022 · 6 comments
Labels
question Further information is requested

Comments

@lucasjinreal
Copy link

how to call a function with params inside program when a action triggered?a

@wass3r wass3r added the question Further information is requested label Sep 12, 2022
@wass3r
Copy link
Collaborator

wass3r commented Sep 12, 2022

do you have an example?

you can do:

actions:
  - name: sample script
    type: exec
    cmd: python config/scripts/main.py <insert parameter>

and your script would handle what to do with the parameter. if you're talking about something else, i might need an example.

@lucasjinreal
Copy link
Author

@wass3r hi, I am not using script, I wanna call a function inside go program itself, with params. Is that possible?

@wass3r
Copy link
Collaborator

wass3r commented Sep 12, 2022

i think the short answer is "no".

however, you could modify the Go app to accept command line args that call the function. but without modifying the Go code, i don't think there's a way.

@lucasjinreal
Copy link
Author

lucasjinreal commented Sep 12, 2022

@wass3r no , I mean, call the go code along with bot code, I have a operator object must initialized along with bot it self. which is injected into flatboat already.

I just wanna using yaml to config a func, and then execute this func (by name) inside same program , not a standalone executable file.

@wass3r
Copy link
Collaborator

wass3r commented Sep 15, 2022

so you kind of want to use this as a module in your own code? it's not really meant or written for that purpose.

@lucasjinreal
Copy link
Author

@wass3r Yes. May can done with some reflection way? Do u know any idea if I have this command?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants