Domonic: terminal

There is a command line package that can call bash/unix/posix and other apps on the command line.

This package only works on nix systems as it effectively just passes stuff off to subprocess.

from domonic.terminal import *

print(ls())
print(ls("-al"))
print(ls("../"))

print(pwd())

print(mkdir('somedir'))
print(touch('somefile'))
print(git('status'))

for file in ls( "-al" ):
    print("Line : ", file)

for f in ls():
    try:
        print(f)
        print(cat(f))
    except Exception as e:
        pass

for i, l in enumerate(cat('LICENSE.txt')):
    print(i,l)

print(man("ls"))
print(echo('test'))
print(df())
print(du())

for thing in du():
    print(thing)

print(find('.'))
# print(ping('eventual.technology'))# < TODO - need to strean output
print(cowsay('moo'))
print(wget('eventual.technology'))
print(date())
print(cal())

run arbitrary commands…

from domonic.terminal import command
command.run("echo hi")

Take a look at the code in ‘terminal.py’ to see all the commands as there’s loads. (Disclaimer: not all tested.)

domonic.terminal

  • call command line functions in python 3
exception domonic.terminal.TerminalException(error, message='An error message was recieved from terminal')[source]

raised if the terminal throws an exception

class domonic.terminal.alias(*args, **kwargs)
class domonic.terminal.apt(*args, **kwargs)
class domonic.terminal.ar(*args, **kwargs)
class domonic.terminal.asa(*args, **kwargs)
class domonic.terminal.at(*args, **kwargs)
class domonic.terminal.awk(*args, **kwargs)
class domonic.terminal.banner(*args, **kwargs)
class domonic.terminal.basename(*args, **kwargs)
class domonic.terminal.bash(*args, **kwargs)
class domonic.terminal.batch(*args, **kwargs)
class domonic.terminal.bc(*args, **kwargs)
class domonic.terminal.bg(*args, **kwargs)
class domonic.terminal.bind(*args, **kwargs)
class domonic.terminal.builtin(*args, **kwargs)
class domonic.terminal.cal(*args, **kwargs)
class domonic.terminal.caller(*args, **kwargs)
class domonic.terminal.cat(*args, **kwargs)
class domonic.terminal.cc(*args, **kwargs)
class domonic.terminal.cd(*args, **kwargs)[source]

NOTE - ‘cd’ does not run on terminal - cd is pointless as session opens and closes - so is overridden to change dirs via pure python

class domonic.terminal.cflow(*args, **kwargs)
class domonic.terminal.chgrp(*args, **kwargs)
class domonic.terminal.chmod(*args, **kwargs)
class domonic.terminal.chown(*args, **kwargs)
class domonic.terminal.cksum(*args, **kwargs)
class domonic.terminal.comm(*args, **kwargs)
class domonic.terminal.command(*args, **kwargs)[source]

wrapper class for all terminal commands

static run(cmd)[source]

runs any command on the terminal

Parameters:cmd (str) – The command you want to run on the terminal
Returns:the response as a string
Return type:str
class domonic.terminal.compgen(*args, **kwargs)
class domonic.terminal.complete(*args, **kwargs)
class domonic.terminal.compopt(*args, **kwargs)
class domonic.terminal.compress(*args, **kwargs)
class domonic.terminal.convert(*args, **kwargs)
class domonic.terminal.cowsay(*args, **kwargs)
class domonic.terminal.cp(*args, **kwargs)
class domonic.terminal.cron(*args, **kwargs)
class domonic.terminal.crontab(*args, **kwargs)
class domonic.terminal.csplit(*args, **kwargs)
class domonic.terminal.ctags(*args, **kwargs)
class domonic.terminal.curl(*args, **kwargs)
class domonic.terminal.cut(*args, **kwargs)
class domonic.terminal.cxref(*args, **kwargs)
class domonic.terminal.date(*args, **kwargs)
class domonic.terminal.dd(*args, **kwargs)
class domonic.terminal.declare(*args, **kwargs)
class domonic.terminal.delta(*args, **kwargs)
class domonic.terminal.df(*args, **kwargs)
class domonic.terminal.diff(*args, **kwargs)
class domonic.terminal.dirname(*args, **kwargs)
class domonic.terminal.dirs(*args, **kwargs)
class domonic.terminal.disown(*args, **kwargs)
class domonic.terminal.du(*args, **kwargs)
class domonic.terminal.echo(*args, **kwargs)
class domonic.terminal.ed(*args, **kwargs)
class domonic.terminal.enable(*args, **kwargs)
class domonic.terminal.env(*args, **kwargs)
class domonic.terminal.ex(*args, **kwargs)
class domonic.terminal.exit(*args, **kwargs)
class domonic.terminal.expand(*args, **kwargs)
class domonic.terminal.export(*args, **kwargs)
class domonic.terminal.expr(*args, **kwargs)
class domonic.terminal.fc(*args, **kwargs)
class domonic.terminal.ffmpeg(*args, **kwargs)
class domonic.terminal.fg(*args, **kwargs)
class domonic.terminal.figlet(*args, **kwargs)
class domonic.terminal.file(*args, **kwargs)
class domonic.terminal.find(*args, **kwargs)
class domonic.terminal.finger(*args, **kwargs)
class domonic.terminal.fold(*args, **kwargs)
class domonic.terminal.fort77(*args, **kwargs)
class domonic.terminal.fuser(*args, **kwargs)
class domonic.terminal.gcc(*args, **kwargs)
class domonic.terminal.gencat(*args, **kwargs)
class domonic.terminal.get(*args, **kwargs)
class domonic.terminal.getconf(*args, **kwargs)
class domonic.terminal.getopts(*args, **kwargs)
class domonic.terminal.git(*args, **kwargs)
class domonic.terminal.grep(*args, **kwargs)
class domonic.terminal.groupadd(*args, **kwargs)
class domonic.terminal.groupdel(*args, **kwargs)
class domonic.terminal.groups(*args, **kwargs)
class domonic.terminal.gunzip(*args, **kwargs)
class domonic.terminal.gzip(*args, **kwargs)
class domonic.terminal.head(*args, **kwargs)
class domonic.terminal.history(*args, **kwargs)[source]
class domonic.terminal.iconv(*args, **kwargs)
class domonic.terminal.ifconfig(*args, **kwargs)
class domonic.terminal.ipconfig(*args, **kwargs)
class domonic.terminal.ipcrm(*args, **kwargs)
class domonic.terminal.ipcs(*args, **kwargs)
class domonic.terminal.jobs(*args, **kwargs)
class domonic.terminal.join(*args, **kwargs)
class domonic.terminal.jq(*args, **kwargs)
class domonic.terminal.kill(*args, **kwargs)
class domonic.terminal.killall(*args, **kwargs)
class domonic.terminal.less(*args, **kwargs)
class domonic.terminal.let(*args, **kwargs)
class domonic.terminal.lex(*args, **kwargs)
class domonic.terminal.link(*args, **kwargs)
class domonic.terminal.ln(*args, **kwargs)
class domonic.terminal.local(*args, **kwargs)
class domonic.terminal.locale(*args, **kwargs)
class domonic.terminal.localedef(*args, **kwargs)
class domonic.terminal.logger(*args, **kwargs)
class domonic.terminal.logname(*args, **kwargs)
class domonic.terminal.logout(*args, **kwargs)
class domonic.terminal.lp(*args, **kwargs)
class domonic.terminal.ls(*args, **kwargs)
class domonic.terminal.m4(*args, **kwargs)
class domonic.terminal.mailx(*args, **kwargs)
class domonic.terminal.make(*args, **kwargs)
class domonic.terminal.man(*args, **kwargs)
class domonic.terminal.mapfile(*args, **kwargs)
class domonic.terminal.mesg(*args, **kwargs)
class domonic.terminal.mkdir(*args, **kwargs)
class domonic.terminal.mkfifo(*args, **kwargs)
class domonic.terminal.mkfile(*args, **kwargs)
class domonic.terminal.more(*args, **kwargs)
class domonic.terminal.mv(*args, **kwargs)
class domonic.terminal.nautilus(*args, **kwargs)
class domonic.terminal.newgrp(*args, **kwargs)
class domonic.terminal.nice(*args, **kwargs)
class domonic.terminal.nl(*args, **kwargs)
class domonic.terminal.nm(*args, **kwargs)
class domonic.terminal.nmap(*args, **kwargs)
class domonic.terminal.nohup(*args, **kwargs)
class domonic.terminal.npm(*args, **kwargs)
class domonic.terminal.od(*args, **kwargs)
class domonic.terminal.passwd(*args, **kwargs)
class domonic.terminal.paste(*args, **kwargs)
class domonic.terminal.patch(*args, **kwargs)
class domonic.terminal.pathchk(*args, **kwargs)
class domonic.terminal.pax(*args, **kwargs)
class domonic.terminal.ping(*args, **kwargs)
class domonic.terminal.pip(*args, **kwargs)
class domonic.terminal.popd(*args, **kwargs)
class domonic.terminal.pr(*args, **kwargs)
class domonic.terminal.printf(*args, **kwargs)
class domonic.terminal.prs(*args, **kwargs)
class domonic.terminal.ps(*args, **kwargs)
class domonic.terminal.pushd(*args, **kwargs)
class domonic.terminal.pwd(*args, **kwargs)
class domonic.terminal.python(*args, **kwargs)
class domonic.terminal.qalter(*args, **kwargs)
class domonic.terminal.qdel(*args, **kwargs)
class domonic.terminal.qhold(*args, **kwargs)
class domonic.terminal.qmove(*args, **kwargs)
class domonic.terminal.qmsg(*args, **kwargs)
class domonic.terminal.qrerun(*args, **kwargs)
class domonic.terminal.qrls(*args, **kwargs)
class domonic.terminal.qselect(*args, **kwargs)
class domonic.terminal.qsig(*args, **kwargs)
class domonic.terminal.qstat(*args, **kwargs)
class domonic.terminal.qsub(*args, **kwargs)
class domonic.terminal.read(*args, **kwargs)
class domonic.terminal.readarray(*args, **kwargs)
class domonic.terminal.readonly(*args, **kwargs)
class domonic.terminal.reboot(*args, **kwargs)
class domonic.terminal.renice(*args, **kwargs)
class domonic.terminal.rm(*args, **kwargs)
class domonic.terminal.rmdel(*args, **kwargs)
class domonic.terminal.rmdir(*args, **kwargs)
class domonic.terminal.rsync(*args, **kwargs)
class domonic.terminal.sact(*args, **kwargs)
class domonic.terminal.say(*args, **kwargs)
class domonic.terminal.sccs(*args, **kwargs)
class domonic.terminal.scp(*args, **kwargs)
class domonic.terminal.sed(*args, **kwargs)
class domonic.terminal.sh(*args, **kwargs)
class domonic.terminal.shift(*args, **kwargs)
class domonic.terminal.shopt(*args, **kwargs)
class domonic.terminal.shutdown(*args, **kwargs)
class domonic.terminal.sleep(*args, **kwargs)
class domonic.terminal.sort(*args, **kwargs)
class domonic.terminal.source(*args, **kwargs)
class domonic.terminal.split(*args, **kwargs)
class domonic.terminal.ssh(*args, **kwargs)
class domonic.terminal.strings(*args, **kwargs)
class domonic.terminal.strip(*args, **kwargs)
class domonic.terminal.stty(*args, **kwargs)
class domonic.terminal.suspend(*args, **kwargs)
class domonic.terminal.tabs(*args, **kwargs)
class domonic.terminal.tail(*args, **kwargs)
class domonic.terminal.talk(*args, **kwargs)
class domonic.terminal.tar(*args, **kwargs)
class domonic.terminal.tee(*args, **kwargs)
class domonic.terminal.test(*args, **kwargs)
class domonic.terminal.time(*args, **kwargs)
class domonic.terminal.times(*args, **kwargs)
class domonic.terminal.touch(*args, **kwargs)
class domonic.terminal.tput(*args, **kwargs)
class domonic.terminal.tr(*args, **kwargs)
class domonic.terminal.trap(*args, **kwargs)
class domonic.terminal.true(*args, **kwargs)
class domonic.terminal.tsort(*args, **kwargs)
class domonic.terminal.tty(*args, **kwargs)
class domonic.terminal.typeset(*args, **kwargs)
class domonic.terminal.ulimit(*args, **kwargs)
class domonic.terminal.umask(*args, **kwargs)
class domonic.terminal.unalias(*args, **kwargs)
class domonic.terminal.uname(*args, **kwargs)
class domonic.terminal.uncompress(*args, **kwargs)
class domonic.terminal.unexpand(*args, **kwargs)
class domonic.terminal.unget(*args, **kwargs)
class domonic.terminal.uniq(*args, **kwargs)
class domonic.terminal.unlink(*args, **kwargs)
class domonic.terminal.unset(*args, **kwargs)
class domonic.terminal.uptime(*args, **kwargs)
class domonic.terminal.useradd(*args, **kwargs)
class domonic.terminal.userdel(*args, **kwargs)
class domonic.terminal.users(*args, **kwargs)
class domonic.terminal.uucp(*args, **kwargs)
class domonic.terminal.uudecode(*args, **kwargs)
class domonic.terminal.uuencode(*args, **kwargs)
class domonic.terminal.uustat(*args, **kwargs)
class domonic.terminal.uux(*args, **kwargs)
class domonic.terminal.val(*args, **kwargs)
class domonic.terminal.wait(*args, **kwargs)
class domonic.terminal.wc(*args, **kwargs)
class domonic.terminal.wget(*args, **kwargs)
class domonic.terminal.what(*args, **kwargs)
class domonic.terminal.who(*args, **kwargs)
class domonic.terminal.whoami(*args, **kwargs)
class domonic.terminal.write(*args, **kwargs)
class domonic.terminal.xargs(*args, **kwargs)
class domonic.terminal.yacc(*args, **kwargs)
class domonic.terminal.zcat(*args, **kwargs)