39 Commits

Author SHA1 Message Date
Fabien C. Y. Benureau
8b32ccd9e4
make pubs --help work without pubs init 2019-01-05 21:38:42 +09:00
Fabien C. Y. Benureau
3fee6b9403
valid_citekey function in bibstruct 2019-01-05 20:57:03 +09:00
Fabien C. Y. Benureau
b99c5b43fa
handle / in citekeys 2019-01-04 23:17:54 +09:00
Fabien C. Y. Benureau
51fa0de520
remove error, improve description 2018-08-27 12:05:57 +09:00
Olivier Mangin
7dae35e722
Adds the statistics command. (Fixes #8) 2018-08-09 23:48:29 +02:00
ksunden
bff1f5763d Add a command to open urls 2018-05-08 22:32:12 -05:00
Fabien C. Y. Benureau
dc4e118c3c make utf8 citekeys possible in python 2.7. closes #28
This involved many changes, some side effects of the change include:
- remove of all `u"abc"` forms, in favor of
  `from __future__ import unicode_literals`. Their usage was
  inconsistent anyway, leading to problems when mixing with
  unicode content.
- improve the tests, to allow printing for usecase even when
  crashing. Should make future test easier. This is done with a
  rather hacky `StdIO` class in `p3`, but it works.
- for some reason, the skipped test for Python 2 seems to work
  now. While the previous point might seem related, it is not clear
  that this is actually the case.
2018-04-10 14:45:54 +09:00
Olivier Mangin
bcf216183f
Fixes tests for printing help on --help and without argument.
(fix #135)
2018-03-27 15:44:20 -04:00
Olivier Mangin
26f0b4dc04 Adds argcomplete command to pubs_cmd so that is now used as entry-point. 2018-01-25 16:09:30 -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
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
e129398311 Pass the config to plugins on parser modification to allow 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
af73d4ed64 Basic autocompletion with argcomplete.
Only support pubs command completion.
2017-07-08 00:10:15 -04: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
df8f0e6d6b FIX error handler.
Also fix alignments.
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
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
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
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
16aa0163f6 Removes automatic config update.
Makes it optional through command switch.
2015-12-11 21:33:54 -05: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
Fabien Benureau
14df0ad1cb Add pubs conf command
Allows to edit the configuration file using pubs directly.
Will check if the modified configuration file is valid.
2015-12-05 21:20:03 +01:00
Fabien Benureau
757a8b300e Add an update mechanism for old repositories
The update is done transparently, and displays a warning message explaining the change.
All the update machinery has been moved to the new update module.
2015-12-05 20:36:19 +01:00
Fabien Benureau
93c54939b3 Rewritten config module
It depends on configobj, is cleaner and simpler than the previous implementation.
It adds comments in the config file, and type verification.

Related: #18
2015-12-04 20:49:05 +01:00
Fabien Benureau
4b3b2a23bd Improves interface of PrintUI
`print_out()` is replaced by `message()`, that redirect the output to
the stdout controlled by the PrintUI instance. Other than that, can be
used the same way as `print()`.
2015-12-03 16:09:54 +01:00
Fabien Benureau
b71494ed42 Fix pubs init TypeError
The error was due to python 2 and 3 not playing nice when opening files.
This is probably linked to some botched unicode handling on our part somewhere
else is the package, and needs to be addressed when the `configs` module is
rewritten.

Also addresses some other minor unicode bugs.

Fix #27.
Related #18.
2015-12-03 10:00:19 +01:00
Fabien Benureau
29c6eaa8b5 Fix obsolete repo version
This fix is temporary. A better long-term solution should be found, and a less
intrusive update strategy devised.
2015-12-03 09:47:38 +01:00
Fabien Benureau
cce9406670 new print ui, more robust colors 2015-12-02 16:36:27 +01:00
Olivier Mangin
adb0caa3ed Use default python in executable. 2014-09-11 18:47:54 +02:00
Fabien Benureau
48ad7e9b69 fix bug when calling 2014-04-21 19:17:39 +02:00
Fabien Benureau
84fd5d7649 fix #17 2014-04-20 02:41:30 +02:00
Olivier Mangin
07cb6f696c Adds back edit command.
The Repository rename_paper method has been updated. The citekey update
and syncronization with citekey in the bibdata should be handled in a
sane manner inside the Paper class.
2014-04-16 18:47:14 +02:00
Fabien Benureau
8d91545472 papers renamed 'pubs' 2013-11-14 04:40:29 +01:00