Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aeroxis/sultan
Sultan: Command and Rule over your Shell
https://github.com/aeroxis/sultan
bash bash-script cli command-line command-line-tool command-prompt compiler python2 python3 ssh terminal zsh
Last synced: about 3 hours ago
JSON representation
Sultan: Command and Rule over your Shell
- Host: GitHub
- URL: https://github.com/aeroxis/sultan
- Owner: davydany
- License: mit
- Created: 2016-08-30T03:54:52.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-07-16T08:20:40.000Z (4 months ago)
- Last Synced: 2024-11-05T04:10:47.973Z (3 days ago)
- Topics: bash, bash-script, cli, command-line, command-line-tool, command-prompt, compiler, python2, python3, ssh, terminal, zsh
- Language: Python
- Homepage: https://sultan.readthedocs.io/en/latest/
- Size: 460 KB
- Stars: 680
- Watchers: 15
- Forks: 35
- Open Issues: 22
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
.. image:: https://raw.githubusercontent.com/aeroxis/sultan/master/docs/img/sultan-logo.png
:alt: sultan logo
:align: right**Command and Rule over your Shell**
.. image:: https://badge.fury.io/py/sultan.svg
:alt: PyPI Version
:target: https://badge.fury.io/py/sultan.. image:: https://travis-ci.org/aeroxis/sultan.svg?branch=master
:alt: Travis Build Status
:target: https://travis-ci.org/aeroxis/sultan.. image:: http://img.shields.io/:license-mit-blue.svg
:alt: MIT License
:target: http://doge.mit-license.org.. image:: https://readthedocs.org/projects/sultan/badge/?version=latest
:alt: Documentation Status
:target: http://sultan.readthedocs.io/en/latest/?badge=latestSultan now supports Python 2.7+ and 3.0+
----
Note
----
Your input is welcome! Please provide your feedback by creating
`issues on Github `_-------
Install
-------.. code:: bash
pip install --upgrade sultan
-------------
Documentation
-------------.. image:: https://readthedocs.org/projects/sultan/badge/?version=latest
:alt: Documentation Status
:target: http://sultan.readthedocs.io/en/latest/?badge=latestDocumentation is available on ReadTheDocs: http://sultan.readthedocs.io/en/latest/
---------------
What is Sultan?
---------------Sultan is a Python package for interfacing with command-line utilities, like
`yum`, `apt-get`, or `ls`, in a Pythonic manner. It lets you run command-line
utilities using simple function calls.The simplest way to use Sultan is to just call it:
.. code:: python
from sultan.api import Sultan
s = Sultan()
s.sudo("yum install -y tree").run()
**Runs:**.. code:: bash
sudo yum install -y tree;
------------
The recommended way of using Sultan is to use it in Context Management mode.
Here is how to use Sultan with Context Management:.. code:: python
from sultan.api import Sultan
with Sultan.load(sudo=True) as s:
s.yum("install -y tree").run()**Runs:**
.. code:: bash
sudo su - root -c 'yum install -y tree;'
------------What if we want to install this command on a remote machine? You can easily
achieve this using context management:.. code:: python
from sultan.api import Sultan
with Sultan.load(sudo=True, hostname="myserver.com") as sultan:
sultan.yum("install -y tree").run()**Runs:**
.. code:: bash
ssh [email protected] 'sudo su - root -c 'yum install -y tree;''
------------If you enter a wrong command, Sultan will print out details you need to debug and
find the problem quickly.Here, the same command was run on a Mac:
.. code:: python
from sultan.api import Sultan
with Sultan.load(sudo=True, hostname="myserver.com") as sultan:
sultan.yum("install -y tree").run()
**Yields:**.. code:: bash
[sultan]: sudo su - root -c 'yum install -y tree;'
Password:
[sultan]: --{ STDERR }-------------------------------------------------------------------------------------------------------
[sultan]: | -sh: yum: command not found
[sultan]: -------------------------------------------------------------------------------------------------------------------------------
Want to get started? Simply install Sultan, and start writing your clean code::
pip install --upgrade sultan
If you have more questions, check the docs! http://sultan.readthedocs.io/en/latest/