Source code for benchbuild.cli.config
"""Subcommand for configuration handling."""
import os
from plumbum import cli
from benchbuild.cli.main import BenchBuild
from benchbuild import settings
[docs]@BenchBuild.subcommand("config")
class BBConfig(cli.Application):
"""Manage BenchBuild's configuration."""
[docs] def main(self):
if not self.nested_command:
self.help()
[docs]@BBConfig.subcommand("view")
class BBConfigView(cli.Application):
"""View the current configuration."""
[docs] def main(self):
print(repr(settings.CFG))
[docs]@BBConfig.subcommand("write")
class BBConfigWrite(cli.Application):
"""Write the current configuration to a file."""
[docs] def main(self):
config_path = ".benchbuild.yml"
settings.CFG.store(config_path)
print("Storing config in {0}".format(os.path.abspath(config_path)))