mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-30 20:34:38 +01:00
update code
This commit is contained in:
parent
71583dee63
commit
294fc73ce1
2 changed files with 28 additions and 4 deletions
|
@ -52,6 +52,7 @@ def main():
|
|||
repository = ["sbo", "slack"]
|
||||
blacklist = BlackList()
|
||||
queue = QueuePkgs()
|
||||
|
||||
if len(args) == 0:
|
||||
usage()
|
||||
elif (len(args) == 1 and args[0] == "-h" or
|
||||
|
|
|
@ -56,6 +56,7 @@ class SBoNetwork(object):
|
|||
self.source_dwn = grep.source().split()
|
||||
self.sbo_dwn = SBoLink(self.sbo_url).tar_gz()
|
||||
self.sbo_version = grep.version()
|
||||
self.space = ("\n" * 50)
|
||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
||||
|
||||
def view(self):
|
||||
|
@ -76,12 +77,18 @@ class SBoNetwork(object):
|
|||
download("", self.sbo_dwn, self.source_dwn)
|
||||
break
|
||||
elif choice in ["R", "r"]:
|
||||
pydoc.pager(Read(self.sbo_url).readme("README"))
|
||||
README = Read(self.sbo_url).readme("README")
|
||||
fill = fill_pager(README)
|
||||
pydoc.pager(README + fill)
|
||||
elif choice in ["F", "f"]:
|
||||
pydoc.pager(Read(self.sbo_url).info(self.name, ".info"))
|
||||
info = Read(self.sbo_url).info(self.name, ".info")
|
||||
fill = fill_pager(info)
|
||||
pydoc.pager(info + fill)
|
||||
elif choice in ["S", "s"]:
|
||||
pydoc.pager(Read(self.sbo_url).slackbuild(self.name,
|
||||
".SlackBuild"))
|
||||
SlackBuild = Read(self.sbo_url).slackbuild(self.name,
|
||||
".SlackBuild")
|
||||
fill = fill_pager(SlackBuild)
|
||||
pydoc.pager(SlackBuild + fill)
|
||||
elif choice in ["B", "b"]:
|
||||
build(self.sbo_dwn, self.source_dwn, FAULT)
|
||||
break
|
||||
|
@ -101,6 +108,22 @@ class SBoNetwork(object):
|
|||
pkg_not_found("\n", self.name, "Can't view", "\n")
|
||||
|
||||
|
||||
def fill_pager(page):
|
||||
'''
|
||||
Fix pager spaces
|
||||
'''
|
||||
rows, columns = os.popen('stty size', 'r').read().split()
|
||||
lines = 1
|
||||
for line in page.splitlines():
|
||||
lines += 1
|
||||
diff = int(rows) - lines
|
||||
fill = "\n" * diff
|
||||
if diff > 0:
|
||||
return fill
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
||||
def read_choice():
|
||||
'''
|
||||
Return choice
|
||||
|
|
Loading…
Add table
Reference in a new issue