Renamed '--varsfilter' to '--filter' and added '--xml'

netsetup
Самоукин Алексей 14 years ago
parent 7e6d5e013d
commit 12ce30083c

@ -13,7 +13,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from cl_install import cl_install, InstallError, __app__, __version__, get_install_errors
from cl_install import cl_install, InstallError, __app__, __version__,\
get_install_errors
from cl_opt import opt
from cl_share_cmd import share_cmd
import re
@ -140,6 +142,17 @@ class install_cmd(cl_install,share_cmd):
self.checkIncompatibleInstallUninstall()
if values.live:
self.checkIncompatibleLive()
if not values.v:
if values.filter:
errMsg = _("incorrect option") + ":" + " %s" %"--filter" +\
": " + _("use with option '-v'")
self.optobj.error(errMsg)
return False
if values.xml:
errMsg = _("incorrect option") + ":" + " %s" %"--xml" +\
": " + _("use with option '-v'")
self.optobj.error(errMsg)
return False
if not (values.install or values.uninstall or values.live):
if values.v is False and \
values.d is None and not self.clVars.Get('os_install_dev_from'):
@ -254,9 +267,24 @@ class install_cmd(cl_install,share_cmd):
return False
return True
def displayVars(self,vars):
def displayVars(self, optObj):
"""Process displaying variables"""
self.clVars.printVars()
if optObj.v:
varsFilter = None
varsNames = []
format = "default"
# Фильтрование переменных
if optObj.filter:
optCmd = optObj.filter
if ',' in optCmd:
varsNames = optCmd.split(",")
elif '*' in optCmd:
varsFilter = optCmd.replace("*", ".*")
else:
varsNames.append(optCmd)
if optObj.xml:
format = "xml"
self.clVars.printVars(varsFilter, varsNames, outFormat=format)
def _parseOptSwap(self, listOpt):
"""Parse value cmd option --swap"""

@ -25,10 +25,6 @@ lang().setLanguage(sys.modules[__name__])
class share_cmd(color_print, _error):
"""Класс общих методов обработки опций командной строки"""
def printVars(self, optObj):
"""Печать переменных"""
if optObj.v:
self.logicObj.printVars()
def setVars(self, optObj):
"""Установка переменных"""

@ -51,8 +51,8 @@ if __name__ == "__main__":
if not install.checkAndSetInstallOptions(options.d,options.w,options.b):
sys.exit(1)
# print variables
if options.v:
install.displayVars(options.v)
if options.v or options.filter or options.xml:
install.displayVars(options)
sys.exit(0)
# apply template to current system
#elif options.T:

Loading…
Cancel
Save