241 Commits

Author SHA1 Message Date
Olivier Mangin
3e31c4455e Fixes argument and adds tests for overwrite on import. 2017-12-11 15:49:06 -05:00
Dennis Wilson
1cd95bdeec overwrite argument on import 2017-12-11 15:28:56 -05:00
Bill Flynn
0c7ba85af9 Revisions subject to comments on PR #100
Additionally, reverted FakeSystemExit subclassing Exception, but added
an explicit __init__ so that we can emulate the SystemExit.code
functionality without having to change the superclass.
2017-12-08 17:49:19 -05:00
Bill Flynn
66c90c5d43 Added unittest to cover new behavior pubs
Unittest just checks that both `pubs` and `pubs --help` raise a
`SystemExit` exception with error code 0.  Due to how argparse
handles the `--help` keyword, this is the best way I could think to
provide test coverage without heavily modifying the parser structure
or the unittest infrastructure.

To ensure the `pubs` matches the behavior of `pubs --help`, it now
raises the same `SystemExit(0)` exception via `sys.exit(0)`.  And
in order to catch it in the unittest, I had to modify the
`FakeSystemExit` behavior slightly.
2017-11-30 14:48:50 -05:00
Bill Flynn
ac3a8d8bf2 Print help menu when no subcommands applied
Made subparsers not required in the main parser, but if no commands are parsed,
then the parser prints its help.  When a command is present, the normal
functionality preserved.

Removed the single unittest that checks for this exact behavior.
2017-11-28 17:32:13 -05:00
Olivier Mangin
5676cb49a9
Merge pull request #96 from pubs/fix/content
Fixes content not read from urls because of call to `os.abspath`
2017-11-02 13:45:23 -04:00
Olivier Mangin
66b51997ea Fix defaults not used in config.
Basically the validation takes care of setting results that
post-processing was relying on. Hence the validation should occur before
the postprocessing. It actually makes more sense to validate within
post-process.
2017-10-19 16:40:45 -04:00
Olivier Mangin
6a26216c3e COSMIT 2017-10-19 15:46:42 -04:00
Olivier Mangin
a65873a7e0 Fixes abspath called on urls preventing to get content from url.
Fix #7
2017-10-19 15:40:58 -04:00
Olivier Mangin
47f5c918ea Fix #93: saves the modifications on edit -m. 2017-10-17 16:50:23 -04:00
Olivier Mangin
922781a89a Moves shell_quote import out of p3.py 2017-10-03 22:53:08 -04:00
Olivier Mangin
5c74f942c4 [Fix #88] Adds proper escaping for arguments in alias plugin. 2017-09-28 17:34:32 -04:00
Olivier Mangin
be3c124079 Fix update code. 2017-08-06 18:58:45 -04:00
Olivier Mangin
d40b86a9cf Updates version everywhere. 2017-08-06 18:58:45 -04:00
Fabien C. Y. Benureau
6cccc021f8 Minor fix for isbn2index docstring 2017-08-06 18:02:24 -04:00
Fabien C. Y. Benureau
0942df3b50 Fix pubs conf command 2017-08-01 23:43:06 -04:00
Olivier Mangin
38fc68adbc Refactors filebroker to remove file duplication. 2017-07-22 13:35:13 -04:00
Olivier Mangin
983d1892e0 Removes unused imports. 2017-07-22 13:35:13 -04:00
Olivier Mangin
7b19a9dcdd Forces utf8 when no encoding in header for DOI request.
The default behavior from the requests library is to use the guess from
chardet which is not always reliable while doi.org seems to always
return utf8 encoded data. It's unlikely that this changes without also
updating the header.
2017-07-22 13:35:13 -04:00
Olivier Mangin
cf596206b0 FIX: Encode unicode before writing to file in python2.
This is necessary because _open returns a file descriptor in binary mode
for python2.
2017-07-22 13:35:13 -04:00
Olivier Mangin
81f2661593 Cosmit 2017-07-22 13:35:13 -04:00
Fabien C. Y. Benureau
1f224a90c7 Fixes websearch in Python 3 (fix #69) 2017-07-17 15:42:06 +02:00
Olivier Mangin
4ffd62fe9f [notes] Allow different file extension for note file (see #70). 2017-07-12 10:41:51 -04:00
Olivier Mangin
323fb8b674 Fixes indent and removes unused io import. 2017-07-11 17:13:39 -04:00
Fabien C. Y. Benureau
3b4cfe635d Fix tests for Python 2
Also, some cleanup in fake_env.py
2017-07-11 17:08:53 -04:00
Fabien C. Y. Benureau
66a91b3c0c Fix content._open for Python 2 2017-07-11 17:08:53 -04:00
Olivier Mangin
e129398311 Pass the config to plugins on parser modification to allow completion. 2017-07-08 00:10:15 -04:00
Olivier Mangin
92fb403871 Fix function in FakeModule. 2017-07-08 00:10:15 -04:00
Olivier Mangin
ce3ed1e52f Use ImportError for older python versions. 2017-07-08 00:10:15 -04:00
Olivier Mangin
e1a6ad2167 Adds basic tag completion. 2017-07-08 00:10:15 -04:00
Olivier Mangin
02c11aaaea Adds completion for citekeys. 2017-07-08 00:10:15 -04:00
Olivier Mangin
a5466c940e Prepare configuration loading for autocomplete.
In particular, tries to load configuration when no argument is given.
Also removes unused check option from load_conf.
2017-07-08 00:10:15 -04:00
Olivier Mangin
f6e0412306 Missing import in update. 2017-07-08 00:10:15 -04:00
Olivier Mangin
af73d4ed64 Basic autocompletion with argcomplete.
Only support pubs command completion.
2017-07-08 00:10:15 -04:00
Olivier Mangin
559d486236 Fix path not expanded for edit_file command.
In particular the issue was preventing notes from being edited.
2017-07-08 00:09:21 -04:00
Olivier Mangin
d7e25d07eb Merge pull request #62 from d9w/pr1
Fixes default message for errors bug
2017-05-24 14:04:39 -04:00
Olivier Mangin
4ff87085ae Config spec update for empty editor value. 2017-05-24 13:58:04 -04:00
Olivier Mangin
6c2f0f6f8d Moves editor commands to ui to avoid using with wrong editor values.
For now, the editor_input and edit_file functions do not make sense
outside of the context of an ui. Having them in the content module
was confusing. (See issue fixed by a600855.)
2017-05-24 13:51:02 -04:00
Olivier Mangin
a600855c31 Fix calls to edit_file with wrong editor in conf and note commands.
Also replaces fix from PR #63.
2017-05-24 13:45:24 -04:00
Dennis Wilson
fbff9cd94c default message for errors bugfix 2017-05-24 14:18:39 +02:00
Olivier Mangin
a02f67f133 Minor improvement of error handling.
Also removes ignore of broken pipe from 5ca090668 since this is not
handling it the right way (see #60).
2017-05-11 15:49:35 -04:00
Olivier Mangin
d4c18ad1a4 Fixes #49. 2017-05-11 15:34:14 -04:00
Tyler Earnest
d465c35e89 fixed inverted conditional 2017-05-05 16:50:06 -05:00
Olivier Mangin
70e1169fe7 Simplifies test if binary mode. 2017-04-14 20:14:15 -04:00
Fabien C. Y. Benureau
0f84268ebf Honor custom pubsdoc in config 2016-06-06 00:25:27 +02:00
Fabien C. Y. Benureau
2aad93b526 Simplify, update the testsuite
Replace the in-house stubbing by the facilities offered
by pyfakefs for running tests. We don't use `io.open`
anymore, because pyfakefs does not stub it correctly.
We rely on a patched version of pyfakefs, as a few bug
remain in the official repo.
2016-06-05 21:48:19 +02:00
Olivier Mangin
2859e4bc62 More refactoring to remove code duplication. Also adds tests. 2016-02-02 21:21:24 -05:00
Olivier Mangin
57a32e5601 Removes some code duplication. 2016-02-02 19:06:34 -05:00
Fabien Benureau
d9f24052fc Update bs4 code; removes warning 2016-01-31 06:57:04 +01:00
Fabien Benureau
22c7acde99 Rewrite cache in case of any problem 2016-01-23 02:31:20 +01:00