catkin_tools icon indicating copy to clipboard operation
catkin_tools copied to clipboard

catkin config get?

Open peci1 opened this issue 3 years ago • 0 comments

System Info

  • Operating System: Linux cras-11 5.3.0-61-generic #55~18.04.1-Ubuntu SMP Mon Jun 22 16:40:20 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  • Python Version: Python 2.7.17
  • Version of catkin_tools: `catkin_tools 0.4.4*
  • ROS Distro: melodic

Feature suggestion

Right now, I can set many properties of the catkin workspace using catkin config. But there's no way to query these values from CLI.

I've written a helper that allows me to access the attributes of the Context object via Python:

#!/usr/bin/env python

from __future__ import print_function
import sys
from catkin_tools.context import Context

if len(sys.argv) != 2:
    raise ValueError("%s requires exactly one argument" % sys.argv[0])

attribute = sys.argv[1]
context = Context.load('.')

try:
    print(getattr(context, attribute))
except AttributeError, e:
    print("Unknown property %s. Available properties are: %s" % (attribute, str(context.__dict__.keys())),
          file=sys.stderr)
    raise

Would a feature like that make sense as a part of the catkin tools CLI?

Use case

Our build script needs to check is a certain CMake flag is set, and it also needs to check whether the build space exists.

peci1 avatar Jul 08 '20 09:07 peci1