diff options
Diffstat (limited to 'icktool')
-rwxr-xr-x | icktool | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -382,16 +382,24 @@ class BuildGraphCommand(Command): class MakeItSoCommand(Command): def execute(self, args): - obj = self._read_object() + if not args: + obj = self._read_object(sys.stdin) + self._make_it_so(obj) + else: + for filename in args: + with open(filename) as f: + obj = self._read_object(f) + self._make_it_so(obj) + def _read_object(self, f): + return yaml.load(f) + + def _make_it_so(self, obj): self._create_resources( '/projects', 'project', obj.get('projects', [])) self._create_resources( '/pipelines', 'pipeline', obj.get('pipelines', [])) - def _read_object(self): - return yaml.load(sys.stdin) - def _create_resources(self, path, name_field, objs): for obj in objs: try: |