xline-kv / Xline

A geo-distributed KV store for metadata management
https://xline.cloud
Apache License 2.0
562 stars 70 forks source link

[Feature]: Add exec command args for xlinectl watch command #824

Open Phoenix500526 opened 1 month ago

Phoenix500526 commented 1 month ago

Description about the feature

The etcdctl provides the exec-command arg for the watch command. Therefore, when you want to execute some commands after triggered by watch command, you can use one-line command, like ./etcdctl watch foo -- sh -c "env | grep ETCD_WATCH_". I think this way is more user-friendly.

So far, the xlinectl doesn't support the exec command args for the watch command. I think it's not hard to implement. I leave an issue here to track. Please feel free to take this issue if you are interested in it. And please let me know if you need any help or more information.

Code of Conduct

github-actions[bot] commented 1 month ago

👋 Thanks for opening this issue!

Reply with the following command on its own line to get help or engage:

panwarharsh15 commented 1 month ago

Hey, i don't understand your issue , can you explain what problem are you facing?

Phoenix500526 commented 1 month ago

Hi, @panwarharsh15 ! Here is an etcdctl watch command example:

./etcdctl watch foo -- sh -c "env | grep ETCD_WATCH_"

# PUT
# foo
# bar
# ETCD_WATCH_REVISION=11
# ETCD_WATCH_KEY="foo"
# ETCD_WATCH_EVENT_TYPE="PUT"
# ETCD_WATCH_VALUE="bar"

We can split this command ./etcdctl watch foo -- sh -c "env | grep ETCD_WATCH_" by -- into two parts: one is ./etcdctl watch foo, and the other part is a shell command: env | grep ETCD_WATCH_". It indicates that execute the watch command ./etcdctl watch foo and perform the shell command env | grep ETCD_WATCH_ when the watch command is triggered.

And currently, the watch sub-command in xlinectl doesn't support this way. We can only perform xlinectl watch foo without -- sh -c "env | grep ETCD_WATCH_".