powercli 0.2.0__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. {powercli-0.2.0/src/powercli.egg-info → powercli-0.3.0}/PKG-INFO +1 -1
  2. {powercli-0.2.0 → powercli-0.3.0}/pyproject.toml +1 -1
  3. {powercli-0.2.0 → powercli-0.3.0}/src/cli/__init__.py +1 -0
  4. {powercli-0.2.0 → powercli-0.3.0}/src/cli/commands/__init__.py +1 -0
  5. {powercli-0.2.0 → powercli-0.3.0}/src/cli/commands/open_.py +2 -1
  6. {powercli-0.2.0 → powercli-0.3.0}/src/cli/commands/runner.py +9 -7
  7. {powercli-0.2.0 → powercli-0.3.0/src/powercli.egg-info}/PKG-INFO +1 -1
  8. {powercli-0.2.0 → powercli-0.3.0}/tests/test_runner.py +7 -0
  9. {powercli-0.2.0 → powercli-0.3.0}/LICENSE +0 -0
  10. {powercli-0.2.0 → powercli-0.3.0}/README.md +0 -0
  11. {powercli-0.2.0 → powercli-0.3.0}/setup.cfg +0 -0
  12. {powercli-0.2.0 → powercli-0.3.0}/src/cli/cli/__init__.py +0 -0
  13. {powercli-0.2.0 → powercli-0.3.0}/src/cli/cli/entry_point.py +0 -0
  14. {powercli-0.2.0 → powercli-0.3.0}/src/cli/commands/commands.py +0 -0
  15. {powercli-0.2.0 → powercli-0.3.0}/src/cli/commands/install.py +0 -0
  16. {powercli-0.2.0 → powercli-0.3.0}/src/cli/commands/run.py +0 -0
  17. {powercli-0.2.0 → powercli-0.3.0}/src/cli/input.py +0 -0
  18. {powercli-0.2.0 → powercli-0.3.0}/src/cli/models/__init__.py +0 -0
  19. {powercli-0.2.0 → powercli-0.3.0}/src/cli/models/models.py +0 -0
  20. {powercli-0.2.0 → powercli-0.3.0}/src/cli/output/__init__.py +0 -0
  21. {powercli-0.2.0 → powercli-0.3.0}/src/cli/output/console.py +0 -0
  22. {powercli-0.2.0 → powercli-0.3.0}/src/cli/output/message.py +0 -0
  23. {powercli-0.2.0 → powercli-0.3.0}/src/cli/output/progress.py +0 -0
  24. {powercli-0.2.0 → powercli-0.3.0}/src/cli/output/rich.py +0 -0
  25. {powercli-0.2.0 → powercli-0.3.0}/src/cli/output/status.py +0 -0
  26. {powercli-0.2.0 → powercli-0.3.0}/src/cli/py.typed +0 -0
  27. {powercli-0.2.0 → powercli-0.3.0}/src/powercli.egg-info/SOURCES.txt +0 -0
  28. {powercli-0.2.0 → powercli-0.3.0}/src/powercli.egg-info/dependency_links.txt +0 -0
  29. {powercli-0.2.0 → powercli-0.3.0}/src/powercli.egg-info/entry_points.txt +0 -0
  30. {powercli-0.2.0 → powercli-0.3.0}/src/powercli.egg-info/requires.txt +0 -0
  31. {powercli-0.2.0 → powercli-0.3.0}/src/powercli.egg-info/top_level.txt +0 -0
  32. {powercli-0.2.0 → powercli-0.3.0}/tests/test_cli_entry_point.py +0 -0
  33. {powercli-0.2.0 → powercli-0.3.0}/tests/test_message.py +0 -0
  34. {powercli-0.2.0 → powercli-0.3.0}/tests/test_progress.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: powercli
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: High-level CLI interaction
5
5
  Author-email: Quinten Roets <qdr2104@columbia.edu>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "powercli"
3
- version = "0.2.0"
3
+ version = "0.3.0"
4
4
  description = "High-level CLI interaction"
5
5
  authors = [{name = "Quinten Roets", email = "qdr2104@columbia.edu"}]
6
6
  license = {text = "MIT"}
@@ -5,6 +5,7 @@ from .commands import (
5
5
  completes_successfully,
6
6
  install,
7
7
  launch,
8
+ launch_commands,
8
9
  open_urls,
9
10
  pipe_output_and_capture,
10
11
  run,
@@ -6,6 +6,7 @@ from .run import (
6
6
  capture_return_code,
7
7
  completes_successfully,
8
8
  launch,
9
+ launch_commands,
9
10
  pipe_output_and_capture,
10
11
  run,
11
12
  run_commands,
@@ -1,9 +1,10 @@
1
1
  import os
2
2
 
3
+ from .commands import StringLike
3
4
  from .run import launch
4
5
 
5
6
 
6
- def open_urls(*urls: str) -> None:
7
+ def open_urls(*urls: StringLike) -> None:
7
8
  for url in urls:
8
9
  if os.name == "nt":
9
10
  os.startfile(url) # type: ignore[attr-defined]
@@ -5,7 +5,6 @@ import typing
5
5
  from collections.abc import Callable
6
6
  from dataclasses import dataclass, field
7
7
  from functools import cached_property
8
- from pathlib import Path
9
8
  from typing import Any, Generic, TypeVar
10
9
 
11
10
  from ..models import CalledProcessError
@@ -30,14 +29,17 @@ class Runner(Generic[T1]):
30
29
  input: str | None = None
31
30
  stdout: int | None = None
32
31
  stderr: int | None = None
33
- cwd: Path | str | None = None
34
32
 
35
33
  verbose_errors: bool = True
36
34
  kwargs: dict[str, Any] = field(default_factory=dict)
35
+ subprocess_kwargs: dict[str, Any] = field(default_factory=dict)
37
36
 
38
37
  def __post_init__(self) -> None:
39
- for key, value in self.kwargs.items():
40
- self.__setattr__(key, value)
38
+ for name, value in self.kwargs.items():
39
+ if hasattr(self, name):
40
+ self.__setattr__(name, value)
41
+ else:
42
+ self.subprocess_kwargs[name] = value
41
43
 
42
44
  @cached_property
43
45
  def command_parts(self) -> tuple[str, ...]:
@@ -77,7 +79,7 @@ class Runner(Generic[T1]):
77
79
  self, capture_output: bool | None = None
78
80
  ) -> subprocess.CompletedProcess[T1]:
79
81
  if capture_output is None:
80
- capture_output = not self.quiet
82
+ capture_output = self.quiet
81
83
  return self.run_with_exception_handling(self._run, capture_output)
82
84
 
83
85
  def _run(self, capture_output: bool) -> subprocess.CompletedProcess[T1]:
@@ -90,7 +92,7 @@ class Runner(Generic[T1]):
90
92
  input=self.input,
91
93
  stdout=self.stdout,
92
94
  stderr=self.stderr,
93
- cwd=self.cwd,
95
+ **self.subprocess_kwargs,
94
96
  )
95
97
 
96
98
  def run_in_console(self) -> subprocess.Popen[str]:
@@ -111,7 +113,7 @@ class Runner(Generic[T1]):
111
113
  shell=self.shell,
112
114
  stdout=self.stdout,
113
115
  stderr=self.stderr,
114
- cwd=self.cwd,
116
+ **self.subprocess_kwargs,
115
117
  )
116
118
 
117
119
  def run_with_exception_handling(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: powercli
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: High-level CLI interaction
5
5
  Author-email: Quinten Roets <qdr2104@columbia.edu>
6
6
  License: MIT
@@ -73,3 +73,10 @@ def test_cwd() -> None:
73
73
  with Path.tempdir() as folder:
74
74
  extracted_folder_name = cli.capture_output("pwd", cwd=folder).split("/")[-1]
75
75
  assert extracted_folder_name == folder.name
76
+
77
+
78
+ @given(value=text_strategy())
79
+ @linux_only_test
80
+ def test_extra_subprocess_kwarg(value: str) -> None:
81
+ env = {"name": value}
82
+ assert cli.capture_output("echo", "$name", shell=True, env=env) == value
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes