Skip to content

Commit

Permalink
Merge pull request #125 from deviantfero/new-templates
Browse files Browse the repository at this point in the history
New template format
  • Loading branch information
deviantfero authored Feb 11, 2019
2 parents 4fa6663 + 1f15384 commit 5a7dc23
Show file tree
Hide file tree
Showing 14 changed files with 368 additions and 245 deletions.
18 changes: 9 additions & 9 deletions completions/bash/wpg
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
function _wpg() {
local optforprofiles
local optforcolorschemes
_get_comp_words_by_ref cur
# themes
optforprofiles="-s -e -d -z -m -LA -A --brt --sat"
optforcolorschemes="-s -e -d -z -m -LA -A --brt --sat -R"
# themes, pywal themes
optforvariabletheme="-Ti"
# themes, filenames
optvariable="-i -o"
# filenames
optfordefault="-y -a -xa -ax"
optfordefault="--link -aL -La -a -ta -at --update"
# templates
optfortemplates="-xd -dx"
optfortemplates="-td -dt"
# pywal backends
optforbackends="--backends"
# pywal themes
optforthemes="--pywal"
optforthemes="--theme"

if [[ $COMP_CWORD = 1 ]]; then
COMPREPLY=($(compgen -W "$(_parse_usage wpg)" -- "$cur"))
elif [[ $COMP_CWORD < 4 || ${COMP_WORDS[1]} != "-s" ]]; then
for opt in $optforprofiles; do
for opt in $optforcolorschemes; do
if [[ $opt = ${COMP_WORDS[1]} ]]; then
COMPREPLY=($(compgen -W "$(wpg -l)" -- "$cur"))
fi
Expand All @@ -31,7 +31,7 @@ function _wpg() {
done
for opt in $optforthemes; do
if [[ $opt = ${COMP_WORDS[1]} ]]; then
COMPREPLY=($(compgen -W "$(wpg --pywal)" -- "$cur"))
COMPREPLY=($(compgen -W "$(wpg --theme)" -- "$cur"))
fi
done
for opt in $optvariable; do
Expand All @@ -45,7 +45,7 @@ function _wpg() {
if [[ $opt = ${COMP_WORDS[1]} && $COMP_CWORD < 3 ]]; then
COMPREPLY=($(compgen -W "$(wpg -l)" -- "$cur"))
elif [[ $opt = ${COMP_WORDS[1]} ]]; then
COMPREPLY=($(compgen -W "$(wpg --pywal)" -- "$cur"))
COMPREPLY=($(compgen -W "$(wpg --theme)" -- "$cur"))
fi
done
for opt in $optfordefault; do
Expand All @@ -55,7 +55,7 @@ function _wpg() {
done
for opt in $optfortemplates; do
if [[ $opt = ${COMP_WORDS[1]} ]]; then
COMPREPLY=($(compgen -W "$(wpg -xl)" -- "$cur"))
COMPREPLY=($(compgen -W "$(wpg -tl)" -- "$cur"))
fi
done
fi
Expand Down
44 changes: 22 additions & 22 deletions completions/zsh/_wpg
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#compdef wpg

_profiles() {
local -a profiles
profiles=(`wpg -l`)
_describe 'profiles' profiles
_colorschemes() {
local -a colorschemes
colorschemes=(`wpg -l`)
_describe 'colorschemes' colorschemes
}

_templates() {
local -a templates
templates=(`wpg -xl`)
_describe 'templates' templates
local -a templates
templates=(`wpg -tl`)
_describe 'templates' templates
}

_backends() {
Expand All @@ -20,52 +20,52 @@ _backends() {

_themes() {
local -a themes
themes=(`wpg --pywal`)
themes=(`wpg --theme`)
_describe 'themes' themes
}

_wpg() {
local state optforprofiles
local state optforcolorschemes
# themes
optforprofiles=(-s -e -d -z -m -A -LA --brt --sat)
optforcolorschemes=(-s -e -d -z -m -A -LA --brt --sat -R)
# themes, filenames
optvariable=(-i -o)
# themes, pywal themes
optvariabletheme=(-Ti)
# filenames
optforgeneric=(-y -a -xa)
optforgeneric=(--link -a -La -aL -ta -at --update)
# templates
optfortemplates=(-xd -dx)
optfortemplates=(-td -dt)
# pywal backends
optforbackends=(--backend)
# pywal themes
optforthemes=(--pywal)
optforthemes=(--theme)

_arguments \
'1: :->generic' \
'*: :->listprofiles'
'*: :->listcolorschemes'

case $state in
(generic)
_gnu_generic
;;
(listprofiles)
(listcolorschemes)
if [[ $CURRENT < 5 || ${words[2]} != "-s" ]]; then
for opt in $optforprofiles; do
for opt in $optforcolorschemes; do
if [[ $opt = ${words[2]} ]]; then
_profiles
_colorschemes
fi
done
for opt in $optvariable; do
if [[ $opt = ${words[2]} && $CURRENT < 4 ]]; then
_profiles
_colorschemes
elif [[ $opt = ${words[2]} ]]; then
_gnu_generic
fi
done
for opt in $optvariabletheme; do
if [[ $opt = ${words[2]} && $CURRENT < 4 ]]; then
_profiles
_colorschemes
elif [[ $opt = ${words[2]} ]]; then
_themes
fi
Expand All @@ -90,9 +90,9 @@ _wpg() {
_themes
fi
done
fi
;;
esac
fi
;;
esac
}

_wpg "$@"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
python_requires=">=3.5",
install_requires=[
'Pillow>=4.2.1',
'pywal>=2.0.0',
'pywal>=3.0.0',
],
include_package_data=True,
data_files=[('etc/wpgtk', ['wpgtk/misc/wpg.conf']),
Expand Down
Loading

0 comments on commit 5a7dc23

Please sign in to comment.