Get the list of selected/excluded columns from dbt run command

The problem I’m having

Could anyone please tell me if there is a way to get the list of selected or excluded columns in a dbt run command?

The context of why I’m trying to do this

What I am trying to achieve is to get them inside a macro and build logic around it . For example archive log data for those models etc…

What I’ve already tried

So far, what I am doing is parsing the flags.INVOCATION_COMMAND and extract them from there, but I am wondering whether there is a command that will get me this list which is passed as a parameter to the dbt run command?


I found the solution… We can use invocation_args_dict
Basically invocation_args_dict[“select”] returns the list of models listed with the --select argument