]> Lady’s Gitweb - HOMEDIR/blob - sh/with-default-path.sh
Add recordjar canonicalization script
[HOMEDIR] / sh / with-default-path.sh
1 #!/usr/bin/env sh
2 # @(#)🏠📂 HOMEDIR sh/with-default-path.sh 2026-04-05T19:49:50Z
3 # SPDX-FileCopyrightText: 2026 Lady <https://www.ladys.computer/about/#lady>
4 # SPDX-License-Identifier: MPL-2.0
5
6 ## ⁌ With Default Path
7 ##
8 ## ∎ Copyright © 2026 Lady [@ Ladys Computer].
9 ##
10 ## ⋮ This Source Code Form is subject to the terms of the Mozilla
11 ## Public License, version 2.0.
12 ## If a copy of the M·P·L was not distributed with this file, You can
13 ## obtain one at {🔗<https://mozilla.org/MPL/2.0/>}.
14
15 ## § Description
16 ##
17 ## Some programs break with the `git´ customizations provided by this
18 ## repository, so it is important to reset the `PATH´ before calling
19 ## them.
20 ## Symlinking such program names to this script provides the necessary
21 ## `PATH´ override.
22
23 set -o 'errexit'
24
25 ## § Configuration
26 ##
27 ## The following variables provide hooks to override the commands used
28 ## by this script.
29
30 : "${cmd_BASENAME:=basename}"
31
32 ## The program name defaults to the basename of the script as it is
33 ## called.
34 ## This allows one to simply create a symlink of the appropriate name
35 ## to this script rather than needing to configure anything
36 ## explicitly.
37
38 defaultprogramname="$(
39 "${cmd_BASENAME}" -- "$0"
40 )"
41 defaultprogram="$(
42 command -pv "${defaultprogramname}"
43 )"
44 : "${cmd_PROGRAM:=${defaultprogram}}"
45
46 ## § Implementation
47 ##
48 ## The implementation simply sets the `PATH´ appropriately (using the
49 ## builtin version of `getconf´) and then calls the program name.
50 ## `${HOMEDIR}/.local/bin´ is added to the `PATH´ to provide a single
51 ## point of extensibility for user‐level modifications; it is
52 ## important that this not be used to override default
53 ## implementations in cases where continued access to the latter is
54 ## important.
55
56 PATH='${HOMEDIR}/.local/bin:'"$(
57 command -p getconf PATH
58 )" "${cmd_PROGRAM}" "$@"
This page took 0.470438 seconds and 5 git commands to generate.