2 Commits
Author SHA1 Message Date
DrClaw fb4b41e2ff Unbound mod variable 2020-02-19 01:59:09 +01:00
DrClaw 16f1bef125 Autocompletion & Makefile 2020-02-19 00:28:43 +01:00
3 changed files with 25 additions and 1 deletions
+10
View File
@@ -0,0 +1,10 @@
all:
@echo -e "\n\033[1;36m --> Installing the module ...\033[0m\n"
pip install --user -e .
@echo -ne "\n\033[1;36m"; \
read -p " --> Install autocompletion ?[Y|n] " RESP; \
echo -e "\n\033[0m"; \
case "$$RESP" in \
y*|Y*|"")sudo cp -v completion.bash /usr/share/bash-completion/completions/shlax;; \
*);; \
esac;
+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/bash
_action(){
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
if [[ "$COMP_CWORD" -eq 1 ]] ; then
COMPREPLY=($(compgen -W "$(ls shlax/repo/*.py | sed s/^.*\\/\// | cut -d "." -f 1)" "${cur}"))
else
action=$(grep "^[^ #)]\w* =" shlax/repo/${COMP_WORDS[1]}.py | cut -d " " -f 1)
COMPREPLY=($(compgen -W "$action" "${cur}"))
fi
}
complete -F _action shlax
+1 -1
View File
@@ -33,10 +33,10 @@ class ConsoleScript(cli2.ConsoleScript):
self.exit_code = 1 self.exit_code = 1
return return
shlaxfile = mod.__file__ shlaxfile = mod.__file__
self._doc = inspect.getdoc(mod)
self.shlaxfile = Shlaxfile() self.shlaxfile = Shlaxfile()
self.shlaxfile.parse(shlaxfile) self.shlaxfile.parse(shlaxfile)
self._doc = inspect.getdoc(mod)
if 'main' in self.shlaxfile.actions: if 'main' in self.shlaxfile.actions:
action = self.shlaxfile.actions['main'] action = self.shlaxfile.actions['main']
for name, child in self.shlaxfile.actions['main'].menu.items(): for name, child in self.shlaxfile.actions['main'].menu.items():