We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f9244d6 commit 099e850Copy full SHA for 099e850
malloc_free_check/install.py
@@ -1,6 +1,24 @@
1
import pathlib
2
3
4
+def maybe_install_script(script_path: pathlib.Path, script_name: str) -> None:
5
+ """
6
+ Ask for permission and then install a script into ~/.local/bin.
7
8
+ local_bin = pathlib.Path.home() / ".local" / "bin"
9
+ install_path = local_bin / script_name
10
+
11
+ choice = input(f"Do you want to install {script_name} to {local_bin}? [y/N] ")
12
+ if choice.lower() not in ("y", "yes"):
13
+ return
14
15
+ try:
16
+ install_path.symlink_to(script_path)
17
+ install_path.chmod(0o755)
18
+ except OSError as e:
19
+ print(f"Failed to install the script: {e}")
20
21
22
script = pathlib.Path(__file__).resolve().parent / "malloc_free_check.py"
23
24
print(
@@ -10,3 +28,5 @@
28
$ {script} <recording-file>
29
"""
30
)
31
32
+maybe_install_script(script, "malloc-free-check")
0 commit comments