Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: Use XDG Base Directory Specification folder locations #1904

Closed
wants to merge 29 commits into from

Conversation

gaelicWizard
Copy link
Contributor

@gaelicWizard gaelicWizard commented Jul 26, 2021

WORK-IN-PROGRESS

Description

This is a general attempt to adopt XDG_* paths as appropriate, starting with XDG_CACHE_HOME. Likely this will need some changes to internals, such as where "$BASH_IT" points to by default, and where we store configuration files relating to #1819.

Motivation and Context

Adopting the XDG BaseDir spec allows us to be good platform citizens no matter which platform we're on.

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • If my change requires a change to the documentation, I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • If I have added a new file, I also added it to clean_files.txt and formatted it using lint_clean_files.sh.
  • I have added tests to cover my changes, and all the new and existing tests pass.

@NoahGorny
Copy link
Member

Interesting, we also want to ship bash-it in package managers- you can take a look at this - #1819

@gaelicWizard
Copy link
Contributor Author

This PR is mostly waiting on there being more to do with this. Once Bash It is published in platform package managers, then it will be much more useful to refer to the user's data or configuration, but currently the whole Bash It repo is in the user's folder so...

Test was failing only on Mac OS X for some reason, so refactor a little.
Couldn't even `shellcheck` until I did a first pass...too much noise! ♥
SC2076
SC2091
SC2004
SC2086
SC2207
1. `$text_black` isn't a parameter provided by _Bash It_. Typo?
2. `$bold_yellow` is meant for prompt strings and putputs `\[`; ditto `$bold_red`.
3. The color was never returned to normal after.
My apologies to future `git blame` hunters ♥
Alsö, fix tests to load `lib/colors` instead of `lib/appearance`...wut

Alsö, `short-circuit _has_colors()`: If we already looked up colors, and we already have them, then don't run `tput` again.

My apologies to future `git blame` hunters ♥
...to `_bash-it-log-message()`.

alsö, add common log levels with common names.
...to replace `_set-prefix-based-on-path()` in `scripts/reloader`.
- `shfmt`, `shellcheck`
- Clean up legacy/compatibility code to simpler control flow
- Move theme stuff down to where themes are handled
- Don't use `**` as _Bash It_ has never before set `globstar`; this eliminates varying behavior by environment; this alsö fixes users having any not-enabled themes under their custom dir.
- Lose weird Mac-specific alternate shell startup file (Bash loads startup files on Mac the same as it does on any other *nix system.)
- Place `composure.sh` init all in one place
Eliminate the separate loop for `vendor/init.d` since it's just as easy to glob it in the `lib` loop.
This adds *three* lines to `bash_it.sh`, and two to `plugin/base`. Just not worth an extra file requiring special handling.
Rewrite globbing per `shellcheck`'s SC2013 recommendations, and standardize whitespace.
Fix theme file path globbing when $BASH_IT contains any spaces.

My apologies to future `git blame` hunters ♥
Use $XDG_CACHE_HOME environment constant instead of placing a tmp/cache folder inside the bash-it data repo. If not defined, fall back to current behavior.
Locate the bookmarks file in $XDG_STATE_HOME, and migrate an existing file from the old location if it exists.
@NoahGorny NoahGorny closed this in b986c39 Oct 18, 2021
@gaelicWizard gaelicWizard deleted the XDG branch October 18, 2021 19:41
catull pushed a commit to catull/bash-it that referenced this pull request Oct 21, 2021
Use $XDG_CACHE_HOME environment constant instead of placing a tmp/cache folder inside the bash-it data repo. If not defined, fall back to current behavior.

This resolves Bash-it#1904.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants