Giter Site home page Giter Site logo

vermuz / sultan Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aeroxis/sultan

0.0 1.0 0.0 431 KB

Sultan: Command and Rule over your Shell

Home Page: https://sultan.readthedocs.io/en/latest/

License: MIT License

Makefile 0.11% HTML 13.67% Python 73.16% CSS 13.06%

sultan's Introduction

sultan logo

Command and Rule over your Shell

PyPI Version Travis Build Status MIT License Documentation Status

Sultan now supports Python 2.7+ and 3.0+

Note

Your input is welcome! Please provide your feedback by creating issues on Github

Install

pip install --upgrade sultan

Documentation

Documentation Status

Documentation 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:

from sultan.api import Sultan
s = Sultan()
s.sudo("yum install -y tree").run()

Runs:

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:

from sultan.api import Sultan

with Sultan.load(sudo=True) as s:
  s.yum("install -y tree").run()

Runs:

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:

from sultan.api import Sultan

with Sultan.load(sudo=True, hostname="myserver.com") as sultan:
  sultan.yum("install -y tree").run()

Runs:

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:

from sultan.api import Sultan

with Sultan.load(sudo=True, hostname="myserver.com") as sultan:
  sultan.yum("install -y tree").run()

Yields:

[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/

sultan's People

Contributors

bigolu avatar davydany avatar foobarquaxx avatar naegi avatar ograff avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.