mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-15 03:41:16 +01:00
Added long description argument
This commit is contained in:
parent
3027493310
commit
7bfa2b3ff4
2 changed files with 132 additions and 83 deletions
|
@ -58,58 +58,58 @@ Commands:
|
||||||
Optional arguments:
|
Optional arguments:
|
||||||
-h, --help Print this help message and exit
|
-h, --help Print this help message and exit
|
||||||
-v, --version Print program version and exit.
|
-v, --version Print program version and exit.
|
||||||
-a, [script.tar.gz] [source...] Auto build SBo packages.
|
-a, --autobuild, [script] [source...] Auto build SBo packages.
|
||||||
If you already have downloaded the
|
If you already have downloaded the
|
||||||
script and the source code you can
|
script and the source code you can
|
||||||
build a new package with this
|
build a new package with this
|
||||||
command.
|
command.
|
||||||
-b, [package...] --add, --remove Manage packages in the blacklist.
|
-b, --blacklist, [package...] --add, Manage packages in the blacklist.
|
||||||
list Add or remove packages and print
|
--remove, list Add or remove packages and print
|
||||||
the list. Each package is added
|
the list. Each package is added
|
||||||
here will not be accessible by the
|
here will not be accessible by the
|
||||||
program.
|
program.
|
||||||
-q, [package...] --add, --remove Manage SBo packages in the queue.
|
-q, --queue, [package...] --add, Manage SBo packages in the queue.
|
||||||
list, build, install, build-install Add or remove and print the list
|
--remove, list, build, install, Add or remove and print the list
|
||||||
of packages. Build and then install
|
build-install of packages. Build and then install
|
||||||
the packages from the queue.
|
the packages from the queue.
|
||||||
-g, config, config=[editor] Configuration file management.
|
-g, --config, print, edit=[editor] Configuration file management.
|
||||||
Print the configuration file or
|
Print the configuration file or
|
||||||
edit.
|
edit.
|
||||||
-l, [repository], --index, --installed Print a list of all available
|
-l, --list, [repository], --index, Print a list of all available
|
||||||
packages repository, index or print
|
--installed packages repository, index or print
|
||||||
only packages installed on the
|
only packages installed on the
|
||||||
system.
|
system.
|
||||||
-c, [repository] --upgrade --skip=[], Check, view and install updated
|
-c, --check, [repository] --upgrade Check, view and install updated
|
||||||
--resolve-off packages from repositories.
|
--skip=[] --resolve-off packages from repositories.
|
||||||
-s, [repository] [package...], Sync packages. Install packages
|
-s, --sync, [repository] [package...], Sync packages. Install packages
|
||||||
--resolve-off directly from remote repositories
|
--resolve-off directly from remote repositories
|
||||||
with all dependencies.
|
with all dependencies.
|
||||||
-t, [repository] [package] Track package dependencies and
|
-t, --tracking, [repository] [package] Tracking package dependencies and
|
||||||
print package dependenies tree with
|
print package dependenies tree with
|
||||||
highlight if packages is installed.
|
highlight if packages is installed.
|
||||||
-p, [repository] [package], --color=[] Print description of a package
|
-p, --print, [repository] [package], Print description of a package
|
||||||
directly from the repository and
|
--color=[] directly from the repository and
|
||||||
change color text.
|
change color text.
|
||||||
-n, [package] View a standard of SBo page in
|
-n, --network, [package] View a standard of SBo page in
|
||||||
terminal and manage multiple options
|
terminal and manage multiple options
|
||||||
like reading, downloading, building
|
like reading, downloading, building
|
||||||
installation, etc.
|
installation, etc.
|
||||||
-F, [package...] Find packages from repositories and
|
-F, --FIND, [package...] Find packages from repositories and
|
||||||
search at each enabled repository
|
search at each enabled repository
|
||||||
and prints results.
|
and prints results.
|
||||||
-f, [package...] Find and print installed packages
|
-f, --find, [package...] Find and print installed packages
|
||||||
reporting the size and the sum.
|
reporting the size and the sum.
|
||||||
-i, [package...] Installs single or multiple
|
-i, --install, [package...] Installs single or multiple
|
||||||
Slackware binary packages (*.t?z).
|
Slackware binary packages (*.t?z).
|
||||||
-u, [package...] Upgrade single or multiple Slackware
|
-u, --upgrade, [package...] Upgrade single or multiple Slackware
|
||||||
binary packages from a older to a
|
binary packages from a older to a
|
||||||
newer one.
|
newer one.
|
||||||
-o, [package...] Reinstall signle or multiple
|
-o, --reinstall, [package...] Reinstall signle or multiple
|
||||||
Slackware binary packages with the
|
Slackware binary packages with the
|
||||||
same packages if the exact.
|
same packages if the exact.
|
||||||
-r, [package...] Removes a previously installed
|
-r, --remove, [package...] Removes a previously installed
|
||||||
Slackware binary packages.
|
Slackware binary packages.
|
||||||
-d, [package...] Display the packages contents and
|
-d, --display, [package...] Display the packages contents and
|
||||||
file list.
|
file list.
|
||||||
|
|
||||||
You can read more about slpkg from manpage or see examples from readme file.
|
You can read more about slpkg from manpage or see examples from readme file.
|
||||||
|
|
169
slpkg/main.py
169
slpkg/main.py
|
@ -63,39 +63,48 @@ class ArgParse(object):
|
||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
self.args = args
|
self.args = args
|
||||||
self.packages = self.args[1:]
|
self.packages = self.args[1:]
|
||||||
if len(self.args) > 1 and self.args[0] in ["-q", "-b"]:
|
if len(self.args) > 1 and self.args[0] in ["-q", "--queue", "-b",
|
||||||
|
"--blacklist"]:
|
||||||
self.packages = self.args[1:-1]
|
self.packages = self.args[1:-1]
|
||||||
elif len(self.packages) > 1 and self.args[0] in ["-s", "-t",
|
elif len(self.packages) > 1 and self.args[0] in ["-s", "--sync", "-t",
|
||||||
"-p", "-F"]:
|
"--tracking", "-p",
|
||||||
|
"--print", "-F",
|
||||||
|
"--FIND"]:
|
||||||
self.packages = self.args[2:]
|
self.packages = self.args[2:]
|
||||||
|
|
||||||
if (len(self.args) > 1 and
|
if (len(self.args) > 1 and
|
||||||
self.args[0] in ["-f", "-i", "-u", "-o", "-r", "-d", "-n"] and
|
self.args[0] in ["-f", "--find", "-i", "--install", "-u",
|
||||||
|
"--upgrade", "-o", "--reinstall", "-r",
|
||||||
|
"--remove", "-d", "--display", "-n",
|
||||||
|
"--network"] and
|
||||||
self.args[1].endswith(".pkg")):
|
self.args[1].endswith(".pkg")):
|
||||||
self.packages = Utils().read_file_pkg(self.args[1])
|
self.packages = Utils().read_file_pkg(self.args[1])
|
||||||
elif (len(self.args) >= 3 and
|
elif (len(self.args) >= 3 and
|
||||||
self.args[0] in ["-s", "-t", "-p", "-F"] and
|
self.args[0] in ["-s", "--sync", "-t", "--tracking", "-p",
|
||||||
|
"--print", "-F", "--FIND"] and
|
||||||
self.args[1] in _m.repositories and
|
self.args[1] in _m.repositories and
|
||||||
self.args[2].endswith(".pkg")):
|
self.args[2].endswith(".pkg")):
|
||||||
self.packages = Utils().read_file_pkg(self.args[2])
|
self.packages = Utils().read_file_pkg(self.args[2])
|
||||||
elif (len(self.args) == 3 and self.args[0] in ["-q", "-b"] and
|
elif (len(self.args) == 3 and self.args[0] in ["-q", "--queue",
|
||||||
|
"-b", "--blacklist"] and
|
||||||
self.args[1].endswith(".pkg")):
|
self.args[1].endswith(".pkg")):
|
||||||
self.packages = Utils().read_file_pkg(self.args[1])
|
self.packages = Utils().read_file_pkg(self.args[1])
|
||||||
|
|
||||||
# checking if repositories exists
|
# checking if repositories exists
|
||||||
if len(self.args) > 1 and self.args[0] not in [
|
if len(self.args) > 1 and self.args[0] not in [
|
||||||
"-h", "--help", "-v", "--version", "upgrade", "repo-list",
|
"-h", "--help", "-v", "--version", "upgrade", "repo-list",
|
||||||
"repo-add", "repo-remove", "update", "update-slpkg", "-g"
|
"repo-add", "repo-remove", "update", "update-slpkg", "-g",
|
||||||
|
"--config"
|
||||||
]:
|
]:
|
||||||
check_exists_repositories()
|
check_exists_repositories()
|
||||||
|
|
||||||
def help_version(self):
|
def help_version(self):
|
||||||
""" Help and version info """
|
""" Help and version info """
|
||||||
if (len(self.args) == 1 and self.args[0] == "-h" or
|
if (len(self.args) == 1 and self.args[0] in ["-h", "--help"] and
|
||||||
self.args[0] == "--help" and self.args[1:] == []):
|
self.args[1:] == []):
|
||||||
options()
|
options()
|
||||||
elif (len(self.args) == 1 and self.args[0] == "-v" or
|
elif (len(self.args) == 1 and self.args[0] in ["-v", "--version"] and
|
||||||
self.args[0] == "--version" and self.args[1:] == []):
|
self.args[1:] == []):
|
||||||
prog_version()
|
prog_version()
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
@ -154,30 +163,33 @@ class ArgParse(object):
|
||||||
|
|
||||||
def auto_build(self):
|
def auto_build(self):
|
||||||
""" auto built tool """
|
""" auto built tool """
|
||||||
if len(self.args) == 3 and self.args[0] == "-a":
|
options = ["-a", "--autobuild"]
|
||||||
|
if len(self.args) == 3 and self.args[0] in options:
|
||||||
BuildPackage(self.args[1], self.args[2:], _m.path).build()
|
BuildPackage(self.args[1], self.args[2:], _m.path).build()
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
|
||||||
def pkg_list(self):
|
def pkg_list(self):
|
||||||
""" list of packages by repository """
|
""" list of packages by repository """
|
||||||
if (len(self.args) == 3 and self.args[0] == "-l" and
|
options = ["-l", "--list"]
|
||||||
|
flag = ["--index", "--installed"]
|
||||||
|
if (len(self.args) == 3 and self.args[0] in options and
|
||||||
self.args[1] in _m.repositories):
|
self.args[1] in _m.repositories):
|
||||||
if self.args[2] == "--index":
|
if self.args[2] == flag[0]:
|
||||||
PackageManager(binary=None).package_list(self.args[1],
|
PackageManager(binary=None).package_list(self.args[1],
|
||||||
INDEX=True,
|
INDEX=True,
|
||||||
installed=False)
|
installed=False)
|
||||||
elif self.args[2] == "--installed":
|
elif self.args[2] == flag[1]:
|
||||||
PackageManager(binary=None).package_list(self.args[1],
|
PackageManager(binary=None).package_list(self.args[1],
|
||||||
INDEX=False,
|
INDEX=False,
|
||||||
installed=True)
|
installed=True)
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
elif (len(self.args) == 2 and self.args[0] == "-l" and
|
elif (len(self.args) == 2 and self.args[0] in options and
|
||||||
self.args[1] in _m.repositories):
|
self.args[1] in _m.repositories):
|
||||||
PackageManager(None).package_list(self.args[1], INDEX=False,
|
PackageManager(None).package_list(self.args[1], INDEX=False,
|
||||||
installed=False)
|
installed=False)
|
||||||
elif (len(self.args) > 1 and self.args[0] == "-l" and
|
elif (len(self.args) > 1 and self.args[0] in options and
|
||||||
self.args[1] not in _m.repositories):
|
self.args[1] not in _m.repositories):
|
||||||
usage(self.args[1])
|
usage(self.args[1])
|
||||||
else:
|
else:
|
||||||
|
@ -186,17 +198,18 @@ class ArgParse(object):
|
||||||
def pkg_upgrade(self):
|
def pkg_upgrade(self):
|
||||||
""" check and upgrade packages by repository """
|
""" check and upgrade packages by repository """
|
||||||
skip, resolve = "", True
|
skip, resolve = "", True
|
||||||
|
options = ["-c", "--check"]
|
||||||
flag = ["--upgrade", "--skip=", "--resolve-off"]
|
flag = ["--upgrade", "--skip=", "--resolve-off"]
|
||||||
if flag[2] in self.args:
|
if flag[2] in self.args:
|
||||||
resolve = False
|
resolve = False
|
||||||
index = self.args.index(flag[2])
|
index = self.args.index(flag[2])
|
||||||
del self.args[index]
|
del self.args[index]
|
||||||
if (len(self.args) == 4 and self.args[0] == "-c" and
|
if (len(self.args) == 4 and self.args[0] in options and
|
||||||
self.args[2] == flag[0] and
|
self.args[2] == flag[0] and
|
||||||
self.args[3].startswith(flag[1])):
|
self.args[3].startswith(flag[1])):
|
||||||
skip = "".join(self.args[3].split("=")[1:]).split(",")
|
skip = "".join(self.args[3].split("=")[1:]).split(",")
|
||||||
self.args.pop(3)
|
self.args.pop(3)
|
||||||
if (len(self.args) == 3 and self.args[0] == "-c" and
|
if (len(self.args) == 3 and self.args[0] in options and
|
||||||
self.args[2] == flag[0]):
|
self.args[2] == flag[0]):
|
||||||
if (self.args[1] in _m.repositories and
|
if (self.args[1] in _m.repositories and
|
||||||
self.args[1] not in ["slack", "sbo"]):
|
self.args[1] not in ["slack", "sbo"]):
|
||||||
|
@ -217,11 +230,12 @@ class ArgParse(object):
|
||||||
|
|
||||||
def pkg_install(self):
|
def pkg_install(self):
|
||||||
""" install packages by repository """
|
""" install packages by repository """
|
||||||
|
options = ["-s", "--sync"]
|
||||||
flag = ["--resolve-off"]
|
flag = ["--resolve-off"]
|
||||||
resolve = True
|
resolve = True
|
||||||
if self.args[-1] == flag[0]:
|
if self.args[-1] == flag[0]:
|
||||||
resolve = False
|
resolve = False
|
||||||
if len(self.args) >= 3 and self.args[0] == "-s":
|
if len(self.args) >= 3 and self.args[0] in options:
|
||||||
if self.args[1] in _m.repositories and self.args[1] not in ["sbo"]:
|
if self.args[1] in _m.repositories and self.args[1] not in ["sbo"]:
|
||||||
BinaryInstall(self.packages, self.args[1], resolve).start(
|
BinaryInstall(self.packages, self.args[1], resolve).start(
|
||||||
if_upgrade=False)
|
if_upgrade=False)
|
||||||
|
@ -236,14 +250,15 @@ class ArgParse(object):
|
||||||
def pkg_tracking(self):
|
def pkg_tracking(self):
|
||||||
""" tracking package dependencies """
|
""" tracking package dependencies """
|
||||||
packages = "".join(self.packages)
|
packages = "".join(self.packages)
|
||||||
|
options = ["-t", "--tracking"]
|
||||||
if len(self.packages) > 1:
|
if len(self.packages) > 1:
|
||||||
packages = self.packages[1]
|
packages = self.packages[1]
|
||||||
if self.args[2].endswith(".pkg"):
|
if self.args[2].endswith(".pkg"):
|
||||||
packages = self.packages[0]
|
packages = self.packages[0]
|
||||||
if (len(self.args) == 3 and self.args[0] == "-t" and
|
if (len(self.args) == 3 and self.args[0] in options and
|
||||||
self.args[1] in _m.repositories):
|
self.args[1] in _m.repositories):
|
||||||
track_dep(packages, self.args[1])
|
track_dep(packages, self.args[1])
|
||||||
elif (len(self.args) > 1 and self.args[0] == "-t" and
|
elif (len(self.args) > 1 and self.args[0] in options and
|
||||||
self.args[1] not in _m.repositories):
|
self.args[1] not in _m.repositories):
|
||||||
usage(self.args[1])
|
usage(self.args[1])
|
||||||
else:
|
else:
|
||||||
|
@ -252,9 +267,10 @@ class ArgParse(object):
|
||||||
def sbo_network(self):
|
def sbo_network(self):
|
||||||
""" view slackbuilds packages """
|
""" view slackbuilds packages """
|
||||||
packages = "".join(self.packages)
|
packages = "".join(self.packages)
|
||||||
|
options = ["-n", "--network"]
|
||||||
if len(self.packages) > 1:
|
if len(self.packages) > 1:
|
||||||
packages = self.packages[0]
|
packages = self.packages[0]
|
||||||
if (len(self.args) == 2 and self.args[0] == "-n" and
|
if (len(self.args) == 2 and self.args[0] in options and
|
||||||
"sbo" in _m.repositories):
|
"sbo" in _m.repositories):
|
||||||
SBoNetwork(packages).view()
|
SBoNetwork(packages).view()
|
||||||
else:
|
else:
|
||||||
|
@ -263,14 +279,17 @@ class ArgParse(object):
|
||||||
def pkg_blacklist(self):
|
def pkg_blacklist(self):
|
||||||
""" manage blacklist packages """
|
""" manage blacklist packages """
|
||||||
blacklist = BlackList()
|
blacklist = BlackList()
|
||||||
if (len(self.args) == 2 and self.args[0] == "-b" and
|
options = ["-b", "--blacklist"]
|
||||||
self.args[1] == "list"):
|
flag = ["--add", "--remove"]
|
||||||
|
command = ["list"]
|
||||||
|
if (len(self.args) == 2 and self.args[0] in options and
|
||||||
|
self.args[1] == command[0]):
|
||||||
blacklist.listed()
|
blacklist.listed()
|
||||||
elif (len(self.args) > 2 and self.args[0] == "-b" and
|
elif (len(self.args) > 2 and self.args[0] in options and
|
||||||
self.args[-1] == "--add"):
|
self.args[-1] == flag[0]):
|
||||||
blacklist.add(self.packages)
|
blacklist.add(self.packages)
|
||||||
elif (len(self.args) > 2 and self.args[0] == "-b" and
|
elif (len(self.args) > 2 and self.args[0] == options and
|
||||||
self.args[-1] == "--remove"):
|
self.args[-1] == flag[1]):
|
||||||
blacklist.remove(self.packages)
|
blacklist.remove(self.packages)
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
@ -278,23 +297,26 @@ class ArgParse(object):
|
||||||
def pkg_queue(self):
|
def pkg_queue(self):
|
||||||
""" manage packages in queue """
|
""" manage packages in queue """
|
||||||
queue = QueuePkgs()
|
queue = QueuePkgs()
|
||||||
if (len(self.args) == 2 and self.args[0] == "-q" and
|
options = ["-q", "--queue"]
|
||||||
self.args[1] == "list"):
|
flag = ["--add", "--remove"]
|
||||||
queue.listed()
|
command = ["list", "build", "install", "build-install"]
|
||||||
elif (len(self.args) > 2 and self.args[0] == "-q" and
|
if (len(self.args) > 2 and self.args[0] in options and
|
||||||
self.args[-1] == "--add"):
|
self.args[-1] == flag[0]):
|
||||||
queue.add(self.packages)
|
queue.add(self.packages)
|
||||||
elif (len(self.args) > 2 and self.args[0] == "-q" and
|
elif (len(self.args) > 2 and self.args[0] in options and
|
||||||
self.args[-1] == "--remove"):
|
self.args[-1] == flag[1]):
|
||||||
queue.remove(self.packages)
|
queue.remove(self.packages)
|
||||||
elif (len(self.args) == 2 and self.args[0] == "-q" and
|
elif (len(self.args) == 2 and self.args[0] in options and
|
||||||
self.args[1] == "build"):
|
self.args[1] == command[0]):
|
||||||
|
queue.listed()
|
||||||
|
elif (len(self.args) == 2 and self.args[0] in options and
|
||||||
|
self.args[1] == command[1]):
|
||||||
queue.build()
|
queue.build()
|
||||||
elif (len(self.args) == 2 and self.args[0] == "-q" and
|
elif (len(self.args) == 2 and self.args[0] in options and
|
||||||
self.args[1] == "install"):
|
self.args[1] == command[2]):
|
||||||
queue.install()
|
queue.install()
|
||||||
elif (len(self.args) == 2 and self.args[0] == "-q" and
|
elif (len(self.args) == 2 and self.args[0] in options and
|
||||||
self.args[1] == "build-install"):
|
self.args[1] == command[3]):
|
||||||
queue.build()
|
queue.build()
|
||||||
queue.install()
|
queue.install()
|
||||||
else:
|
else:
|
||||||
|
@ -302,35 +324,40 @@ class ArgParse(object):
|
||||||
|
|
||||||
def bin_install(self):
|
def bin_install(self):
|
||||||
""" install Slackware binary packages """
|
""" install Slackware binary packages """
|
||||||
if len(self.args) > 1 and self.args[0] == "-i":
|
options = ["-i", "--install"]
|
||||||
|
if len(self.args) > 1 and self.args[0] in options:
|
||||||
PackageManager(self.packages).install()
|
PackageManager(self.packages).install()
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
|
||||||
def bin_upgrade(self):
|
def bin_upgrade(self):
|
||||||
""" install-upgrade Slackware binary packages """
|
""" install-upgrade Slackware binary packages """
|
||||||
if len(self.args) > 1 and self.args[0] == "-u":
|
options = ["-u", "--upgrade"]
|
||||||
|
if len(self.args) > 1 and self.args[0] in options:
|
||||||
PackageManager(self.packages).upgrade()
|
PackageManager(self.packages).upgrade()
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
|
||||||
def bin_reinstall(self):
|
def bin_reinstall(self):
|
||||||
""" reinstall Slackware binary packages """
|
""" reinstall Slackware binary packages """
|
||||||
if len(self.args) > 1 and self.args[0] == "-o":
|
options = ["-o", "--reinstall"]
|
||||||
|
if len(self.args) > 1 and self.args[0] in options:
|
||||||
PackageManager(self.packages).reinstall()
|
PackageManager(self.packages).reinstall()
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
|
||||||
def bin_remove(self):
|
def bin_remove(self):
|
||||||
""" remove Slackware packages """
|
""" remove Slackware packages """
|
||||||
if len(self.args) > 1 and self.args[0] == "-r":
|
options = ["-r", "--remove"]
|
||||||
|
if len(self.args) > 1 and self.args[0] in options:
|
||||||
PackageManager(self.packages).remove()
|
PackageManager(self.packages).remove()
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
|
||||||
def bin_find(self):
|
def bin_find(self):
|
||||||
""" find installed packages """
|
""" find installed packages """
|
||||||
if len(self.args) > 1 and self.args[0] == "-f":
|
options = ["-f", "--find"]
|
||||||
|
if len(self.args) > 1 and self.args[0] in options:
|
||||||
PackageManager(self.packages).find()
|
PackageManager(self.packages).find()
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
@ -338,45 +365,51 @@ class ArgParse(object):
|
||||||
def pkg_desc(self):
|
def pkg_desc(self):
|
||||||
""" print slack-desc by repository"""
|
""" print slack-desc by repository"""
|
||||||
packages = "".join(self.packages)
|
packages = "".join(self.packages)
|
||||||
|
options = ["-p", "--print"]
|
||||||
|
flag = ["--color="]
|
||||||
|
colors = ["red", "green", "yellow", "cyan", "grey"]
|
||||||
if len(self.packages) > 1:
|
if len(self.packages) > 1:
|
||||||
packages = self.packages[0]
|
packages = self.packages[0]
|
||||||
if (len(self.args) == 3 and self.args[0] == "-p" and
|
if (len(self.args) == 3 and self.args[0] in options and
|
||||||
self.args[1] in _m.repositories):
|
self.args[1] in _m.repositories):
|
||||||
PkgDesc(packages, self.args[1], "").view()
|
PkgDesc(packages, self.args[1], "").view()
|
||||||
elif (len(self.args) == 4 and self.args[0] == "-p" and
|
elif (len(self.args) == 4 and self.args[0] in options and
|
||||||
self.args[3].startswith("--color=")):
|
self.args[3].startswith(flag[0])):
|
||||||
colors = ["red", "green", "yellow", "cyan", "grey"]
|
tag = self.args[3][len(flag[0]):]
|
||||||
tag = self.args[3][len("--color="):]
|
|
||||||
if self.args[1] in _m.repositories and tag in colors:
|
if self.args[1] in _m.repositories and tag in colors:
|
||||||
PkgDesc(packages, self.args[1], tag).view()
|
PkgDesc(packages, self.args[1], tag).view()
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
elif (len(self.args) > 1 and self.args[0] == "-p" and
|
elif (len(self.args) > 1 and self.args[0] in options and
|
||||||
self.args[1] not in _m.repositories):
|
self.args[1] not in _m.repositories):
|
||||||
usage(self.args[1])
|
usage(self.args[1])
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
|
||||||
def pkg_find(self):
|
def pkg_find(self):
|
||||||
"""find packages from all enabled repositories"""
|
""" find packages from all enabled repositories """
|
||||||
if len(self.args) > 1 and self.args[0] == "-F":
|
options = ["-F", "--FIND"]
|
||||||
|
if len(self.args) > 1 and self.args[0] in options:
|
||||||
find_from_repos(self.args[1:])
|
find_from_repos(self.args[1:])
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
|
||||||
def pkg_contents(self):
|
def pkg_contents(self):
|
||||||
""" print packages contents """
|
""" print packages contents """
|
||||||
if len(self.args) > 1 and self.args[0] == "-d":
|
options = ["-d", "--display"]
|
||||||
|
if len(self.args) > 1 and self.args[0] in options:
|
||||||
PackageManager(self.packages).display()
|
PackageManager(self.packages).display()
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
|
||||||
def congiguration(self):
|
def congiguration(self):
|
||||||
""" manage slpkg configuration file """
|
""" manage slpkg configuration file """
|
||||||
if (len(self.args) == 2 and self.args[0] == "-g" and
|
options = ["-g", "--config"]
|
||||||
self.args[1].startswith("config")):
|
command = ["print", "edit"]
|
||||||
editor = self.args[1][len("config="):]
|
if (len(self.args) == 2 and self.args[0] in options and
|
||||||
if self.args[1] == "config":
|
self.args[1].startswith(command[0])):
|
||||||
|
editor = self.args[1][len(command[1]):]
|
||||||
|
if self.args[1] == command[0]:
|
||||||
Config().view()
|
Config().view()
|
||||||
elif editor:
|
elif editor:
|
||||||
Config().edit(editor)
|
Config().edit(editor)
|
||||||
|
@ -414,22 +447,38 @@ def main():
|
||||||
"repo-remove": argparse.command_repo_remove,
|
"repo-remove": argparse.command_repo_remove,
|
||||||
"repo-info": argparse.command_repo_info,
|
"repo-info": argparse.command_repo_info,
|
||||||
"-a": argparse.auto_build,
|
"-a": argparse.auto_build,
|
||||||
|
"--autobuild": argparse.auto_build,
|
||||||
"-l": argparse.pkg_list,
|
"-l": argparse.pkg_list,
|
||||||
"-c": argparse.pkg_upgrade,
|
"-c": argparse.pkg_upgrade,
|
||||||
|
"--check": argparse.pkg_upgrade,
|
||||||
"-s": argparse.pkg_install,
|
"-s": argparse.pkg_install,
|
||||||
|
"--sync": argparse.pkg_install,
|
||||||
"-t": argparse.pkg_tracking,
|
"-t": argparse.pkg_tracking,
|
||||||
|
"--tracking": argparse.pkg_tracking,
|
||||||
"-n": argparse.sbo_network,
|
"-n": argparse.sbo_network,
|
||||||
|
"--netwotk": argparse.sbo_network,
|
||||||
"-b": argparse.pkg_blacklist,
|
"-b": argparse.pkg_blacklist,
|
||||||
|
"--blacklist": argparse.pkg_blacklist,
|
||||||
"-q": argparse.pkg_queue,
|
"-q": argparse.pkg_queue,
|
||||||
|
"--queue": argparse.pkg_queue,
|
||||||
"-i": argparse.bin_install,
|
"-i": argparse.bin_install,
|
||||||
|
"--install": argparse.bin_install,
|
||||||
"-u": argparse.bin_upgrade,
|
"-u": argparse.bin_upgrade,
|
||||||
|
"--upgrade": argparse.bin_upgrade,
|
||||||
"-o": argparse.bin_reinstall,
|
"-o": argparse.bin_reinstall,
|
||||||
|
"--reinstall": argparse.bin_reinstall,
|
||||||
"-r": argparse.bin_remove,
|
"-r": argparse.bin_remove,
|
||||||
|
"--remove": argparse.bin_remove,
|
||||||
"-f": argparse.bin_find,
|
"-f": argparse.bin_find,
|
||||||
|
"--find": argparse.bin_find,
|
||||||
"-F": argparse.pkg_find,
|
"-F": argparse.pkg_find,
|
||||||
|
"--FIND": argparse.pkg_find,
|
||||||
"-p": argparse.pkg_desc,
|
"-p": argparse.pkg_desc,
|
||||||
|
"--print": argparse.pkg_desc,
|
||||||
"-d": argparse.pkg_contents,
|
"-d": argparse.pkg_contents,
|
||||||
|
"--display": argparse.pkg_contents,
|
||||||
"-g": argparse.congiguration,
|
"-g": argparse.congiguration,
|
||||||
|
"--config": argparse.congiguration
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
arguments[args[0]]()
|
arguments[args[0]]()
|
||||||
|
|
Loading…
Reference in a new issue