Commit graph

136 commits

Author SHA1 Message Date
Romain Bignon
9fe4faa6bb add missing docstrings to commands 2013-07-28 00:23:31 +02:00
Romain Bignon
46d9acd37e display a message when more results are available (closes #1038) 2013-07-27 23:40:24 +02:00
Romain Bignon
4c4fb24291 ls: display collections before objects 2013-07-27 23:40:24 +02:00
Romain Bignon
bcc75c37c7 add bold on command syntax in help 2013-07-27 18:43:13 +02:00
Romain Bignon
9094294683 default behavior is to unlimit results, except for explicit commands (searches or history)
closes #1139
2013-07-27 15:56:45 +02:00
Romain Bignon
f1305f0daa invoking 'help' command from shell display only list of commands (no options) 2013-07-27 15:56:45 +02:00
Laurent Bachelier
a6ad7e83ff Use newer form of catching exceptions
autopep8 -i --select=W602
Also some other minor deprecated syntax changes, like "while 1".
I did not commit the less obvious changes.
2013-07-27 15:16:16 +02:00
Romain Bignon
a98ab89671 get_object supports backend's services returning lists 2013-07-27 14:28:10 +02:00
Florent Fourcot
34bb4d52a1 Add a new caps parameter to get_object 2013-07-16 23:00:41 +02:00
Laurent Bachelier
c21d1f7925 Code clarity fixes
autopep8 -ir -j2 --select=E303,E125
Diff checked manually.
2013-03-16 00:52:43 +01:00
Florent
0072b5e076 Allow infinite search with 0 2013-02-07 14:51:38 +01:00
Romain Bignon
b770163d9b fix crash when there is no selected fields (yes, all the time, why nobody has reported it) 2013-02-07 14:21:06 +01:00
Romain Bignon
8550c17cf7 do not cry if an object in not support to be filled by a backend 2013-01-30 11:34:28 +01:00
Laurent Bachelier
4d1e6f8436 Add support for ls -d option (closes #858)
This behaves like the UNIX ls -d.
This should solve the use case of Bug #858; ls was never intended to
work that way before. Users can now chose between the two modes (with or
without -d).
2013-01-10 09:38:09 +01:00
Laurent Bachelier
f48c81de53 Properly get to the previous path, not home 2012-11-08 11:51:52 +01:00
Romain Bignon
538578c83f don't crash when there the input is empty 2012-07-23 17:25:07 +02:00
Florent
d0c7a18d20 Add suggestion of commands in case of if "unknown"
Very useful to find the good short alias...
2012-07-20 19:32:50 +02:00
Florent
37c68b7ba6 Search and execute short command alias 2012-07-20 19:31:24 +02:00
Romain Bignon
8e550b4196 handle UserError during fillobj 2012-06-16 13:52:03 +02:00
Romain Bignon
6f46c41743 do not fail during fullobj() if the object is not supported by backend 2012-04-28 16:38:55 +02:00
Romain Bignon
e5474c26a1 remove '-' from readline delims 2012-04-27 14:31:44 +02:00
capitaldata
5e8ac671da add list-modules option in the command line interface
ex: radioob> backends list-modules

Signed-off-by: capitaldata <capitaldata@capitaldata-desktop2.(none)>
Signed-off-by: Romain Bignon <romain@symlink.me>
2012-04-27 14:31:40 +02:00
Florent
92d5e9ea0f Get all available subscriptions for details command
Add a new method get_object_list to ReplApplication
Should close #846.
2012-04-25 13:50:42 +02:00
Romain Bignon
20835e5180 ls: clear objects list 2012-04-10 13:25:55 +02:00
Romain Bignon
fc849995f4 rewrite of the formatters system 2012-04-03 22:40:38 +02:00
Romain Bignon
c6a141595c change way to describe fields of CapBaseObject, and lot of documentation 2012-03-26 14:35:54 +02:00
Romain Bignon
1833952af1 fix completion of 'cd' after using 'ls' with a parameter 2012-03-25 09:45:31 +02:00
theo
67ae0893cd Add completion to ls in CapCollection
The completion is the same code as ls used to call.
2012-03-20 07:52:40 +01:00
theo
8c977825b9 ls dir is equivalent to cd dir + ls + cd ..
Until now, ls discarded arguments.

ls = ls dir:

videoob> ls
~ (emissions) Emissions (canalplus)
~ (sport) Sport (canalplus)
~ (cinema) Cinema (canalplus)
~ (cesar-2012) Cesar 2012 (canalplus)
~ (series-fictions) Series / fictions (canalplus)
~ (du-hard-ou-du-cochon) Du hard ou du cochon (canalplus)
~ (divertissement) Divertissement (canalplus)
~ (canal-street) Canal street (canalplus)
~ (musique) Musique (canalplus)
~ (docus-infos) Docus / infos (canalplus)
videoob> ls sport
~ (emissions) Emissions (canalplus)
~ (sport) Sport (canalplus)
~ (cinema) Cinema (canalplus)
~ (cesar-2012) Cesar 2012 (canalplus)
~ (series-fictions) Series / fictions (canalplus)
~ (du-hard-ou-du-cochon) Du hard ou du cochon (canalplus)
~ (divertissement) Divertissement (canalplus)
~ (canal-street) Canal street (canalplus)
~ (musique) Musique (canalplus)
~ (docus-infos) Docus / infos (canalplus)

With this patch, we are now able to ls a dir without chdir into it.

For instance:
videoob> ls
~ (emissions) Emissions (canalplus)
~ (sport) Sport (canalplus)
~ (cinema) Cinema (canalplus)
~ (cesar-2012) Cesar 2012 (canalplus)
~ (series-fictions) Series / fictions (canalplus)
~ (du-hard-ou-du-cochon) Du hard ou du cochon (canalplus)
~ (divertissement) Divertissement (canalplus)
~ (canal-street) Canal street (canalplus)
~ (musique) Musique (canalplus)
~ (docus-infos) Docus / infos (canalplus)
videoob> ls sport
~ (les-incontournables) Les incontournables (canalplus)
~ (les-plus-recentes) Les plus recentes (canalplus)
~ (les-plus-vues) Les plus vues (canalplus)
~ (tout-le-football) Tout le football (canalplus)
~ (tout-le-rugby) Tout le rugby (canalplus)
~ (tout-le-basket) Tout le basket (canalplus)
~ (tout-le-tennis-golf) Tout le tennis / golf (canalplus)
~ (autres-sports-home-sport) Autres sports - home sport (canalplus)
~ (les-emissions-sport) Les emissions sport (canalplus)
videoob> ls
~ (emissions) Emissions (canalplus)
~ (sport) Sport (canalplus)
~ (cinema) Cinema (canalplus)
~ (cesar-2012) Cesar 2012 (canalplus)
~ (series-fictions) Series / fictions (canalplus)
~ (du-hard-ou-du-cochon) Du hard ou du cochon (canalplus)
~ (divertissement) Divertissement (canalplus)
~ (canal-street) Canal street (canalplus)
~ (musique) Musique (canalplus)
~ (docus-infos) Docus / infos (canalplus)

Signed-off-by: theo <theocrite@theocrite.org>
2012-03-16 17:20:18 +01:00
Laurent Bachelier
fae4470101 Prepare for objects that are also Collections
Don't force objects to have an id, especially since that id was
incorrect. "plap/plop" would have the same id as "plop", i.e. "plop".
We don't rely on the id for handling Collections anymore.

Change to use more unique property names.

Change the display, instead of using '*', we use '~', and there is no
"Collection" header anymore.
Updated formatters could use that way of showing the object is also a
collection too.

refs #774
2012-03-13 22:08:46 +01:00
Laurent Bachelier
f4dbefb6ef Add some useful properties to Collection 2012-03-13 22:08:46 +01:00
Laurent Bachelier
e70a125ab9 Make collection validation more powerful
Handle and use exceptions.
An example is provided with the redmine backend (not very useful
though). If you cd into the project title instead of the id, it is
accepted and the path is corrected.
2012-03-13 22:08:46 +01:00
Laurent Bachelier
c0121ae6ab Fix crash when entering unicode paths
prompt must be str, not unicode, so we encode it
2012-03-13 22:08:46 +01:00
Laurent Bachelier
b6021d4732 Better path changing support
* Create a get_collection method similar to get_* methods for objects.
* Fix title initialization of a collection
* Remove the hack were both id and title were allowed when CDing.
  That hack only worked with the canalplus module, and failed with
  others like redmine (but they still showed in suggestions).
  Moreover, the canalplus module now has friendlier IDs
  so this is not really needed anymore.
* Allow backends to tell if a path is valid or not.
  For instance, it now allows to cd in a Redmine project with no issues
  in it. It also won't display "404" for invalid project IDs.
  By default, we still use the unreliable method of checking there is at
  least one result in iter_resources().
* Fix cd completion to work with unicode strings (all strings after an
  unicode string were ignored!)
* Do not suggest '..' when completing cd in the root

refs #774
2012-03-13 22:08:45 +01:00
Laurent Bachelier
b4b7182960 Make Collection more safe and sane
* Remove callbacks in Collection object
  Make Collection a "dumb" object (and also a base object,
  though it isn't very useful for now)
* Rename Path to WorkingPath, because it is more about managing state
  than being a single path.
* Rewrite almost all WorkingPath, because the code was overly
  complicated for no reason (I tried some special cases and it turned
  out that fromstring didn't handle them, and that the
  quote-escape-unquote was just unecessary). I also rewrote it to be
  more pythonic (no more lambdas and maps) and added tests.
* Require the full split path when creating a Collection. Because, come to
  think of it, an object needs an unique identifier; in the case of
  Collections, it is the full path, not only its last part.
  I might even replace the id by the full split path in the future.
* There is now only one way to get items of a Collection: calling
  iter_resources().
* Rewrite flatten_resources to iter_resources_flat(), which just calls
  iter_resources() recursively.
* Rewrite the collection part of the canalplus module. There is no more
  callback or a page calling the browser to check another page!
  The logic is only in iter_resources().
  The resulting code is not very pretty, but it should get better.
  As a bonus, avoid to reload the main XML file when we already have it
  open.
* change_path() now expects a split path and not a string.
* up/home special cases for "cd" are handled in the same place, and
  store the previous place properly (but are not yet exploitable by
  an user command).

This is a big commit but it would be hard to split it in *working*
commits.

If you read this entire commit message, I will buy you a beer.

refs #774
fixes #773
2012-03-13 22:08:45 +01:00
Laurent Bachelier
9c5326c0e4 Make CapCollection a bit more useable
Collections are not stored in replapplication.objects anymore, but in
replapplication.collections. This fixes the IDs issue. There was no gain
from storing them in objects.

Completion right after cd should be faster (and should always have been
like that, it was pretty much a bug).

The display of do_ls() should be much clearer. Collections are always at
the end, have ids/title/backend like objects (but using a formatter
would be better than my current hack).

There are still many issues with the current implementation.
refs #774
closes #785
2012-02-12 15:49:08 +01:00
Laurent Bachelier
bfb3689456 Add object type filtering to iter_resources 2012-02-05 13:30:02 +01:00
Laurent Bachelier
baab16b931 Fix completion with new Collection objects 2012-02-03 00:07:45 +01:00
Laurent Bachelier
682e14c86a Make CapCollection understandable and useable by humans
* Make the declaration of fct and it in the constructor Collection,
 instead of adding them from the outside
* Add a function to flatten a list containing collection (solves the
 radioob search crash)
* Better display of collections in the "ls" command (and display both id
 and title)
* The "cd" command goes to the root of the path (like the UNIX cd)
* Move the Video object of canalplus in a correct path
* Make Collection iterable
* Add comments to CapCollection
* Cache the result of fct in a Collection; it is only called once
* CollectionNotFound errors can be more explicit by providing a path
* Require utf-8 in collection paths
* Code cleanups
2012-02-02 23:44:13 +01:00
Romain Bignon
c009b26864 fix crash when a command doesn't have a docstring 2012-02-02 08:44:00 +01:00
Romain Bignon
3a3bbd377e support XDG Base Directory Specification (closes #765) 2012-01-27 17:34:08 +01:00
Romain Bignon
14a7a1d362 support repositories to manage backends (closes #747) 2012-01-17 17:00:05 +01:00
Romain Bignon
b0d84fff2a fix unicode issue (closes #703) 2011-10-04 08:57:04 +02:00
Romain Bignon
367d996d50 get_object doesn't request the backend name in IDs (dedicated to fucking nigger pankkake) 2011-08-12 15:46:40 +02:00
Romain Bignon
18dd9e2b8f always flush formatter after calling a command 2011-08-12 09:56:30 +02:00
Romain Bignon
9e3b1a049e get_object() method requires an unique backend ID 2011-07-11 22:17:40 +02:00
Romain Bignon
090fb38feb ability to enter the backend name 2011-06-26 23:33:34 +02:00
Romain Bignon
908e32a713 fix command 'inspect' to don't crash if there isn't any browser 2011-05-12 15:02:40 +02:00
Romain Bignon
1dafee2b47 move repl code from ConsoleApplication to ReplApplication 2011-05-08 18:13:05 +02:00
Romain Bignon
daa524d75d 'ls' and 'cd' are now weboob commands 2011-05-08 17:25:32 +02:00