tinty 0.8.0

Change the theme of your terminal, text editor and anything else with one command!
#!/usr/bin/env sh

# Create fixtures for testing

main() {
  command -v realpath >/dev/null 2>&1 || {
    realpath() {
      [ "$1" != "" ] && echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
    }
  }

  local script_path=$(realpath "$0")
  local script_dir=$(dirname "$script_path")
  local project_dir=$(dirname "$script_dir")
  local schemes_repo_dir="$project_dir/schemes"
  local supported_schemes_systems="base16 base24"
  local fixtures_path="$project_dir/fixtures"
  local schemes_file_path="$fixtures_path/schemes.txt"

  if [ -d "$schemes_repo_dir" ]; then
    rm -rf "$schemes_repo_dir"
  fi

  if [ -d "$fixtures_path" ]; then
    rm -r "$fixtures_path"
  fi

  mkdir "$fixtures_path"

  git clone https://github.com/tinted-theming/schemes.git "$schemes_repo_dir"

  for scheme_system in $supported_schemes_systems; do
    local scheme_system_repo_path="$schemes_repo_dir/$scheme_system"

    if [ ! -d "$scheme_system_repo_path" ]; then
      echo "$scheme_system doesn't exist";
      continue
    fi

    for scheme_system_path in "$scheme_system_repo_path"/*; do
      filename=$(basename -- "$scheme_system_path")

      case "$filename" in
        *.yaml)
          theme_name="${filename%.yaml}"
          echo "$scheme_system-$theme_name" >> "$schemes_file_path"
          ;;
      esac
    done
  done

  rm -rf "$schemes_repo_dir"
}

main "$@"