Пример #1
0
    def test_bake_args_come_first(self):
        from sh import ls
        ls = ls.bake(h=True)

        ran = ls("-la").ran
        ft = ran.index("-h")
        self.assertTrue("-la" in ran[ft:])
Пример #2
0
Файл: test.py Проект: ahhentz/sh
 def test_bake_args_come_first(self):
     from sh import ls
     ls = ls.bake(h=True)
     
     ran = ls("-la").ran
     ft = ran.index("-h")
     self.assertTrue("-la" in ran[ft:]) 
Пример #3
0
    def test_bake_args_come_first(self):
        from sh import ls
        ls = ls.bake(full_time=True)

        ran = ls("-la").command_ran
        ft = ran.index("full-time")
        self.assertTrue("-la" in ran[ft:])
Пример #4
0
    def test_bake_args_come_first(self):
        from sh import ls
        ls = ls.bake(full_time=True)

        ran = ls("-la").command_ran
        ft = ran.index("full-time")
        self.assertTrue("-la" in ran[ft:])
Пример #5
0
#coding=utf8
from sh import ls
from sh import ssh
#Baking


ls = ls.bake("-la")
print(ls)

# resolves to "ls -la /"
print(ls("/"))

# calling whoami on a server
iam1 = ssh("[email protected]", "-p 22", "ifconfig")
print(iam1)

# resolves to "ssh [email protected] -p 22 whoami"
myserver = ssh.bake("[email protected]", p=22)
print(myserver)

iam2 = myserver.whoami()
print(iam2)


# resolves to "sh [email protected] -p 22  tail /root/InterfacePCTest/logs/test-account.log  -n 100"
iam3 = myserver.tail("/root/InterfacePCTest/logs/test-account.log", n=100)
print(repr(iam3))
Пример #6
0
#!/usr/bin/env python
import sys
import sh

if sys.platform == 'win32':
    print("Sorry, the sh module is only implemented on non-Windows systems")
    exit(1)

print(sh.ls('-l','../DATA/parrot.txt'))
print('-' * 50)

from sh import ls
print(ls('-l', '../DATA/parrot.txt'))
print('-' * 50)

ll = ls.bake(l=True)
print(ll('../DATA'))
print('-' * 50)

from sh import ls, glob
print(ls('-ld', glob('/etc/pr*')))
print('-' * 50)

w = sh.who()
print(w)
print('-' * 50)

disk_usage = sh.df('-h')
print(disk_usage)
print('-' * 50)
Пример #7
0
def test_baking():
    from sh import ls
    ls = ls.bake('-la')
    print ls
    print ls('/')