diff --git a/styler/.local/bin/styler b/styler/.local/bin/styler index f094b7d..650be57 100755 --- a/styler/.local/bin/styler +++ b/styler/.local/bin/styler @@ -1,7 +1,6 @@ #!/usr/bin/env bash readonly BASE_PATH="${STYLER_DATA_PATH:-${XDG_DATA_HOME:-$HOME/.local/share}/styler}" -readonly DEBUG="${STYLER_ENABLE_DEBUG_MODE:-false}" readonly PACKAGE_PATH="$BASE_PATH/packages" readonly PROCESSOR_PATH="$BASE_PATH/processors" @@ -14,6 +13,9 @@ main() { -s | --set | set) cmd="set_theme" ;; + -l | --list | list) + cmd="list" + ;; -v | --version | version) printf "Program theming script.\n\n©Marty Oehme\n\nVersion: 0.1.0\n" exit 0 @@ -75,6 +77,13 @@ get_processors() { done } +# retrieves all installed themes from all packages, appends applications they exist for +get_themes() { + local themes + themes=$(find "$PACKAGE_PATH" -type f -name 'base16-*') + echo "$themes" | sed "s/.*\\/base16-//" | sed "s/\\..*//" | sort | uniq +} + set_theme() { local theme="$1" @@ -112,4 +121,23 @@ set_theme() { done } +list() { + local selected="$1" + + case "$selected" in + packages) + get_packages + ;; + processors) + get_processors + ;; + themes) + get_themes + ;; + *) + echo "Please select one of packages | processors | themes to list." + ;; + esac +} + main "$@"