-
-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1493 from saulpw/develop
Prep for v2.10 release
- Loading branch information
Showing
65 changed files
with
1,485 additions
and
926 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: visidata-ci-build | ||
on: | ||
pull_request: | ||
branches: | ||
- stable | ||
- develop | ||
push: | ||
branches: | ||
- stable | ||
- develop | ||
|
||
jobs: | ||
run-tests: | ||
|
||
strategy: | ||
matrix: | ||
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"] | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.pythonversion }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Create .visidatarc | ||
run: touch ~/.visidatarc | ||
|
||
- name: Set up Environment | ||
run: | | ||
export PYTHONPATH=~/visidata:~/visidata/visidata | ||
locale | ||
- name: Install Base VisiData | ||
run: pip3 install . | ||
|
||
- name: Ensure VisiData works with Base Dependencies | ||
run: vd --version | ||
|
||
- name: Install optional dependencies | ||
run: | | ||
pip3 install -r requirements.txt | ||
pip3 install pytest | ||
- name: Run test_commands | ||
run: | | ||
pytest -sv visidata/tests/test_commands.py | ||
- name: Run Cmdlog Tests | ||
run: dev/test.sh | ||
shell: bash | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ visidata.egg-info/ | |
tags | ||
/tests/log/ | ||
# Mac files | ||
.DS_Store | ||
.DS_Store | ||
.direnv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#compdef vd visidata | ||
|
||
(( $+functions[_vd_files] )) || | ||
_vd_files () { | ||
case $PREFIX in | ||
(*) _files $* ;; | ||
esac | ||
case $PREFIX in | ||
(+) _message -e 'toplevel:subsheet:col:row' ;; | ||
(+<1->) _message -e 'toplevel' ;; | ||
(+<1->:) _message -e 'subsheet' ;; | ||
(+<1->:<1->:) _message -e 'col' ;; | ||
(+<1->:<1->:<1->:) _message -e 'row' ;; | ||
esac | ||
} | ||
|
||
_arguments -S \ | ||
{{flags}} \ | ||
'(-p --play -w --replay-wait -b --batch -o --output --replay-movement)*:file:_vd_files' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env python | ||
from __future__ import unicode_literals | ||
|
||
import os | ||
from os.path import dirname as dirn | ||
import sys | ||
import re | ||
|
||
sys.path.insert(0, dirn(dirn((os.path.abspath(__file__))))) | ||
from visidata import vd | ||
from visidata.main import option_aliases | ||
|
||
ZSH_COMPLETION_FILE = "_visidata" | ||
ZSH_COMPLETION_TEMPLATE = "dev/zsh-completion.in" | ||
pat_class = re.compile("'(.*)'") | ||
pat_select = re.compile("^\([^)]*\)") | ||
|
||
|
||
def generate_completion(opt): | ||
prefix = "--" + opt.name | ||
shortnames = [key for key, value in option_aliases.items() if value[0] == opt.name] | ||
if len(shortnames): | ||
if len(shortnames[0]) == 1: | ||
shortname = "-" + shortnames[0] | ||
else: | ||
shortname = "--" + shortnames[0] | ||
prefix = "{" + f"{shortname},{prefix}" + "}" | ||
if isinstance(opt.value, bool): | ||
completion = "" | ||
else: | ||
completion = ":" + pat_class.findall(str(opt.value.__class__))[0] | ||
if opt.name in ["play", "output", "visidata_dir", "config"]: | ||
completion += ":_files" | ||
elif opt.name in ["plugins_url", "motd_url"]: | ||
completion += ":_urls" | ||
helpstr = opt.helpstr.replace("[", "\\[").replace("]", "\\]") | ||
selections = pat_select.findall(helpstr) | ||
if len(selections): | ||
completion += f":{selections[0].replace('/', ' ')}" | ||
# TODO: use `zstyle ':completion:*' extra-verbose true` | ||
# to control the display of default value | ||
helpstr = helpstr + f" (default: {opt.value})" | ||
return f"{prefix}'[{helpstr}]{completion}'" | ||
|
||
|
||
flags = [generate_completion(vd._options[opt]["default"]) for opt in vd._options] | ||
|
||
with open(ZSH_COMPLETION_TEMPLATE) as f: | ||
template = f.read() | ||
|
||
template = template.replace("{{flags}}", " \\\n ".join(flags)) | ||
|
||
with open(ZSH_COMPLETION_FILE, "w") as f: | ||
f.write(template) |
Oops, something went wrong.