File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 11import pathlib
22
33
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+
422script = pathlib .Path (__file__ ).resolve ().parent / "malloc_free_check.py"
523
624print (
1028 $ { script } <recording-file>
1129"""
1230)
31+
32+ maybe_install_script (script , "malloc-free-check" )
You can’t perform that action at this time.
0 commit comments