forked from enlightenment/enlightenment
parent
b399d50737
commit
2f11c20705
|
@ -1,118 +0,0 @@
|
|||
#compdef enlightenment_remote
|
||||
|
||||
# zshcompsys function for enlightenment_remote
|
||||
# written by Oliver Burnett-Hall <olly@burnett-hall.co.uk>
|
||||
|
||||
# TODO:
|
||||
# . -module-load produces completions for all available modules; it should
|
||||
# just complete unloaded ones
|
||||
# . I'm not sure if completions for arguments to -lang-set are correct
|
||||
# . produces completions for keys argument to -binding-key-(add|del)
|
||||
# . produces completions for buttons argument to -binding-mouse-(add|del)
|
||||
# . produce completions for actions argument to -binding-*
|
||||
# . possibly produce completions for parameters argument to -binding-*
|
||||
# . completions for -binding-(key|mouse)-del should be based on existing
|
||||
# bindings
|
||||
|
||||
local allopts="-bg-dirs-list -default-bg-get -default-bg-set \
|
||||
-binding-key-add -binding-key-del \
|
||||
-binding-key-list -binding-mouse-add -binding-mouse-del \
|
||||
-binding-mouse-list -font-apply -font-available-list \
|
||||
-font-default-get -font-default-list -font-default-remove \
|
||||
-font-default-set -font-fallback-append -font-fallback-clear \
|
||||
-font-fallback-list -font-fallback-prepend -font-fallback-remove \
|
||||
-lang-get -lang-list -lang-set -module-dirs-list -module-disable \
|
||||
-module-enable -module-list -module-load -module-unload -restart \
|
||||
-shutdown -help"
|
||||
|
||||
local text_classes="default title_bar"
|
||||
local contexts="NONE UNKNOWN BORDER ZONE MANAGER ANY"
|
||||
local modifiers="SHIFT CTRL ALT WIN"
|
||||
|
||||
local context line state
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments : \
|
||||
"($allopts)-help[Show usage]" \
|
||||
"($allopts)-module-load[Load module into memory]:module name:->unloaded-module" \
|
||||
"($allopts)-module-unload[Unload (and disable) module]:module name:->loaded-module" \
|
||||
"($allopts)-module-enable[Enable module if not enabled]:module name:->disabled-module" \
|
||||
"($allopts)-module-disable[Disable module if not disabled]:module name:->enabled-module" \
|
||||
"($allopts)-module-list[List all loaded modules and their states]" \
|
||||
"($allopts)-module-dirs-list[List all modules directories]" \
|
||||
"($allopts)-default-bg-set[Set the background edje file]:background edje:_files -g \*.edj" \
|
||||
"($allopts)-default-bg-get[Get the background edje file]" \
|
||||
"($allopts)-bg-dirs-list[Get the background directories]" \
|
||||
"($allopts)-font-fallback-remove[Remove a font from the fontset]:font name:->fallback-font" \
|
||||
"($allopts)-font-fallback-prepend[Prepend a font to the fontset]:font name:->available-font" \
|
||||
"($allopts)-font-fallback-append[Append a font to the fontset]:font name:->available-font" \
|
||||
"($allopts)-font-apply[Apply changes made to the font system]" \
|
||||
"($allopts)-font-fallback-list[List the fallback fonts in order]" \
|
||||
"($allopts)-font-available-list[List available fonts]" \
|
||||
"($allopts)-font-fallback-clear[Clear font fallback list]" \
|
||||
"($allopts)-font-default-get[List the default font associated with OPT1]:text class:($text_classes)" \
|
||||
"($allopts)-font-default-remove[Remove the default text class OPT1]:text class:($text_classes)" \
|
||||
"($allopts)-font-default-list[List all configured text classes]" \
|
||||
"($allopts)-font-default-set[Set textclass, font, and size]:text class:($text_classes):font name:->available-font:font size:" \
|
||||
"($allopts)-restart[Restart E17]" \
|
||||
"($allopts)-shutdown[Shutdown E17]" \
|
||||
"($allopts)-lang-get[Get the current language]" \
|
||||
"($allopts)-lang-list[List all available languages]" \
|
||||
"($allopts)-lang-set[Set the current language]:language:->language" \
|
||||
"($allopts)-binding-mouse-list[List all mouse bindings]" \
|
||||
"($allopts)-binding-mouse-add[Add or replace an existing mouse binding]:context:($contexts):button::modifiers:_values -s \| modifiers $modifiers:'any modifiers' flag:(0 1):action::action parameters:" \
|
||||
"($allopts)-binding-mouse-del[Delete an existing mouse binding]:context:($contexts):button::modifiers:_values -s \| modifiers $modifiers:'any modifiers' flag:(0 1):action::action parameters:" \
|
||||
"($allopts)-binding-key-list[List all key bindings]" \
|
||||
"($allopts)-binding-key-add[Add or replace an existing key binding]:context:($contexts):key::modifiers:_values -s \| modifiers $modifiers:'any modifiers' flag:(0 1):action::action parameters:" \
|
||||
"($allopts)-binding-key-del[Delete an existing key binding]:context:($contexts):key::modifiers:_values -s \| modifiers $modifiers:'any modifiers' flag:(0 1):action::action parameters:" \
|
||||
"-display[Specify X display]:display::" \
|
||||
&& return 0
|
||||
|
||||
local tag description cmd=enlightenment_remote
|
||||
local -a opts
|
||||
|
||||
case $state in
|
||||
available-font)
|
||||
opts=($($cmd -font-available-list | sed 's/.*"\([^"]*\)"/\1/gp;d'))
|
||||
description="font name"
|
||||
tag=fonts
|
||||
;;
|
||||
fallback-font)
|
||||
opts=($($cmd -font-fallback-list | sed 's/.*"\([^"]*\)"/\1/gp;d'))
|
||||
description="font name"
|
||||
tag=fonts
|
||||
;;
|
||||
language)
|
||||
opts=($($cmd -lang-list | sed 's/.*"\([^"]*\)"/\1/gp;d'))
|
||||
description="language"
|
||||
tag=languages
|
||||
;;
|
||||
enabled-module)
|
||||
opts=($($cmd -module-list | sed 's/.*"\([^"]*\)" ENABLED 1.*/\1/gp;d'))
|
||||
description="enabled module"
|
||||
tag=modules
|
||||
;;
|
||||
disabled-module)
|
||||
opts=($($cmd -module-list | sed 's/.*"\([^"]*\)" ENABLED 0/\1/gp;d'))
|
||||
description="disabled module"
|
||||
tag=modules
|
||||
;;
|
||||
unloaded-module)
|
||||
# FIXME: matches all available modules, not just unloaded ones
|
||||
opts=(${^$($cmd -dirs-list modules | sed 's/.*"\([^"]*\)"/\1/gp;d')}/*(N/:t))
|
||||
description="module name"
|
||||
tag=modules
|
||||
;;
|
||||
loaded-module)
|
||||
opts=($($cmd -module-list | sed 's/.*"\([^"]*\)" ENABLED ./\1/gp;d'))
|
||||
description="loaded module"
|
||||
tag=modules
|
||||
;;
|
||||
*)
|
||||
# we should never get here
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
_wanted $tag expl $description compadd -a opts && return 0
|
||||
|
|
@ -1,284 +0,0 @@
|
|||
# $Id$
|
||||
# bash-completion script for enlightenment_remote
|
||||
# By Justin Rocha (Xenith)
|
||||
# Additions by Sebastian Dransfeld
|
||||
|
||||
# TODO:
|
||||
# Add here:
|
||||
# -binding-mouse-add, -binding-mouse-del
|
||||
# -binding-signal-add, -binding-signal-del
|
||||
# -binding-wheel-add, -binding-wheel-del
|
||||
# -desktop-bg-add, -desktop-bg-del
|
||||
# -desktop-name-add, -desktop-name-del
|
||||
|
||||
_enlightenment_remote() {
|
||||
local cur prev opts
|
||||
COMPREPLY=()
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
action=${COMP_WORDS[1]}
|
||||
opts=`enlightenment_remote -h | awk '{print $1}' | grep -v "OPTIONS:" | xargs`
|
||||
BINDING_CONTEXT="NONE BORDER ZONE CONTAINER MANAGER MENU WINLIST POPUP ANY"
|
||||
ENGINE_CONTEXT="INIT CONTAINER ZONE BORDER MENU ERROR WIN POPUP DRAG"
|
||||
MODIFIERS="NONE SHIFT| SHIFT CONTROL| CONTROL ALT| ALT WIN| WIN"
|
||||
DIRS="data images fonts themes init icons modules backgrounds"
|
||||
|
||||
|
||||
case "${action}" in
|
||||
-h|-help|--help)
|
||||
COMPREPLY=($(compgen -W "${opts/-h -help --help}" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-always-click-to-focus-set| \
|
||||
-always-click-to-raise-set| \
|
||||
-border-shade-animate-set| \
|
||||
-edge-flip-set| \
|
||||
-focus-last-focused-per-desktop-set| \
|
||||
-focus-revert-on-hide-or-close-set| \
|
||||
-kill-if-close-not-possible-set| \
|
||||
-kill-process-set| \
|
||||
-modal-windows-set| \
|
||||
-move-info-follows-set| \
|
||||
-pass-click-on-set| \
|
||||
-ping-clients-set| \
|
||||
-resize-info-follows-set| \
|
||||
-transient-*-set| \
|
||||
-use-*-set| \
|
||||
-winlist-list-*-set| \
|
||||
-winlist-scroll-animate-set| \
|
||||
-winlist-warp-at-end-set| \
|
||||
-winlist-warp-while-selecting-set)
|
||||
COMPREPLY=($(compgen -W " 0 1" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-binding-key-add)
|
||||
if [[ ${COMP_CWORD} -eq 2 ]]; then
|
||||
COMPREPLY=($(compgen -W "${BINDING_CONTEXT}" -- "${cur}"))
|
||||
elif [[ ${COMP_CWORD} -eq 3 ]]; then
|
||||
COMPREPLY=()
|
||||
elif [[ ${COMP_CWORD} -eq 4 ]]; then
|
||||
# Find the selected modifiers
|
||||
selected=${cur#\'}
|
||||
selected=$(echo $selected | sed -e 's/\(.*|\)\?.*/\1/')
|
||||
# create updated modifier list
|
||||
if [[ "${selected}" ]]; then
|
||||
for modifier in ${MODIFIERS}; do
|
||||
if ! echo $selected | grep -q $modifier; then
|
||||
curmod="${curmod} ${selected}${modifier}"
|
||||
fi
|
||||
done
|
||||
else
|
||||
curmod=${MODIFIERS}
|
||||
fi
|
||||
|
||||
COMPREPLY=($(compgen -P "'" -S "'" -W "${curmod}" -- "${cur}"))
|
||||
elif [[ ${COMP_CWORD} -eq 5 ]]; then
|
||||
COMPREPLY=($(compgen -W "0 1" -- "${cur}"))
|
||||
elif [[ ${COMP_CWORD} -eq 6 ]]; then
|
||||
actions=$(enlightenment_remote -action-list|grep REPLY:|awk '{print $2}')
|
||||
COMPREPLY=($(compgen -W "${actions}" -- "${cur}"))
|
||||
elif [[ ${COMP_CWORD} -eq 7 ]]; then
|
||||
COMPREPLY=()
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
-binding-key-del)
|
||||
context=${COMP_WORDS[2]}
|
||||
key=${COMP_WORDS[3]}
|
||||
modifiers=${COMP_WORDS[4]}
|
||||
modifiers=${modifiers#\'}
|
||||
modifiers=${modifiers%\'}
|
||||
any_mod=${COMP_WORDS[5]}
|
||||
action=${COMP_WORDS[6]}
|
||||
params=${COMP_WORDS[7]}
|
||||
SIFS=$IFS
|
||||
IFS=$'\n'
|
||||
if [[ ${COMP_CWORD} -eq 2 ]]; then
|
||||
binding=$(enlightenment_remote -binding-key-list|grep 'REPLY:'|sed -e "s/.*CONTEXT=\(\S\+\)\s\+KEY=\"\(\S\+\)\"\s\+MODIFIERS=\(\S\+\)\s\+ANY_MOD=\(\S\+\)\s\+ACTION=\"\(\S\+\)\"\s\+PARAMS=\"\(\S\+\)\".*/'\1 \2 \3 \4 \5 \6'/"|grep -v 'REPLY:')
|
||||
COMPREPLY=($(compgen -W "${binding}" -- "${cur}"))
|
||||
elif [[ ${COMP_CWORD} -eq 3 ]]; then
|
||||
binding=$(enlightenment_remote -binding-key-list|grep 'REPLY:'|sed -e "s/.*CONTEXT=${context}\s\+KEY=\"\(\S\+\)\"\s\+MODIFIERS=\(\S\+\)\s\+ANY_MOD=\(\S\+\)\s\+ACTION=\"\(\S\+\)\"\s\+PARAMS=\"\(\S\+\)\".*/'\1 \2 \3 \4 \5'/"|grep -v 'REPLY:')
|
||||
COMPREPLY=($(compgen -W "${binding}" -- "${cur}"))
|
||||
elif [[ ${COMP_CWORD} -eq 4 ]]; then
|
||||
binding=$(enlightenment_remote -binding-key-list|grep 'REPLY:'|sed -e "s/.*CONTEXT=${context}\s\+KEY=\"${key}\"\s\+MODIFIERS=\(\S\+\)\s\+ANY_MOD=\(\S\+\)\s\+ACTION=\"\(\S\+\)\"\s\+PARAMS=\"\(\S\+\)\".*/'\1 \2 \3 \4'/"|grep -v 'REPLY:')
|
||||
COMPREPLY=($(compgen -W "${binding}" -- "${cur}"))
|
||||
elif [[ ${COMP_CWORD} -eq 5 ]]; then
|
||||
binding=$(enlightenment_remote -binding-key-list|grep 'REPLY:'|sed -e "s/.*CONTEXT=${context}\s\+KEY=\"${key}\"\s\+MODIFIERS=${modifiers}\s\+ANY_MOD=\(\S\+\)\s\+ACTION=\"\(\S\+\)\"\s\+PARAMS=\"\(\S\+\)\".*/'\1 \2 \3'/"|grep -v 'REPLY:')
|
||||
COMPREPLY=($(compgen -W "${binding}" -- "${cur}"))
|
||||
elif [[ ${COMP_CWORD} -eq 6 ]]; then
|
||||
binding=$(enlightenment_remote -binding-key-list|grep 'REPLY:'|sed -e "s/.*CONTEXT=${context}\s\+KEY=\"${key}\"\s\+MODIFIERS=${modifiers}\s\+ANY_MOD=${any_mod}\s\+ACTION=\"\(\S\+\)\"\s\+PARAMS=\"\(\S\+\)\".*/'\1 \2'/"|grep -v 'REPLY:')
|
||||
COMPREPLY=($(compgen -W "${binding}" -- "${cur}"))
|
||||
elif [[ ${COMP_CWORD} -eq 7 ]]; then
|
||||
binding=$(enlightenment_remote -binding-key-list|grep 'REPLY:'|sed -e "s/.*CONTEXT=${context}\s\+KEY=\"${key}\"\s\+MODIFIERS=${modifiers}\s\+ANY_MOD=${any_mod}\s\+ACTION=\"${action}\"\s\+PARAMS=\"\(\S\+\)\".*/'\1'/"|grep -v 'REPLY:')
|
||||
COMPREPLY=($(compgen -W "${binding}" -- "${cur}"))
|
||||
fi
|
||||
IFS=$SIFS
|
||||
return 0
|
||||
;;
|
||||
-border-shade-transition-set)
|
||||
COMPREPLY=($(compgen -W " 0 1 2 3" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-default-bg-set)
|
||||
# TODO Add filename expansion, and only match dirs and .edj files
|
||||
return 0
|
||||
;;
|
||||
-default-engine-set)
|
||||
engines=$(enlightenment_remote -engine-list|grep REPLY:|awk '{print $2}')
|
||||
COMPREPLY=($(compgen -W "${engines}" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-default-profile-set)
|
||||
profiles=$(enlightenment_remote -profile-list|grep REPLY:|awk '{print $2}')
|
||||
COMPREPLY=($(compgen -W "${profiles}" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-dirs-list)
|
||||
COMPREPLY=($(compgen -W "${DIRS}" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-dirs-list-append|-dirs-list-prepend)
|
||||
if [[ ${COMP_CWORD} -eq 2 ]]; then
|
||||
COMPREPLY=($(compgen -W "${DIRS}" -- "${cur}"))
|
||||
elif [[ ${COMP_CWORD} -eq 3 ]]; then
|
||||
# TODO Add filename expansion, and only match dirs
|
||||
COMPREPLY=()
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
-dirs-list-remove)
|
||||
dir=${COMP_WORDS[2]}
|
||||
if [[ ${COMP_CWORD} -eq 2 ]]; then
|
||||
COMPREPLY=($(compgen -W "${DIRS}" -- "${cur}"))
|
||||
elif [[ ${COMP_CWORD} -eq 3 ]]; then
|
||||
dirs=$(enlightenment_remote -dirs-list ${dir}|grep REPLY:|awk '{print $2}')
|
||||
COMPREPLY=($(compgen -W "${dirs}" -- "${cur}"))
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
-display)
|
||||
displays=$(/bin/ls $HOME/.ecore/enlightenment-\(*\)/0|sed -e 's+.*enlightenment-(\(.*\))/.*+\1+')
|
||||
COMPREPLY=($(compgen -W "${displays}" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-engine-set)
|
||||
if [[ ${COMP_CWORD} -eq 2 ]]; then
|
||||
COMPREPLY=($(compgen -W "${ENGINE_CONTEXT}" -- "${cur}"))
|
||||
elif [[ ${COMP_CWORD} -eq 3 ]]; then
|
||||
engines=$(enlightenment_remote -engine-list|grep REPLY:|awk '{print $2}')
|
||||
COMPREPLY=($(compgen -W "DEFAULT ${engines}" -- "${cur}"))
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
-exec-action)
|
||||
if [[ ${COMP_CWORD} -eq 2 ]]; then
|
||||
actions=$(enlightenment_remote -action-list|grep REPLY:|awk '{print $2}')
|
||||
COMPREPLY=($(compgen -W "${actions}" -- "${cur}"))
|
||||
elif [[ ${COMP_CWORD} -eq 3 ]]; then
|
||||
COMPREPLY=()
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
-focus-policy-set)
|
||||
COMPREPLY=($(compgen -W "CLICK MOUSE SLOPPY" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-focus-setting-set)
|
||||
COMPREPLY=($(compgen -W "NONE NEW_WINDOW NEW_DIALOG NEW_DIALOG_IF_OWNER_FOCUSED" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-font-default-get|-font-default-remove)
|
||||
classes=$(enlightenment_remote -font-default-list|grep REPLY:|sed -e 's/.*TEXT_CLASS=\"\(\S\+\)\".*/\1/')
|
||||
COMPREPLY=($(compgen -W "${classes}" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-font-default-set)
|
||||
if [[ ${COMP_CWORD} -eq 2 ]]; then
|
||||
classes=$(enlightenment_remote -font-default-list|grep REPLY:|sed -e 's/.*TEXT_CLASS=\"\(\S\+\)\".*/\1/')
|
||||
COMPREPLY=($(compgen -W "${classes}" -- "${cur}"))
|
||||
elif [[ ${COMP_CWORD} -eq 3 ]]; then
|
||||
fonts=$(enlightenment_remote -font-available-list|grep REPLY:|awk '{print $2}')
|
||||
COMPREPLY=($(compgen -W "${fonts}" -- "${cur}"))
|
||||
elif [[ ${COMP_CWORD} -eq 4 ]]; then
|
||||
COMPREPLY=()
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
-font-fallback-remove)
|
||||
fonts=$(enlightenment_remote -font-fallback-list|grep REPLY:|awk '{print $2}')
|
||||
COMPREPLY=($(compgen -W "${fonts}" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-fullscreen-policy-set)
|
||||
COMPREPLY=($(compgen -W "RESIZE ZOOM" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-lang-set)
|
||||
languages=$(enlightenment_remote -lang-list|grep REPLY:|awk '{print $2}')
|
||||
COMPREPLY=($(compgen -W "${languages}" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-maximize-policy-set)
|
||||
COMPREPLY=($(compgen -W "FULLSCREEN SMART EXPAND FILL" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-module-enable)
|
||||
modules=$(enlightenment_remote -module-list|grep REPLY:|grep 0$|awk '{print $2}')
|
||||
COMPREPLY=($(compgen -W "${modules}" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-module-disable)
|
||||
modules=$(enlightenment_remote -module-list|grep REPLY:|grep 1$|awk '{print $2}')
|
||||
COMPREPLY=($(compgen -W "${modules}" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-module-load)
|
||||
extra_dir=$(pkg-config --variable=modules enlightenment)
|
||||
# This is a hack. pkg-config should return extra dir and standard dir
|
||||
dir=${extra_dir%_extra}
|
||||
modules=$(cd ${dir} && /bin/ls && cd ${extra_dir} && /bin/ls)
|
||||
COMPREPLY=($(compgen -W "${modules}" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-module-unload)
|
||||
modules=$(enlightenment_remote -module-list|grep REPLY:|awk '{print $2}')
|
||||
COMPREPLY=($(compgen -W "${modules}" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-profile-del)
|
||||
profiles=$(enlightenment_remote -profile-list|grep REPLY:|awk '{print $2}')
|
||||
COMPREPLY=($(compgen -W "${profiles}" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-theme-get|-theme-remove)
|
||||
theme_categories=$(enlightenment_remote -theme-category-list|grep REPLY:|awk '{print $2}')
|
||||
COMPREPLY=($(compgen -W "${theme_categories}" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-theme-set)
|
||||
if [[ ${COMP_CWORD} -eq 2 ]]; then
|
||||
theme_categories=$(enlightenment_remote -theme-category-list|grep REPLY:|awk '{print $2}')
|
||||
COMPREPLY=($(compgen -W "${theme_categories}" -- "${cur}"))
|
||||
elif [[ ${COMP_CWORD} -eq 3 ]]; then
|
||||
# TODO Add filename expansion, and only match dirs and .edj files
|
||||
COMPREPLY=()
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
-transition-*-set)
|
||||
transitions=$(enlightenment_remote -transition-list|grep REPLY:|awk '{print $2}')
|
||||
COMPREPLY=($(compgen -W "${transitions}" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-window-placement-policy-set)
|
||||
COMPREPLY=($(compgen -W "SMART CURSOR MANUAL" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ "${cur}" == -* ]] || [[ ${COMP_CWORD} -eq 1 ]]; then
|
||||
COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
|
||||
fi
|
||||
}
|
||||
complete -F _enlightenment_remote enlightenment_remote
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
|
||||
my $new_item = 0;
|
||||
my $in_body = 0;
|
||||
my $is_title = 0;
|
||||
|
||||
# this hash is like this
|
||||
#
|
||||
# hash<str, arr<hash<str,str>>>
|
||||
#
|
||||
# [title1] -> [ (item1, asignee1), (item2, asignee2) ]
|
||||
# [title2] -> [ (item1, asignee1) ]
|
||||
#
|
||||
my %todo_hash;
|
||||
my $title;
|
||||
my $item = {};
|
||||
|
||||
# use globals
|
||||
sub push_item {
|
||||
if ($item->{'task'}) {
|
||||
my $task = $item->{'task'};
|
||||
$task =~ s/^\* //;
|
||||
if ($task =~ s/<(.*)>//) {
|
||||
$item->{'asignee_email'} = $1;
|
||||
$1 =~ /(.*) AT /;
|
||||
$item->{'asignee'} = $1;
|
||||
} else {
|
||||
$item->{'asignee_email'} = 0;
|
||||
$item->{'asignee'} = 'None';
|
||||
}
|
||||
$item->{'task'} = $task;
|
||||
push(@{$todo_hash{$title}}, $item);
|
||||
}
|
||||
}
|
||||
|
||||
while(<>) {
|
||||
chomp;
|
||||
|
||||
if(/\[\[\[/) {
|
||||
$item->{'task'} = 0;
|
||||
$in_body = 1;
|
||||
} elsif (/\]\]\]/) {
|
||||
if ($in_body) {
|
||||
push_item;
|
||||
$item = {};
|
||||
$in_body = 0;
|
||||
}
|
||||
} elsif (/^---.*---$/) {
|
||||
if ($in_body) {
|
||||
if($is_title) {
|
||||
$is_title = 0;
|
||||
} else {
|
||||
$is_title = 1;
|
||||
}
|
||||
}
|
||||
} elsif (/^\* /) {
|
||||
if ($in_body ) {
|
||||
push_item;
|
||||
$item = {};
|
||||
$item->{'task'} = $_ ;
|
||||
}
|
||||
} else {
|
||||
if ($in_body) {
|
||||
if ($is_title) {
|
||||
$title = $_;
|
||||
} else {
|
||||
$item->{'task'} = $item->{'task'} . $_ ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for $title ( keys %todo_hash ) {
|
||||
my $count = 1;
|
||||
print "<h2>" . $title . "</h2>\n";
|
||||
|
||||
print "<table>\n";
|
||||
print " <tr><td>#</td><td>Asignee</td><td>Task</td></tr>\n";
|
||||
for $item ( @{$todo_hash{$title}} ) {
|
||||
my $asignee_email = $item->{'asignee_email'};
|
||||
my $asignee = $item->{'asignee'};
|
||||
my $task = $item->{'task'};
|
||||
|
||||
my $mailto;
|
||||
|
||||
if ($asignee_email) {
|
||||
$mailto = "<a href='mailto://$asignee_email'>$asignee</a>"
|
||||
} else {
|
||||
$mailto = $asignee;
|
||||
}
|
||||
print " <tr><td>$count</td><td>$mailto</td><td>$task</td></tr>\n";
|
||||
$count++;
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
Loading…
Reference in New Issue