In summary, the value ${XDG_DATA_HOME:-$HOME/.local/share}/basher is set to $BASHER_ROOT, but only if that directory already exists. This ensures backwards compatibility. If the user chooses to use the new XDG_DATA_HOME system, they must move ~/.basher to $XDG_DATA_HOME/basher themselves. And, the uninstall.sh now script also checks this directory to remove it. The install.sh also checks this directory before installing (to prevent installation if an installation already exists), but does not install Basher to that location. Ensured all tests pass locally
Test Results
```bash
basher on xdg-spec-new via 🐏 8GiB/16GiB
➤ make test
bats tests
1..122
ok 1 default BASHER_ROOT
ok 2 inherited BASHER_ROOT
ok 3 inherited XDG_DATA_HOME
ok 4 inherited XDG_DATA_PREFIX overriden by inherited BASHER_ROOT
ok 5 default BASHER_PREFIX
ok 6 inherited BASHER_PREFIX
ok 7 BASHER_PREFIX based on BASHER_ROOT
ok 8 inherited BASHER_PACKAGES_PATH
ok 9 BASHER_PACKAGES_PATH based on BASHER_PREFIX
ok 10 default BASHER_INSTALL_BIN
ok 11 inherited BASHER_INSTALL_BIN
ok 12 BASHER_INSTALL_BIN based on BASHER_PREFIX
ok 13 default BASHER_INSTALL_MAN
ok 14 inherited BASHER_INSTALL_MAN
ok 15 BASHER_INSTALL_MAN based on BASHER_PREFIX
ok 16 without arguments prints usage
ok 17 invalid package prints usage
ok 18 too many arguments prints usage
ok 19 install a specific version
ok 20 does nothing if package is already present
ok 21 using a different site
ok 22 without setting BASHER_FULL_CLONE, clones a package with depth option
ok 23 setting BASHER_FULL_CLONE to true, clones a package without depth option
ok 24 setting BASHER_FULL_CLONE to false, clones a package with depth option
ok 25 using ssh protocol
ok 26 without arguments prints usage
ok 27 lists commands
ok 28 does not list hidden commands
ok 29 command with no completion support
ok 30 command with completion support
ok 31 without arguments, prints usage
ok 32 without dependencies, does nothing
ok 33 installs dependencies
ok 34 without args shows summary of common commands
ok 35 invalid command
ok 36 shows help for a specific command
ok 37 replaces missing extended help with summary text
ok 38 extracts only usage
ok 39 multiline usage section
ok 40 multiline extended help section
ok 41 without enough arguments, prints a useful message
ok 42 exports BASHER_ROOT
ok 43 exports BASHER_PREFIX
ok 44 exports BASHER_PACKAGES_PATH
ok 45 adds cellar/bin to path
ok 46 setup include function if it exists
ok 47 doesn't setup include function if it doesn't exist
ok 48 setup basher completions if available
ok 49 does not setup basher completions if not available
ok 50 setup package completions (bash)
ok 51 setup package completions (zsh)
ok 52 is sh-compatible
ok 53 without arguments prints usage
ok 54 incorrect argument prints usage
ok 55 too many arguments prints usage
ok 56 executes install steps in right order
ok 57 with site, overwrites site
ok 58 without site, uses github as default site
ok 59 using ssh protocol
ok 60 installs with custom version
ok 61 empty version is ignored
ok 62 doesn't fail
ok 63 without arguments prints usage
ok 64 fails with only one argument
ok 65 fails with an invalid path
ok 66 fails with a file path instead of a directory path
ok 67 fails with an invalid package name
ok 68 links the package to packages under the correct namespace
ok 69 calls link-bins, link-completions, link-man and deps
ok 70 respects --no-deps option
ok 71 resolves current directory (dot) path
ok 72 resolves parent directory (dotdot) path
ok 73 resolves arbitrary complex relative path
ok 74 links each file on the BINS config on package.sh to the install bin
ok 75 links each file inside bin folder to install bin
ok 76 links each exec file in package root to install bin
ok 77 doesn't link root bins if there is a bin folder
ok 78 doesn't link root bins or files in bin folder if there is a BINS config on package.sh
ok 79 does not fail if there are no binaries
ok 80 remove extension if REMOVE_EXTENSION is true
ok 81 does not remove extension if REMOVE_EXTENSION is false
ok 82 does not symlink package itself as bin when linked with basher link
ok 83 links bash completions to prefix/completions
ok 84 links zsh compsys completions to prefix/completions
ok 85 links zsh compctl completions to prefix/completions
ok 86 does not fail if package doesn't have any completions
ok 87 links each man page to install-man under correct subdirectory
ok 88 with arguments shows usage
ok 89 list installed packages
ok 90 displays nothing if there are no packages
ok 91 displays outdated packages
ok 92 ignore packages checked out with a tag or ref
ok 93 without arguments, prints usage
ok 94 outputs the package path
ok 95 without arguments prints usage
ok 96 with invalid arguments, prints usage
ok 97 with too many arguments, prints usage
ok 98 fails if package is not installed
ok 99 removes package directory
ok 100 removes binaries
ok 101 does not remove other package directories and binaries
ok 102 removes each binary in BINS config from the install bin
ok 103 removes each binary from the install bin
ok 104 removes root binaries from the install bin
ok 105 doesn't remove root binaries if there is a bin folder
ok 106 doesn't remote root bins or files in bin folder if there is a BINS config on package.sh
ok 107 does not fail if there are no binaries
ok 108 removes binary when REMOVE_EXTENSION is true
ok 109 removes binary when REMOVE_EXTENSION is false
ok 110 unlinks bash completions from prefix/completions
ok 111 unlinks zsh compsys completions from prefix/completions
ok 112 unlinks zsh compctl completions from prefix/completions
ok 113 removes each man page from the install-man
ok 114 without arguments shows usage
ok 115 with invalid argument, shows usage
ok 116 with too many arguments, shows usage
ok 117 upgrades a package to the latest version
ok 118 without arguments, prints an error
ok 119 with one argument, prints an error
ok 120 when package is not installed, prints an error
ok 121 when file doesn't exist, prints an error
ok 122 sources a file into the current shell
```
This adds support for using XDG_DATA_HOME
In summary, the value
${XDG_DATA_HOME:-$HOME/.local/share}/basher
is set to$BASHER_ROOT
, but only if that directory already exists. This ensures backwards compatibility. If the user chooses to use the new XDG_DATA_HOME system, they must move ~/.basher to$XDG_DATA_HOME/basher
themselves. And, theuninstall.sh
now script also checks this directory to remove it. Theinstall.sh
also checks this directory before installing (to prevent installation if an installation already exists), but does not install Basher to that location. Ensured all tests pass locallyTest Results
```bash basher on xdg-spec-new via 🐏 8GiB/16GiB ➤ make test bats tests 1..122 ok 1 default BASHER_ROOT ok 2 inherited BASHER_ROOT ok 3 inherited XDG_DATA_HOME ok 4 inherited XDG_DATA_PREFIX overriden by inherited BASHER_ROOT ok 5 default BASHER_PREFIX ok 6 inherited BASHER_PREFIX ok 7 BASHER_PREFIX based on BASHER_ROOT ok 8 inherited BASHER_PACKAGES_PATH ok 9 BASHER_PACKAGES_PATH based on BASHER_PREFIX ok 10 default BASHER_INSTALL_BIN ok 11 inherited BASHER_INSTALL_BIN ok 12 BASHER_INSTALL_BIN based on BASHER_PREFIX ok 13 default BASHER_INSTALL_MAN ok 14 inherited BASHER_INSTALL_MAN ok 15 BASHER_INSTALL_MAN based on BASHER_PREFIX ok 16 without arguments prints usage ok 17 invalid package prints usage ok 18 too many arguments prints usage ok 19 install a specific version ok 20 does nothing if package is already present ok 21 using a different site ok 22 without setting BASHER_FULL_CLONE, clones a package with depth option ok 23 setting BASHER_FULL_CLONE to true, clones a package without depth option ok 24 setting BASHER_FULL_CLONE to false, clones a package with depth option ok 25 using ssh protocol ok 26 without arguments prints usage ok 27 lists commands ok 28 does not list hidden commands ok 29 command with no completion support ok 30 command with completion support ok 31 without arguments, prints usage ok 32 without dependencies, does nothing ok 33 installs dependencies ok 34 without args shows summary of common commands ok 35 invalid command ok 36 shows help for a specific command ok 37 replaces missing extended help with summary text ok 38 extracts only usage ok 39 multiline usage section ok 40 multiline extended help section ok 41 without enough arguments, prints a useful message ok 42 exports BASHER_ROOT ok 43 exports BASHER_PREFIX ok 44 exports BASHER_PACKAGES_PATH ok 45 adds cellar/bin to path ok 46 setup include function if it exists ok 47 doesn't setup include function if it doesn't exist ok 48 setup basher completions if available ok 49 does not setup basher completions if not available ok 50 setup package completions (bash) ok 51 setup package completions (zsh) ok 52 is sh-compatible ok 53 without arguments prints usage ok 54 incorrect argument prints usage ok 55 too many arguments prints usage ok 56 executes install steps in right order ok 57 with site, overwrites site ok 58 without site, uses github as default site ok 59 using ssh protocol ok 60 installs with custom version ok 61 empty version is ignored ok 62 doesn't fail ok 63 without arguments prints usage ok 64 fails with only one argument ok 65 fails with an invalid path ok 66 fails with a file path instead of a directory path ok 67 fails with an invalid package name ok 68 links the package to packages under the correct namespace ok 69 calls link-bins, link-completions, link-man and deps ok 70 respects --no-deps option ok 71 resolves current directory (dot) path ok 72 resolves parent directory (dotdot) path ok 73 resolves arbitrary complex relative path ok 74 links each file on the BINS config on package.sh to the install bin ok 75 links each file inside bin folder to install bin ok 76 links each exec file in package root to install bin ok 77 doesn't link root bins if there is a bin folder ok 78 doesn't link root bins or files in bin folder if there is a BINS config on package.sh ok 79 does not fail if there are no binaries ok 80 remove extension if REMOVE_EXTENSION is true ok 81 does not remove extension if REMOVE_EXTENSION is false ok 82 does not symlink package itself as bin when linked with basher link ok 83 links bash completions to prefix/completions ok 84 links zsh compsys completions to prefix/completions ok 85 links zsh compctl completions to prefix/completions ok 86 does not fail if package doesn't have any completions ok 87 links each man page to install-man under correct subdirectory ok 88 with arguments shows usage ok 89 list installed packages ok 90 displays nothing if there are no packages ok 91 displays outdated packages ok 92 ignore packages checked out with a tag or ref ok 93 without arguments, prints usage ok 94 outputs the package path ok 95 without arguments prints usage ok 96 with invalid arguments, prints usage ok 97 with too many arguments, prints usage ok 98 fails if package is not installed ok 99 removes package directory ok 100 removes binaries ok 101 does not remove other package directories and binaries ok 102 removes each binary in BINS config from the install bin ok 103 removes each binary from the install bin ok 104 removes root binaries from the install bin ok 105 doesn't remove root binaries if there is a bin folder ok 106 doesn't remote root bins or files in bin folder if there is a BINS config on package.sh ok 107 does not fail if there are no binaries ok 108 removes binary when REMOVE_EXTENSION is true ok 109 removes binary when REMOVE_EXTENSION is false ok 110 unlinks bash completions from prefix/completions ok 111 unlinks zsh compsys completions from prefix/completions ok 112 unlinks zsh compctl completions from prefix/completions ok 113 removes each man page from the install-man ok 114 without arguments shows usage ok 115 with invalid argument, shows usage ok 116 with too many arguments, shows usage ok 117 upgrades a package to the latest version ok 118 without arguments, prints an error ok 119 with one argument, prints an error ok 120 when package is not installed, prints an error ok 121 when file doesn't exist, prints an error ok 122 sources a file into the current shell ```Closes #73