k1LoW / runn

runn is a package/tool for running operations following a scenario.
https://runn.run
MIT License
417 stars 30 forks source link

[Feature request] Allow negative filtering by labels #934

Closed h6ah4i closed 3 months ago

h6ah4i commented 3 months ago

Hi. I think it would be convenient if runn had more flexibility in filtering runbooks.

## examples
runn run path/to/**/*.yml --label !foo
runn run path/to/**/*.yml --label '!foo and !bar'

However, I am aware that introducing negative operator into the current label option can be troublesome. If possible, it might be better to introduce a new option that allows users to freely filter using the expr syntax.

## examples
runn run path/to/**/*.yml --filter '!labels.foo and !labels.bar'

runn run path/to/**/*.yml --filter '!labels.foo' --filter '!labels.bar'
#  converted to  => (!labels.foo) and ('!labels.bar)

runn run path/to/**/*.yml --filter '!labels["foo"]' --filter '!labels["bar"]'
#  converted to  => (!labels["foo"]) and ('!labels["bar"])
k1LoW commented 3 months ago

@h6ah4i Thank you for your request!

Could your requirements be met with features such as #935?

h6ah4i commented 3 months ago

@k1LoW The PR #935 looks great to me! Thank you!