py-wait-until 0.0.2__tar.gz → 0.0.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: py-wait-until
3
- Version: 0.0.2
3
+ Version: 0.0.3
4
4
  Summary: Print a loading spinner while another command is running.
5
5
  Author: billwallis
6
6
  Requires-Python: >=3.13
@@ -44,6 +44,16 @@ py-wait-until python -c "import time; time.sleep(2)"
44
44
 
45
45
  The return code of the original command is preserved. Specifying no command will exit with code 1 and show the help message.
46
46
 
47
+ ### Custom loading message
48
+
49
+ You can specify a custom loading message using the `--message` (or `-m`) option:
50
+
51
+ ```shell
52
+ uvx py-wait-until --message "Processing..." python -c "import time; time.sleep(2)"
53
+ ```
54
+
55
+ This option _must_ be specified before the command to run
56
+
47
57
  ## Contributing
48
58
 
49
59
  Install [uv](https://docs.astral.sh/uv/getting-started/installation/) and then install the dependencies:
@@ -36,6 +36,16 @@ py-wait-until python -c "import time; time.sleep(2)"
36
36
 
37
37
  The return code of the original command is preserved. Specifying no command will exit with code 1 and show the help message.
38
38
 
39
+ ### Custom loading message
40
+
41
+ You can specify a custom loading message using the `--message` (or `-m`) option:
42
+
43
+ ```shell
44
+ uvx py-wait-until --message "Processing..." python -c "import time; time.sleep(2)"
45
+ ```
46
+
47
+ This option _must_ be specified before the command to run
48
+
39
49
  ## Contributing
40
50
 
41
51
  Install [uv](https://docs.astral.sh/uv/getting-started/installation/) and then install the dependencies:
@@ -6,7 +6,7 @@ build-backend = "uv_build"
6
6
 
7
7
  [project]
8
8
  name = "py-wait-until"
9
- version = "0.0.2"
9
+ version = "0.0.3"
10
10
  description = "Print a loading spinner while another command is running."
11
11
  authors = [{name = "billwallis"}]
12
12
  readme = "README.md"
@@ -32,7 +32,7 @@ def _spinner() -> Generator[str]:
32
32
  yield chars[index % len(chars)]
33
33
 
34
34
 
35
- def _wait_for_process(cmd: list[str]) -> int:
35
+ def _wait_for_process(cmd: list[str], message: str) -> int:
36
36
  """
37
37
  Execute a command and display a waiting message until it completes.
38
38
  """
@@ -53,7 +53,7 @@ def _wait_for_process(cmd: list[str]) -> int:
53
53
  if is_tty:
54
54
  _write_line(
55
55
  sys.stdout,
56
- f"\rWaiting for process to finish... {next(spin)}",
56
+ f"\r{message} {next(spin)}",
57
57
  )
58
58
  time.sleep(WAIT_DURATION_SECONDS)
59
59
 
@@ -83,13 +83,24 @@ def main(argv: Sequence[str] | None = None) -> int:
83
83
  nargs=argparse.REMAINDER,
84
84
  help="Command(s) to execute",
85
85
  )
86
+ parser.add_argument(
87
+ "-m",
88
+ "--message",
89
+ type=str,
90
+ required=False,
91
+ default="Waiting for process to finish...",
92
+ help="Message to display while waiting",
93
+ )
86
94
 
87
95
  args = parser.parse_args(argv)
88
96
  if not args.command:
89
97
  parser.print_help()
90
98
  return 1
91
99
 
92
- return _wait_for_process(args.command)
100
+ return _wait_for_process(
101
+ cmd=args.command,
102
+ message=args.message,
103
+ )
93
104
 
94
105
 
95
106
  if __name__ == "__main__":