Metadata-Version: 2.1
Name: tangoctl
Version: 0.2.1
Summary: tango system cli manager
Home-page: https://github.com/tiagocoutinho/tangoctl
Author: Jose Tiago Macara Coutinho
Author-email: coutinhotiago@gmail.com
License: MIT license
Keywords: tangoctl
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Requires-Dist: pytango
Requires-Dist: click
Requires-Dist: treelib
Requires-Dist: gevent
Requires-Dist: tabulate
Requires-Dist: six

tangoctl
========


A CLI built for Tango_ system administrators.

tangoctl aims to be to Tango_ what systemctl is to to systemd.

Actions speak louder than words. Here is a video:


Purpose
-------

* on day to day Tango_ maintenance
* to help automate ansible, puppet or chef scripts
* to prepare automated test scripts for your own software
* to help write a custom `bash completion`_ for your tool


Features
--------

* server operations:

  * server info
  * tree of servers
  * list of servers
  * register/unregister servers

* device operations:

  * device info
  * tree of devices
  * list of devices
  * register/unregister devices
  * execute commands
  * command info
  * read and write attributes
  * attribute info
  * read and write properties


Installation
------------

pip install it on your favorite python environment:

.. code-block::

   $ pip install tangoctl

That's it!

Examples
--------

.. code-block::

    # Display tree of servers:
    tangoctl server tree

    # Display list of devices:
    tangoctl device list

    # Read 'state' attribute from a device
    tangoctl device attribute read -d sys/tg_test/1 -a state

    # Execute command Init() on a device
    tangoctl device command exec -d sys/tg_test/1 -c init

    # Display 'double_spectrum' attribute information
    tangoctl device attribute info -d sys/tg_test/1 -a double_spectrum

    # Display list of device attributes:
    tangoctl device attribute list -d sys/tg_test/1


Writting a custom `bash completion` for your server
###################################################

Imagine you have a Tango_ server called `LimaCCDs` and you registered
two instances in the database, maybe using tangoctl:

.. code-block:: bash

   tangoctl server add LimaCCDs/basler1 -d id00/limaccds/basler1
   tangoctl server add LimaCCDs/pilatus1 -d id00/limaccds/pilatus1

To have bash auto-complete every time you type `LimaCCDs [tab]` on the command
line, place the following lines in a bash script:

.. code-block:: bash

    # naive tango server autocomplete using tangoctl server ilist
    _tango_server_complete()
    {
        stype="${COMP_WORDS[0]}"
        sname="${COMP_WORDS[COMP_CWORD]}"
        echo $stype
        COMPREPLY=( $(tangoctl server ilist -t "${stype}" --filter="${sname}*") )
        return 0
    }

    complete -F _tango_server_complete Demo

and run it. Next time you type `LimaCCDs [tab]` on the bash command line it
will offer the existing LimaCCDs instances as completion options:

.. code-block:: bash

    LimaCCDs [tab]
    basler1 pilatus1

    LimaCCDs pil[tab]
    pilatus1

Check the bash completion documentation on how to add it permanently to your
environment.


Special thanks to
-----------------

* PyTango_: Tango binding to python
* click_: beautiful command line interfaces
* gevent_: I/O made simple and efficient
* tabulate_: ASCII tables
* treelib_:  tree data structures


Credits
-------

This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.

.. _treelib: https://github.com/caesar0301/treelib
.. _tabulate: https://bitbucket.org/astanin/python-tabulate
.. _gevent: https://github.com/gevent/gevent
.. _PyTango: https://github.com/tango-controls/pytango
.. _click: https://github.com/pallets/click
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
.. _Tango: http://tango-controls.org
.. _bash completion: http://www.caliban.org/bash/#completion

.. |Pypi Version| image:: https://img.shields.io/pypi/v/tangoctl.svg
                  :target: https://pypi.python.org/pypi/tangoctl

.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/tangoctl.svg
		     :target: https://pypi.python.org/pypi/tangoctl

.. |Build Status| image:: https://gitlab.com/tiagocoutinho/tangoctl/badges/master/pipeline.svg
	          :target: https://gitlab.com/tiagocoutinho/tangoctl/commits/master

.. |Coverage Status| image:: https://gitlab.com/tiagocoutinho/tangoctl/badges/master/coverage.svg
	             :target: https://gitlab.com/tiagocoutinho/tangoctl/commits/master

.. |Asciinema| image:: https://asciinema.org/a/6U4Y6NVqWWDFTQy8ORfmssG4w.svg
               :target: https://asciinema.org/a/6U4Y6NVqWWDFTQy8ORfmssG4w?autoplay=1

=======
History
=======

0.2.1 (2018-11-25)
------------------

* Minor fixes to README


0.2.0 (2018-11-25)
------------------

* Release with major device and server commands


0.1.0 (2018-11-17)
------------------

* First release on PyPI.

