Skip to content

Commit

Permalink
Merge ac4a2b6 into 3553e71
Browse files Browse the repository at this point in the history
  • Loading branch information
hfjn committed Jul 5, 2019
2 parents 3553e71 + ac4a2b6 commit e3e7bbe
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 9 deletions.
10 changes: 1 addition & 9 deletions .pre-commit-config.yaml
Expand Up @@ -12,12 +12,4 @@ repos:
- id: check-merge-conflict
- id: check-yaml
- id: trailing-whitespace
exclude: .*\.md$
- repo: local
hooks:
- id: shell-lint
name: Shell Syntax Check
description: Check Shell Syntax on ALL staged files with user friendly messages and colors
entry: .pre-commit-hooks/shell-lint.sh
language: script
types: [shell]
exclude: .*\.md$
28 changes: 28 additions & 0 deletions auto_completion.sh
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# Inspired by: https://qone.io/python/bash/zsh/2016/04/24/python-click-auto-complete-bash-zsh.html

if [[ $(basename $SHELL) = 'bash' ]];
then
if [[ -f ~/.bashrc ]];
then
echo "Installing bash autocompletion..."
grep -q 'esque-autocompletion' ~/.bashrc
if [[ $? -ne 0 ]]; then
echo "" >> ~/.bashrc
echo 'eval "$(_ESQUE_COMPLETE=source esque)"' >> ~/.esque-autocompletion.sh
echo "source ~/.esque-autocompletion.sh" >> ~/.bashrc
fi
fi
elif [[ $(basename $SHELL) = 'zsh' ]];
then
if [[ -f ~/.zshrc ]];
then
echo "Installing zsh autocompletion..."
grep -q 'esque-autocompletion' ~/.zshrc
if [[ $? -ne 0 ]]; then
echo "" >> ~/.zshrc
echo 'eval "$(_ESQUE_COMPLETE=source_zsh esque)"' >> ~/.esque-autocompletion.zsh
echo "source ~/.esque-autocompletion.zsh" >> ~/.zshrc
fi
fi
fi
13 changes: 13 additions & 0 deletions setup.py
Expand Up @@ -3,8 +3,10 @@
import codecs
import os
import sys
from subprocess import call

from setuptools import find_packages, setup
from setuptools.command.install import install

here = os.path.abspath(os.path.dirname(__file__))

Expand All @@ -31,6 +33,16 @@
"pyyaml",
]


class PostInstallCommand(install):
"""Post-installation for installation mode."""

def run(self):
install.run(self)
print("installing auto completion")
call(["./auto_completion.sh"])


setup(
name="esque",
version=about["__version__"],
Expand Down Expand Up @@ -61,4 +73,5 @@
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
],
cmdclass={"install": PostInstallCommand},
)

0 comments on commit e3e7bbe

Please sign in to comment.