diff --git a/README.md b/README.md index c4efde4..7b5cd5e 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ For more information, see the [documentation](https://fpgmaas.github.io/ckit/). _ckit_ can look for configuration in the following two locations: - In a `ckit.yaml` file in the current directory -- In any `.yaml` file in the the global configuration directory, which is defaulted to `~/ckit`, but which can be overridden with the environment variable `ckit_HOME`. +- In any `.yaml` file in the the global configuration directory, which is defaulted to `~/ckit`, but which can be overridden with the environment variable `CKIT_HOME`. An example `.yaml` file could look as follows: diff --git a/ckit/command.py b/ckit/command.py index bf290db..1aeee8f 100644 --- a/ckit/command.py +++ b/ckit/command.py @@ -5,6 +5,7 @@ from dataclasses import dataclass import click +import shlex @dataclass @@ -56,7 +57,7 @@ def run(self): for command in cmd: if self.echo: click.echo(command) - subprocess.run(self._expand_env_vars(command).split(" ")) + subprocess.run(shlex.split(self._expand_env_vars(command))) @staticmethod def _expand_env_vars(command): diff --git a/ckit/config/common.py b/ckit/config/common.py index dbd30f1..ae42615 100644 --- a/ckit/config/common.py +++ b/ckit/config/common.py @@ -6,5 +6,5 @@ def get_global_commands_dir() -> Path: """ Get the directory that contains the global command .yaml files. """ - home = Path(os.environ["ckit_HOME"]) if "ckit_HOME" in os.environ else Path.home() / "ckit" + home = Path(os.environ["CKIT_HOME"]) if "CKIT_HOME" in os.environ else Path.home() / "ckit" return home diff --git a/docs/ckit.gif b/docs/ckit.gif new file mode 100644 index 0000000..0b2cd9d Binary files /dev/null and b/docs/ckit.gif differ diff --git a/docs/configuration.md b/docs/configuration.md index 7821c27..6ca0c79 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -3,7 +3,7 @@ _ckit_ looks for configuration in the following two locations - From a `ckit.yaml` file in the current directory -- From any `.yaml` file in the the global configuration directory, which is defaulted to `~/ckit`, but which can be overridden with the environment variable `ckit_HOME`. +- From any `.yaml` file in the the global configuration directory, which is defaulted to `~/ckit`, but which can be overridden with the environment variable `CKIT_HOME`. Each `.yaml` file can contain one or more command groups, each containg one or more commands diff --git a/docs/skate.gif b/docs/skate.gif deleted file mode 100644 index 6338aeb..0000000 Binary files a/docs/skate.gif and /dev/null differ diff --git a/tests/config/test_common.py b/tests/config/test_common.py index e68cef5..58ff4a5 100644 --- a/tests/config/test_common.py +++ b/tests/config/test_common.py @@ -5,5 +5,5 @@ def test_get_global_config_dir(): - os.environ["ckit_HOME"] = "/some/dir" + os.environ["CKIT_HOME"] = "/some/dir" assert get_global_commands_dir() == Path("/some/dir") diff --git a/tests/config/test_config_files_initiator.py b/tests/config/test_config_files_initiator.py index f9a15b5..66aeaee 100644 --- a/tests/config/test_config_files_initiator.py +++ b/tests/config/test_config_files_initiator.py @@ -13,7 +13,7 @@ def test_config_files_initiator(mock_click, tmp_path: Path) -> None: mock_click.return_value = "y" with run_within_dir(tmp_path): - os.environ["ckit_HOME"] = str(tmp_path / "ckit_home") + os.environ["CKIT_HOME"] = str(tmp_path / "CKIT_HOME") ConfigFilesInitiator().init() assert "ckit.yaml" in os.listdir() @@ -21,7 +21,7 @@ def test_config_files_initiator(mock_click, tmp_path: Path) -> None: command_groups_raw = yaml.load(f, Loader=yaml.loader.SafeLoader) assert "example" in command_groups_raw - assert "ckit.yaml" in os.listdir("ckit_home") - with open("ckit_home/ckit.yaml", "rb") as f: + assert "ckit.yaml" in os.listdir("CKIT_HOME") + with open("CKIT_HOME/ckit.yaml", "rb") as f: command_groups_raw = yaml.load(f, Loader=yaml.loader.SafeLoader) assert "example" in command_groups_raw