mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-16 03:41:11 +01:00
Added keyboard interrupt
This commit is contained in:
parent
ab713384ed
commit
410a753452
2 changed files with 28 additions and 14 deletions
|
@ -22,6 +22,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
from utils import Utils
|
||||
|
@ -61,12 +62,16 @@ class Config(object):
|
|||
"ONLY_INSTALLED"
|
||||
]
|
||||
read_conf = Utils().read_file(self.config_file)
|
||||
for line in read_conf.splitlines():
|
||||
if not line.startswith("#") and line.split("=")[0] in conf_args:
|
||||
print(line)
|
||||
else:
|
||||
print("{0}{1}{2}".format(self.meta.color["CYAN"], line,
|
||||
self.meta.color["ENDC"]))
|
||||
try:
|
||||
for line in read_conf.splitlines():
|
||||
if not line.startswith("#") and line.split("=")[0] in conf_args:
|
||||
print(line)
|
||||
else:
|
||||
print("{0}{1}{2}".format(self.meta.color["CYAN"], line,
|
||||
self.meta.color["ENDC"]))
|
||||
except KeyboardInterrupt:
|
||||
print("")
|
||||
sys.exit(0)
|
||||
print("") # new line at end
|
||||
|
||||
def edit(self, editor):
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from splitting import split_package
|
||||
|
||||
|
@ -62,10 +63,14 @@ class Utils(object):
|
|||
Returns list with all the names of packages repository
|
||||
"""
|
||||
packages = []
|
||||
for line in PACKAGES_TXT.splitlines():
|
||||
if line.startswith("PACKAGE NAME:"):
|
||||
packages.append(split_package(line[14:].strip())[0])
|
||||
return packages
|
||||
try:
|
||||
for line in PACKAGES_TXT.splitlines():
|
||||
if line.startswith("PACKAGE NAME:"):
|
||||
packages.append(split_package(line[14:].strip())[0])
|
||||
return packages
|
||||
except KeyboardInterrupt:
|
||||
print("")
|
||||
sys.exit(0)
|
||||
|
||||
def check_downloaded(self, path, maybe_downloaded):
|
||||
"""
|
||||
|
@ -83,7 +88,11 @@ class Utils(object):
|
|||
Read config file and returns first uncomment line
|
||||
and stop. Used for Slackware mirrors
|
||||
"""
|
||||
for line in config.splitlines():
|
||||
line = line.lstrip()
|
||||
if line and not line.startswith("#"):
|
||||
return line
|
||||
try:
|
||||
for line in config.splitlines():
|
||||
line = line.lstrip()
|
||||
if line and not line.startswith("#"):
|
||||
return line
|
||||
except KeyboardInterrupt:
|
||||
print("")
|
||||
sys.exit(0)
|
||||
|
|
Loading…
Reference in a new issue