Added new-config command

This commit is contained in:
Dimitris Zlatanidis 2015-08-04 01:31:51 +03:00
parent 1257e15f92
commit 94fefb7727
4 changed files with 33 additions and 14 deletions

View file

@ -21,6 +21,7 @@ Usage: slpkg Commands:
[repo-remove [repository]] [repo-list] [repo-remove [repository]] [repo-list]
[repo-info [repository]] [update [slpkg]] [repo-info [repository]] [update [slpkg]]
[health, --silent] [deps-status, --graph=[type]] [health, --silent] [deps-status, --graph=[type]]
[new-config]
Optional arguments: Optional arguments:
[-h] [-v] [-h] [-v]
@ -119,6 +120,12 @@ Additional options:
.PP .PP
\fB--graph=[type]\fP : Drawing dependencies diagram. (example for type: ascii, image.x11, image.png etc.) \fB--graph=[type]\fP : Drawing dependencies diagram. (example for type: ascii, image.x11, image.png etc.)
.SS new-config, manage .new configuration files
\fBslpkg\fP \fBnew-config\fP
.PP
This option searches for .new configuration files in /etc/ path and ask the user what todo with those
files.
.SH OPTIONS .SH OPTIONS
.PP .PP
The following arguments are available. The following arguments are available.

View file

@ -58,6 +58,7 @@ Commands:
deps-status, --graph=[type] Print dependencies status used by deps-status, --graph=[type] Print dependencies status used by
packages or drawing dependencies packages or drawing dependencies
diagram. diagram.
new-config Manage .new configuration files.
Optional arguments: Optional arguments:
-h, --help Print this help message and exit. -h, --help Print this help message and exit.
@ -135,6 +136,7 @@ def usage(repo):
[repo-remove [repository]] [repo-list] [repo-remove [repository]] [repo-list]
[repo-info [repository]] [update [slpkg]] [repo-info [repository]] [update [slpkg]]
[health, --silent] [deps-status, --graph=[type]] [health, --silent] [deps-status, --graph=[type]]
[new-config]
Optional arguments: Optional arguments:
[-h] [-v] [-h] [-v]

View file

@ -36,10 +36,11 @@ from queue import QueuePkgs
from repoinfo import RepoInfo from repoinfo import RepoInfo
from repolist import RepoList from repolist import RepoList
from repositories import Repo from repositories import Repo
from tracking import TrackingDeps
from blacklist import BlackList from blacklist import BlackList
from version import prog_version from version import prog_version
from health import PackageHealth from health import PackageHealth
from new_config import NewConfig
from tracking import TrackingDeps
from pkg_find import find_from_repos from pkg_find import find_from_repos
from arguments import options, usage from arguments import options, usage
from slpkg_update import it_self_update from slpkg_update import it_self_update
@ -196,6 +197,14 @@ class ArgParse(object):
else: else:
usage("") usage("")
def command_new_config(self):
"""Manage .new configuration files
"""
if len(self.args) == 1 and self.args[0] == "new-config":
NewConfig().run()
else:
usage("")
def auto_build(self): def auto_build(self):
"""Auto built tool """Auto built tool
""" """
@ -580,6 +589,7 @@ def main():
"repo-info": argparse.command_repo_info, "repo-info": argparse.command_repo_info,
"health": argparse.command_health, "health": argparse.command_health,
"deps-status": argparse.command_deps_status, "deps-status": argparse.command_deps_status,
"new-config": argparse.command_new_config,
"-a": argparse.auto_build, "-a": argparse.auto_build,
"--autobuild": argparse.auto_build, "--autobuild": argparse.auto_build,
"-l": argparse.pkg_list, "-l": argparse.pkg_list,

View file

@ -45,6 +45,19 @@ class NewConfig(object):
self.etc = "/etc/" self.etc = "/etc/"
self.news = [] self.news = []
def run(self):
"""print .new configuration files
"""
self.find_new()
for n in self.news:
print("{0}".format(n))
print("")
Msg().template(78)
print("| Installed {0} new configuration files:".format(
len(self.news)))
Msg().template(78)
self.choices()
def find_new(self): def find_new(self):
"""Find all '.new' files from /etc/ folder """Find all '.new' files from /etc/ folder
and subfolders and subfolders
@ -58,19 +71,6 @@ class NewConfig(object):
print(" No new configuration files\n") print(" No new configuration files\n")
raise SystemExit() raise SystemExit()
def view_new(self):
"""print .new configuration files
"""
self.find_new()
for n in self.news:
print("{0}".format(n))
print("")
Msg().template(78)
print("| Installed {0} new configuration files:".format(
len(self.news)))
Msg().template(78)
self.choices()
def choices(self): def choices(self):
"""Menu options for new configuration files """Menu options for new configuration files
""" """