Skip to content

Commit

Permalink
cli: Add support for bash-completion for xkcd-pass.
Browse files Browse the repository at this point in the history
Fixes #10.
  • Loading branch information
adambirds committed May 1, 2021
1 parent 75c273d commit 41fa7de
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 6 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ jobs:
sudo tools/setup/install-shfmt
- name: Install Python dependencies
uses: py-actions/py-dependency-install@v2
with:
path: "requirements/dev.txt"
- name: Run unittests
run: |
PYTHONPATH=src pytest
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ jobs:
sudo tools/setup/install-shfmt
- name: Install Python dependencies
uses: py-actions/py-dependency-install@v2
with:
path: "requirements/dev.txt"
- name: Generate coverage report
run: |
PYTHONPATH=src pytest --cov=./ --cov-report=xml
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ jobs:
sudo tools/setup/install-shfmt
- name: Install Python dependencies
uses: py-actions/py-dependency-install@v2
with:
path: "requirements/dev.txt"
- name: Run unittests
run: |
PYTHONPATH=src pytest
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,19 @@ A full overview of the available options can be accessed by running following co
xkcd-pass --help
```

## Bash-Completion
`xkcd-pass` also supports bash-completion. To set this up you need to add the below to your `.bashrc` file:

```
eval "$(register-python-argcomplete xkcd-pass)"
```

This will then take effect the next time you login. To enable bash-completion immediately, you can run:

```
source .bashrc
```

## Word Lists

Several word lists are provided with the package. The default, eff-long, was specifically designed by the EFF for [passphrase generation](https://www.eff.org/deeplinks/2016/07/new-wordlists-random-passphrases) and is licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/us/). As it was originally intended for use with Diceware ensure that the number of words in your passphrase is at least six when using it. Two shorter variants of that list, eff-short and eff-special, are also included. Please refer to the EFF documentation linked above for more information.
Expand Down
2 changes: 2 additions & 0 deletions requirements/dev.txt → requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
argcomplete

build
https://github.com/zulip/zulint/archive/6cc46d23906757895e917cc75e231f81f824a31d.zip#egg=zulint==0.0.1
pytest
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()

install_requires = ["argcomplete"]
setuptools.setup(
name="xkcd-pass",
version="1.0.9",
Expand All @@ -26,4 +27,5 @@
packages=setuptools.find_packages(where="src"),
include_package_data=True,
python_requires=">=3.6",
install_requires=install_requires,
)
3 changes: 3 additions & 0 deletions src/xkcd_pass/xkcd_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from io import open
from typing import Any, Callable, Dict, List, Optional, Union

import argcomplete

from xkcd_pass.lib.case import (
case_alternating,
case_capitalize,
Expand Down Expand Up @@ -489,6 +491,7 @@ def main() -> int:
try:
parser = xkcd_passArgumentParser()

argcomplete.autocomplete(parser)
options = parser.parse_args()
options.testing = False
validate_options(options)
Expand Down

0 comments on commit 41fa7de

Please sign in to comment.