Commit graph libervia-backend/frontends/src/jp/common.py
Author SHA1 Message Date
Goffi
2b44df2294 jp (merge-request,common): fixed URIFinder when metadata are not needed:
new "meta_map" attribute which allows to select destination argument name, or to discard unused metadata.
2018-04-02 08:23:22 +02:00
Goffi
e4c56da671 plugin uri finder, jp (merge-request): labels handling:
- a label can now be specified as metadata after specifing a "xmpp:" URI in doc (with « use "[label]" label" » after the URI)
- updated jp to handle new signature of URIFind
- jp (merge-request/set): labels can now be specified using --label
2018-04-01 20:17:00 +02:00
Goffi
f4a15b0ffb jp (merge-request/set): if service and node are not specified, URIFinder is now used + ask confirmation before publishing 2018-03-31 18:23:06 +02:00
Goffi
6f8834f9da jp: pubsub options refactoring:
There is now only "use_pubsub", and specification are set using "pubsub_flags" argument when instantiating CommandBase.
Options are more Python Zen compliant by using explicit arguments for item, draft, url instead of trying to guess with magic keyword and type detection.
Pubsub node and item are now always using respecively "-n" and "-i" even when required, this way shell history can be used to change command more easily, and it's globally less confusing for user.
if --pubsub-url is used, elements can be overwritten with individual option (e.g. change item id with --item).
New "use_draft" argument in CommandBase, to re-use current draft or open a file path as draft.
Item can now be specified when using a draft. If it already exists, its content will be added to current draft (with a separator), to avoid loosing data.
common.BaseEdit.getItemPath could be simplified thanks to those changes.
Pubsub URI handling has been moved to base.py.
2018-03-21 19:13:22 +01:00
Goffi
5fc249a075 jp (common): assure nosplitright in default commands for edition with vim 2018-03-16 16:59:16 +01:00
Goffi
976da08f5d jp (common/table): a column can be hidden + fix for empty tables
- avoid crash when table is empty
- a column can now be hidden on display, this can be useful if one data is needed (e.g. to change color of an other column with a filter),
  but we don't want to display it
- filters have a new argument with all data of a row (for the same reason as above, one column can be used to change display of other column)
2018-02-28 18:28:39 +01:00
Goffi
387c10cc0d dates update 2018-01-26 11:14:13 +01:00
Goffi
f5f25e8ab5 misc: date update (yes it's a bit late :p ) 2017-11-03 14:31:42 +01:00
Goffi
e9c0f5e127 jp (pubsub/node): added schema (set/edit/get) commands to manipulate PubSub node schema 2017-09-06 07:39:10 +02:00
Goffi
f4761fb1cc jp (common): added use_buffer argument in Table:
when use_buffer is True, the Table is not printed but put in a buffer. A unicode string can then be computed when string property is used.
2017-08-23 00:10:09 +02:00
Goffi
40fa0ed846 jp (common): fixed empty table display when headers are specified 2017-08-23 00:08:30 +02:00
Goffi
b4312f210a jp (common): fixed decode error when item is not specified 2017-07-14 09:06:03 +02:00
Goffi
5c7d273ebc jp (common): fixed encoding issue in URLs 2017-07-13 21:45:26 +02:00
Goffi
702c5e78e9 jp (common): fixed the use of --last-item when "-n [node]" is used 2017-07-05 15:04:45 +02:00
Goffi
3cc90179b5 jp (common): new ansi_ljust, ansi_rjust and ansi_center command + table:
- ansi_ljust, ansi_rjust and ansi_center are equivalent to string.ljust, rjust and center, but handle strings with ANSI escape codes
    - new Table class to handle tabular data and display them with ASCII borders/separations.
    - Table is quite flexible, filters can be applied to data, header can be shown or not, columns/headers can be left/right aligned.
    - table can be displayed without decoration to align text data, using display_blank helping method
2017-07-02 20:09:21 +02:00
Goffi
364130bcbe jp (pubsub, common): fixed last item edition (keep item id instead of creating a new one) 2017-06-28 20:28:24 +02:00
Goffi
c2ae6579c3 jp (cmd_pubsub): xmpp: uri handling, first draft 2017-06-28 19:19:08 +02:00
Goffi
be2bb0ff3f jp (common): added --last-item to take last item when no item id is found/given 2017-06-28 01:20:44 +02:00
Goffi
2449721982 jp (blog, common): various fixes in common and blog:
- parse_args has been moved to common
    - cat_dir is converted to str on BaseEdit init, so it can be use to make str path for files manipulation
    - fixed use of EDITOR_ARGS_MAGIC when use_metadata is False
    - fixed unlink of metadata files when use_metadata is False
2017-06-27 19:38:22 +02:00
Goffi
6025cc4e3b jp (blog, common): added --force-item option to avoid magic and use argument as actual item id:
- creation of new item with item id has been fixed
    - --force-item allow to use url as item id, or keyword
    - pubsub_item can is now returned by getItemPath. If not None, the id is known and must be used
2017-06-27 17:00:52 +02:00
Goffi
5eda63d99e jp (blog, common): moved and improved edit code from blog:
- a new "common" module is there for code commonly used in commands
    - moved code for editing item with $EDITOR there
    - moved code to identify item to edit there
    - aforementioned fontions have been made generic
    - a class BaseEdit is now available to implement edition
    - HTTPS links are handled (only HTTP links were working before)
    - item can be use if all previous methods fail (url, keyword, file path).
2017-06-27 16:23:28 +02:00
Goffi
7ca3c657f4 jp: refactoring:
- imports from sat_frontends.jp instead of local imports
    - added __init__.py
    - commands now inherits from a base class: each base.CommandBase instance is a subcommand
    - new arguments are added in CommandBase.add_parser_options methods, starting point si CommandBase.run or CommandBase.connected if a profile connection is needed
    - commands are exported using a __commands__ variable at the top of the module
    - sub-subcommand are easily added by using an other CommandBase instance as parent instead of using a Jp instance. In this case, the parent subcommand must be the one exported, and have a subcommands iterable (see cmd_file or cmd_pipe for examples).
    - options which are often used (like --profile) are automatically added on demand (use_profile=True, use_progress=True)
    - commands are automatically loaded when there are in a module named cmd_XXX
    - restored --connect option
    - restored progress bar
    - restored getVersion bridge call on jp --version
    - fixed file and pipe commands
    - fixed forgotten translations
    - fixed non SàT compliant docstrings
    - better about/version dialog
2014-02-10 13:44:09 +01:00
Goffi
3491335314 jp: added missing license headers 2014-02-05 14:52:38 +01:00
Dal
f4de26e4e8 jp: refactoring using ArgParse 2014-02-05 14:35:26 +01:00