Skip to content

Commit

Permalink
Add documentation to readthedocs
Browse files Browse the repository at this point in the history
  • Loading branch information
qubixes committed Nov 29, 2024
1 parent 933eddb commit b473ea8
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 3 deletions.
64 changes: 62 additions & 2 deletions docs/source/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ useful to cache the password so that the next commands will no longer ask for yo
Listing remote files
--------------------

To list the dataobjects and collections that are available on the iRODS server, you can use the :code:`ibridges list` command:
To list the data objects and collections that are available on the iRODS server, you can use the :code:`ibridges list` command:

.. code:: shell
Expand All @@ -94,9 +94,19 @@ If you want to list a collection relative to your `irods_home`, you can use `~`
ibridges list "irods:~/collection_in_home"
It is generally best to avoid spaces in collection and data object names. If you really need them, you must enclose the path with `"`. That also holds true for local paths.

If you want to have a list that is easier to parse with other command line tools, you can use:

.. code:: shell
ibridges list --short
You can also see the checksums and sizes of data objects with the long format:

.. code:: shell
ibridges list --long
.. note::
Note that all data objects and collections on the iRODS server are always preceded with "irods:". This is done to distinguish local and remote files.
Expand Down Expand Up @@ -274,3 +284,53 @@ or
.. code:: shell
ibridges search --metadata "key" --item_type data_object
Metadata commands
-----------------

Listing metadata
^^^^^^^^^^^^^^^^

Listing metadata entries for a single collection or data object can be done with the :code:`meta-list`
subcommand:

.. code:: shell
ibridges meta-list "irods:some_collection"
Adding new metadata
^^^^^^^^^^^^^^^^^^^

To add new metadata for a single collection or data object, you can use the :code:`meta-add` subcommand:

.. code:: shell
ibridges meta-add "irods:some_collection" some_key some_value, some_units
The :code:`some_units` argument can be left out, in which case the units will be set to the empty string.

Deleting metadata
^^^^^^^^^^^^^^^^^

Metadata can also again be deleted with the CLI using the :code:`meta-del` subcommand:

.. code:: shell
ibridges meta-del "irods:some_collection" --key some_key --value some_value --units some_units
All of the :code:`--key`, :code:`--value` and :code:`--units` are optional. They serve to constrain
which metadata items will be deleted. For example, if you only set the key:

.. code:: shell
ibridges meta-del "irods:some_collection" --key some_key
then **all** metadata items with that key will be deleted. You can delete all metadata for a single
collection or data object with:

.. code:: shell
ibridges meta-del "irods:some_collection"
You will be asked to confirm this operation.
11 changes: 10 additions & 1 deletion ibridges/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
List the content of a collections, if no path is given, the home collection will be listed.
tree:
List a collection and subcollections in a hierarchical way.
meta-list:
List the metadata of a collection or data object.
meta-add:
Add a new metadata entry to a collection or data object.
meta-del:
Delete metadata entries for a collection or data object.
mkcoll:
Create the collection and all its parent collections.
setup:
Expand All @@ -68,6 +74,9 @@
ibridges list irods:~/collection
ibridges mkcoll irods://~/bli/bla/blubb
ibridges tree irods:~/collection
ibridges meta-list irods:~/collection
ibridges meta-add irods:~/collection key value units
ibridges meta-del irods:~/collection key value units
ibridges search --path-pattern "%.txt"
ibridges search --metadata "key" "value" "units"
ibridges search --metadata "key" --metadata "key2" "value2"
Expand Down Expand Up @@ -120,7 +129,7 @@ def main() -> None: #pylint: disable=too-many-branches
ibridges_meta_list()
elif subcommand == "meta-add":
ibridges_meta_add()
elif subcommand == "meta-del":
elif subcommand in ["meta-del", "meta-rm"]:
ibridges_meta_del()
else:
print(f"Invalid subcommand ({subcommand}). For help see ibridges --help")
Expand Down

0 comments on commit b473ea8

Please sign in to comment.