455 Commits

Author SHA1 Message Date
Olivier Mangin
ecb1910084 Better error message on UnicodeDecodeError for reading text file.
Also renames read_file to read_text_file which is what is implemented.
Fixes #51.
2016-01-15 19:02:56 -05:00
Olivier Mangin
348bd6d64b FIX wrong access to debug configuration value.
Also adds the option to the config spec.
2016-01-15 19:02:56 -05:00
Olivier Mangin
ed2bbb4498 Removes generic handling of errors from commands.
The default behavior for commands is now to only catch exceptions that
must be handled specifically. This includes outputting a context
dependant message, cleaning up, etc. All other exceptions will be
handled by the ui.
2016-01-15 19:02:56 -05:00
Olivier Mangin
df8f0e6d6b FIX error handler.
Also fix alignments.
2016-01-15 19:02:56 -05:00
Olivier Mangin
6366f4bd01 Uses exception __string__, not __repr__ to carry message. 2016-01-15 19:02:56 -05:00
Olivier Mangin
b12c6297f0 Adds exception catching in main command. 2016-01-15 19:02:56 -05:00
Olivier Mangin
7f6dde2f0c Temporary fix ExpectedFailure does not handle SystemExit on python 2.
Actually the test not only is expected to fail but it misses a file
which causes an error instead of a failure on python 2. Should be
addressed by #25.
2016-01-15 19:02:56 -05:00
Olivier Mangin
e3df872e65 Updates for new version of pyfakefs.
Modules should now be imported from the pyfakefs package.
2016-01-15 19:02:43 -05:00
Olivier Mangin
9d0a800d8b Cleans up old imports of ConfigParser. 2016-01-15 16:45:06 -05:00
Fabien Benureau
3e3a671837 Remove bibtexparser unicode conversion
It was transforming "\&" into "&", rendering the output of
pubs export unsuitable for latex rendering.
2016-01-10 23:00:44 +01:00
Fabien Benureau
a5a653becd Support old bibtexparser keywords
So previous commit 666941d471 broke the current pip version
of bibtexparser (0.6.2), which does not have a
homegeneize_fields keyword. My bad and fixed!
2016-01-10 22:15:24 +01:00
Fabien Benureau
2db80c66ae Add volume to field ordering
Fix #40, which was annoying.
Any implementation of #33 should watch out for this.
2016-01-10 22:08:23 +01:00
Fabien Benureau
666941d471 Set bibtexparser homogenize_fields to True
The default changed from True to False. It is not explicitly set.
2016-01-10 22:04:58 +01:00
Fabien Benureau
98a2f1d646 Fix quadratic output in export 2016-01-10 19:40:01 +01:00
Fabien Benureau
a702d86a74 Make pubs doc subparsers required
Before, `pubs doc` alone would just exit without printing any help
2016-01-07 14:09:22 +01:00
Fabien Benureau
82c93cf695 Predefined themes and a color bash script
Fix: #44
2016-01-07 14:02:43 +01:00
Fabien Benureau
78c562d640 256 colors support
+ The colors name's are the number 0 through 255.
+ Old names still work.
+ Add `magenta` color, wrongly named `purple` before.
+ Adds `white`, `darkgrey`.
+ grey/gray spelling

Also removed italics as a default option for publisher.

Related: #44
2016-01-07 14:02:43 +01:00
Olivier Mangin
87346707be FIX discrepancy in readme. 2016-01-06 23:56:55 -05:00
Fabien Benureau
ec98221d1c Sanitize one-liner strings
Fixes #26
2015-12-26 17:23:26 +01:00
Fabien Benureau
b6e8139bc3 Remove extraneous doc message 2015-12-20 22:22:11 +01:00
Fabien Benureau
b2ebc67f5e Handle Unicode BOM in bibfile
In particular, xml2bib file created without the `-nb` options would trip bibtexparser.

Fixes #23
2015-12-20 22:20:01 +01:00
Fabien Benureau
220e5ad9a8 Fix tests for python 3 2015-12-20 19:26:33 +01:00
Fabien Benureau
69dc3a1690 Parsing error displays bibdata 2015-12-20 18:55:23 +01:00
Fabien Benureau
3b0ba0bb3c Test for leading space in citekeys
This test is expected to fail. Nose does not handle that yet (treats it as false).
As such, changes have been made to make tests discoverable by unittest.
You may want to uninstall nose and do something like:
alias nosetests="python -m unittest discover"
in your bashrc

Related: #25
2015-12-20 18:51:43 +01:00
Fabien Benureau
0ab8310089 Fix color in test_oneliner 2015-12-20 18:51:00 +01:00
Fabien Benureau
48e7658b8c Update readme.md
Precise that the alias plugin should be activated. (see #47)
Section on document management, and clues where to find more help.
Remove outdated requirements, automatically installed anyway.
2015-12-20 16:02:00 +01:00
Fabien Benureau
5ca090668f Handle IOError: [Errno 32] Broken pipe
Will happen if piping through a pager like less, that closes
stdout before everything has been printed.

Related: #47
2015-12-18 22:36:41 +01:00
Fabien Benureau
2ba435126d Add --force-colors option
Useful when piping to a pager that supports color.
Improved and cleaned up a bit the ui functions too.

Related #44, #47
2015-12-18 22:35:19 +01:00
Fabien Benureau
a291114900 Remove duplicated edit_cmd code
Makes nano the default editor.

Fixes #46
2015-12-17 12:54:18 +01:00
Olivier Mangin
854702488c Fixes #46: editor command behaviors with the new config.
- Fix the previous default to 'None' (the string 'None', not None)
in the config.
- Adds support for using the $EDITOR when none is defined in the condif.
- Use ui.editor instead of content.editor in the add commnand.
2015-12-16 15:45:45 -05:00
Fabien Benureau
aa521576f5 More robust plugin list in conf
A single plugin name or an absence of it, with or without comma,
is now properly handled.

Related: #18
2015-12-16 17:02:38 +01:00
Fabien Benureau
f843aebcbd Better handle utf-8 citekeys
Utf-8 citekeys generate errors in bibtexparser. Until this is fixed,
this commit replace the stack-trace by a clear error message.

related: #28
2015-12-16 16:38:40 +01:00
Fabien Benureau
402cf62db0 Merge pull request #42 from 73/master
`doc`, `info` command & prefix completion

+ Prefix completion, see #34 
+ Add `doc` command, closes #41 
+ Add `info` ui command, closes #43
2015-12-16 15:26:39 +01:00
73
23890bf579 missed two somehow 2015-12-16 13:41:20 +01:00
73
5cc3f892a0 All commands that consume a citekey as an argument will now complete a
prefix.
2015-12-14 16:31:30 +01:00
73
69b2879fa2 added ui.info() and made it default for citekey completion 2015-12-14 13:24:13 +01:00
73
a926c4c654 adds a *doc add|remove|export|open* command; depricates commands *open* and *attach*; fixed typos in readme.md and uis; 2015-12-13 21:34:48 +01:00
Fabien Benureau
76be98a900 Merge pull request #37 from pubs/feat/new_config
feat/new_config: better, more robust, more flexible configuration
2015-12-12 15:17:30 +01:00
Fabien Benureau
f52a7202bb Better help for the list command 2015-12-12 15:08:22 +01:00
Fabien Benureau
7186576aef Fix bug in args & less-aggressive update
Without args.prog, AliasCommand fail. Alias is better documented
in the readme and initial config files.

Update will now only trigger with version bumps. And the plugins
section is not updated. Removes the --upgrade flag.
2015-12-12 15:02:59 +01:00
Olivier Mangin
ba48941d93 Fixes alias plugins and adds it to packages. 2015-12-11 21:34:28 -05:00
Olivier Mangin
16aa0163f6 Removes automatic config update.
Makes it optional through command switch.
2015-12-11 21:33:54 -05:00
Olivier Mangin
af207e2604 Adds alias plugin test and fix its config access. 2015-12-11 20:11:38 -05:00
Fabien Benureau
414043e88e Add Arnold Sykosch to authors 2015-12-11 14:35:49 +01:00
Fabien Benureau
eaa6ca8dab Proper error message when no subcommand is provided
On Python 3, invoking `pubs` would display a stacktrace, because
the subparser was not required.

This commit also simplifies the parser code by using .set_default()
to specify which command should be run.

This prompted changes in the plugin code. The code is still not
functioning, but many fixes in this commit bring the code closer
to a working state.
2015-12-10 22:14:38 +01:00
Fabien Benureau
4b21fa1355 Fix handling of version in argument parser 2015-12-10 21:50:18 +01:00
73
2871588703 implements #19 2015-12-10 12:50:38 +01:00
Olivier Mangin
0bfe921ad9 Makes config updater robust ton undefined values. 2015-12-09 10:56:01 -05:00
Fabien Benureau
796087af45 Fix missing update of dye in open command
Essentially reapply commit bd3659a432 that got swallowed in the merge.
2015-12-08 23:54:43 +01:00
Fabien Benureau
392ee0c3c1 Merge branch 'master' into feat/new_config
Add StringIO and BytesIO to FakeIO.
Fixes bytes/string problem in update()
2015-12-07 11:49:16 +01:00