Merge pull request #130 from pubs/feat/tag_completion_in_add
Adds tag list completion in `pubs add -t `
This commit is contained in:
commit
a2af1ce4a5
50
.travis.yml
50
.travis.yml
@ -1,27 +1,43 @@
|
|||||||
os:
|
# list of environments to test
|
||||||
- linux
|
|
||||||
language: python
|
|
||||||
python:
|
|
||||||
- "2.7"
|
|
||||||
- "3.3"
|
|
||||||
- "3.4"
|
|
||||||
- "3.5"
|
|
||||||
- "3.6"
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- language: generic
|
- os: linux
|
||||||
os: osx
|
language: python
|
||||||
python:
|
python: 2.7
|
||||||
- "3"
|
- os: linux
|
||||||
|
language: python
|
||||||
|
python: 3.3
|
||||||
|
- os: linux
|
||||||
|
language: python
|
||||||
|
python: 3.4
|
||||||
|
- os: linux
|
||||||
|
language: python
|
||||||
|
python: 3.5
|
||||||
|
- os: linux
|
||||||
|
language: python
|
||||||
|
python: 3.6
|
||||||
|
- os: osx
|
||||||
|
language: generic
|
||||||
|
python: 2.7
|
||||||
|
before_install:
|
||||||
|
- python2 --version
|
||||||
|
- pip2 install -U virtualenv
|
||||||
|
- virtualenv env -p python2
|
||||||
|
- source env/bin/activate
|
||||||
|
- os: osx
|
||||||
|
language: generic
|
||||||
|
python: ">=3.6"
|
||||||
before_install:
|
before_install:
|
||||||
- brew update
|
- brew update
|
||||||
- brew outdated python3 || brew install python3 || brew upgrade python3
|
- brew outdated python3 || brew install python3 || brew upgrade python3
|
||||||
- pip install -U virtualenv
|
- python3 -m venv env
|
||||||
- virtualenv env -p python3
|
|
||||||
- source env/bin/activate
|
- source env/bin/activate
|
||||||
|
|
||||||
# command to install dependencies
|
# command to install dependencies
|
||||||
install:
|
install:
|
||||||
- "pip install -r tests/requirements.txt"
|
- python --version
|
||||||
- "python setup.py install"
|
- pip install -r tests/requirements.txt
|
||||||
|
- python setup.py install
|
||||||
|
|
||||||
# command to run tests
|
# command to run tests
|
||||||
script: python -m unittest discover
|
script: python -m unittest discover
|
||||||
|
@ -6,9 +6,9 @@ from .. import repo
|
|||||||
from .. import paper
|
from .. import paper
|
||||||
from .. import templates
|
from .. import templates
|
||||||
from .. import apis
|
from .. import apis
|
||||||
from .. import color
|
|
||||||
from .. import pretty
|
from .. import pretty
|
||||||
from .. import utils
|
from .. import utils
|
||||||
|
from ..completion import CommaSeparatedTagsCompletion
|
||||||
|
|
||||||
|
|
||||||
class ValidateDOI(argparse.Action):
|
class ValidateDOI(argparse.Action):
|
||||||
@ -26,7 +26,8 @@ def parser(subparsers, conf):
|
|||||||
parser.add_argument('-I', '--isbn', help='isbn number to retrieve the bibtex entry, if it is not provided', default=None)
|
parser.add_argument('-I', '--isbn', help='isbn number to retrieve the bibtex entry, if it is not provided', default=None)
|
||||||
parser.add_argument('-d', '--docfile', help='pdf or ps file', default=None)
|
parser.add_argument('-d', '--docfile', help='pdf or ps file', default=None)
|
||||||
parser.add_argument('-t', '--tags', help='tags associated to the paper, separated by commas',
|
parser.add_argument('-t', '--tags', help='tags associated to the paper, separated by commas',
|
||||||
default=None)
|
default=None
|
||||||
|
).completer = CommaSeparatedTagsCompletion(conf)
|
||||||
parser.add_argument('-k', '--citekey', help='citekey associated with the paper;\nif not provided, one will be generated automatically.',
|
parser.add_argument('-k', '--citekey', help='citekey associated with the paper;\nif not provided, one will be generated automatically.',
|
||||||
default=None)
|
default=None)
|
||||||
parser.add_argument('-L', '--link', action='store_false', dest='copy', default=True,
|
parser.add_argument('-L', '--link', action='store_false', dest='copy', default=True,
|
||||||
|
@ -59,6 +59,11 @@ class TagModifierCompletion(BaseCompleter):
|
|||||||
return [partial_expr + t for t in tags if t.startswith(t_prefix)]
|
return [partial_expr + t for t in tags if t.startswith(t_prefix)]
|
||||||
|
|
||||||
|
|
||||||
|
class CommaSeparatedTagsCompletion(TagModifierCompletion):
|
||||||
|
|
||||||
|
regxp = r"[^,]*$"
|
||||||
|
|
||||||
|
|
||||||
class CommaSeparatedListCompletion(BaseCompleter):
|
class CommaSeparatedListCompletion(BaseCompleter):
|
||||||
|
|
||||||
values = []
|
values = []
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# those are the additional packages required to run the tests
|
# those are the additional packages required to run the tests
|
||||||
six
|
six
|
||||||
pyfakefs
|
pyfakefs==3.3
|
||||||
ddt
|
ddt
|
||||||
|
Loading…
x
Reference in New Issue
Block a user