Skip to content

Commit 2f4c7ee

Browse files
committed
Simplify export plugins
1 parent 395877d commit 2f4c7ee

File tree

1 file changed

+41
-46
lines changed

1 file changed

+41
-46
lines changed

docs/plugins/export.rst

Lines changed: 41 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,65 @@
11
Export Plugin
22
=============
33

4-
The ``export`` plugin lets you get data from the items and export the content to
5-
a ``json`` file.
4+
The ``export`` plugin lets you get data from the items and export the content
5+
as `JSON`_.
66

7-
Configuration
8-
-------------
9-
To configure the plugin, make a ``export:`` section in your configuration
10-
file. The default options are::
7+
.. _JSON: http://www.json.org
118

12-
export:
13-
default_format: json
14-
json:
15-
formatting:
16-
ensure_ascii: False
17-
indent: 4
18-
separators: [',' , ': ']
19-
sort_keys: true
9+
Enable the ``export`` plugin (see :ref:`using-plugins` for help). Then, type ``beet export`` followed by a :doc:`query </reference/query>` to get the data from
10+
your library. For example, run this::
2011

21-
- **default_format**: Choose the format of the exported content.
22-
Supports json only for now.
12+
$ beet export beatles
2313

24-
Each format have their own options.
14+
to print a JSON file containing information about your Beatles tracks.
2515

26-
The ``json`` formatting uses the `json`_ standard library options.
27-
Using custom options overwrites all options at the same level.
28-
The default options used here are:
16+
Command-Line Options
17+
--------------------
2918

30-
- **ensure_ascii**: All non-ASCII characters are escaped with `\uXXXX`, if true.
19+
The ``export`` command has these command-line options:
3120

32-
- **indent**: The number of spaces for indentation.
21+
* ``--include-keys`` or ``-i``: Choose the properties to include in the output
22+
data. The argument is a comma-separated list of simple glob patterns where
23+
``*`` matches any string. For example::
3324

34-
- **separators**: A ``(item_separator, dict_separator)`` tuple
25+
$ beet export -i 'title,mb*' beatles
3526

36-
- **sort_keys**: Sorts the keys of the json
27+
will include the ``title`` property and all properties starting with
28+
``mb``. You can add the ``-i`` option multiple times to the command
29+
line.
3730

38-
.. _json: https://docs.python.org/2/library/json.html#basic-usage
31+
* ``--library`` or ``-l``: Show data from the library database instead of the
32+
files' tags.
3933

40-
Using
41-
-----
34+
* ``--output`` or ``-o``: Path for an output file. If not informed, will print
35+
the data in the console.
4236

43-
Enable the ``export`` plugin (see :ref:`using-plugins` for help) and then add a
44-
``export`` section to your :doc:`configuration file </reference/config>`
37+
* ``--append``: Appends the data to the file instead of writing.
4538

46-
To use, you can enter a :doc:`query </reference/query>` to get the data from
47-
your library::
39+
Configuration
40+
-------------
4841

49-
$ beet export beatles
42+
To configure the plugin, make a ``export:`` section in your configuration
43+
file. Under the ``json`` key, these options are available:
5044

51-
If you just want to see specific properties you can use the
52-
``--include-keys`` option to filter them. The argument is a
53-
comma-separated list of simple glob patterns where ``*`` matches any
54-
string. For example::
45+
- **ensure_ascii**: Escape non-ASCII characters with `\uXXXX` entities.
5546

56-
$ beet export -i 'title,mb*' beatles
47+
- **indent**: The number of spaces for indentation.
5748

58-
Will only show the ``title`` property and all properties starting with
59-
``mb``. You can add the ``-i`` option multiple times to the command
60-
line.
49+
- **separators**: A ``[item_separator, dict_separator]`` tuple.
6150

62-
Additional command-line options include:
51+
- **sort_keys**: Sorts the keys in JSON dictionaries.
6352

64-
* ``--library`` or ``-l``: Show data from the library database instead of the
65-
files' tags.
53+
These options match the options from the `Python json module`_.
6654

67-
* ``--output`` or ``-o``: Path for an output file. If not informed, will print
68-
the data in the console.
55+
.. _Python json module: https://docs.python.org/2/library/json.html#basic-usage
6956

70-
* ``--append``: Appends the data to the file instead of writing.
57+
The default options look like this::
58+
59+
export:
60+
json:
61+
formatting:
62+
ensure_ascii: False
63+
indent: 4
64+
separators: [',' , ': ']
65+
sort_keys: true

0 commit comments

Comments
 (0)