MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / GenShortcutsCommand

Class GenShortcutsCommand

misc/python/materialize/cli/mzcompose.py:306–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304
305
306class GenShortcutsCommand(Command):
307 name = "gen-shortcuts"
308 help = "generate shortcut `mzcompose` shell scripts in mzcompose directories"
309
310 def run(self, args: argparse.Namespace) -> None:
311 repo = mzbuild.Repository.from_arguments(MZ_ROOT, args)
312 template = """#!/usr/bin/env bash
313
314# Copyright Materialize, Inc. and contributors. All rights reserved.
315#
316# Use of this software is governed by the Business Source License
317# included in the LICENSE file at the root of this repository.
318#
319# As of the Change Date specified in that file, in accordance with
320# the Business Source License, use of this software will be governed
321# by the Apache License, Version 2.0.
322#
323# mzcompose — runs Docker Compose with Materialize customizations.
324
325exec "$(dirname "$0")"/{}/bin/pyactivate -m materialize.cli.mzcompose "$@"
326"""
327 for path in repo.compositions.values():
328 mzcompose_path = path / "mzcompose"
329 with open(mzcompose_path, "w") as f:
330 f.write(template.format(os.path.relpath(repo.root, path)))
331 mzbuild.chmod_x(mzcompose_path)
332
333
334class ListCompositionsCommand(Command):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected