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

Do not source orphaned sh files #61

Merged
merged 5 commits into from
Sep 25, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ subcommand, source the generated file in your shell startup file (`*rc`)
and completions will exist for `tinty`. Have a look at the [README CLI
section] for more information about the command usage.

```sh
```shell
windowsrefund marked this conversation as resolved.
Show resolved Hide resolved
tinty generate-completion zsh > path/to/tinty-zsh-completion.sh
```

In your startup file (`*rc`) add the following:

```sh
```shell
windowsrefund marked this conversation as resolved.
Show resolved Hide resolved
source path/to/tinty-zsh-completion.sh
```

Expand Down Expand Up @@ -89,20 +89,22 @@ There is a workaround for this specific issue.

The following script does that. Add it to your shell startup file (`*rc`):

```sh
```shell
windowsrefund marked this conversation as resolved.
Show resolved Hide resolved
# Tinty isn't able to apply environment variables to your shell due to
# the way shell sub-processes work. This is a work around by running
# Tinty through a function and then executing the shell scripts.
tinty_source_shell_theme() {
newer_file=$(mktemp)
tinty $@
subcommand="$1"

if [ "$subcommand" = "apply" ] || [ "$subcommand" = "init" ]; then
tinty_data_dir="${XDG_DATA_HOME:-$HOME/.local/share}/tinted-theming/tinty"

for tinty_script_file in $(find "$tinty_data_dir" -maxdepth 1 -type f -name "*.sh"); do
. $tinty_script_file
done
while read -r script; do
# shellcheck disable=SC1090
. "$script"
done < <(find "$tinty_data_dir" -maxdepth 1 -type f -name "*.sh" -newer "$newer_file")

unset tinty_data_dir
fi
Expand Down Expand Up @@ -135,7 +137,7 @@ Tinty will not apply it.
If everything works as expected, `tinty apply
base16-your-scheme-name.yaml` should apply your scheme.

```sh
```shell
windowsrefund marked this conversation as resolved.
Show resolved Hide resolved
mkdir "$(tinty config --data-dir-path)/custom-schemes/base16"
cp path/to/your/base16-your-scheme.yaml "$(tinty config --data-dir-path)/custom-schemes/base16/your-scheme.yaml"
tinty list --custom-schemes # Should show your scheme
Expand Down Expand Up @@ -443,7 +445,7 @@ ANSI colors to be used. The available `bat` theme names for this are
Set the alias in your `.*rc` file to make sure this is run by default
whenever `bat` is executed.

```sh
```shell
windowsrefund marked this conversation as resolved.
Show resolved Hide resolved
alias bat="bat --theme='base16-256'"
```

Expand Down
Loading