Files
entropy/client/solo/commands/version.py
T
Sławomir Nizio 7cf7e1f6b7 convert solo imports, with needed changes to entropy_path_loader
The module entropy_path_loader (used only for running from within the
checkout; otherwise not even installed) is made to provide the _entropy
namespace.

(Other ideas instead of this entropy_path_loader change would be to
reorganise files layout; drop support for running from the checkout as
is - and perhaps require virtualenvs; require sourcing a script that
sets PYTHONPATH. However, as implemented, it is not intrusive, and the
good part is that it is quite isolated, not used in normal usage after
installation. Basically, it only does sys.path + provides _entropy
namespace.)
2018-11-26 20:15:36 +01:00

61 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
"""
@author: Fabio Erculiani <lxnay@sabayon.org>
@contact: lxnay@sabayon.org
@copyright: Fabio Erculiani
@license: GPL-2
B{Entropy Command Line Client}.
"""
from entropy.i18n import _
from entropy.output import TextInterface
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand
from _entropy.solo.utils import read_client_release
class SoloVersion(SoloCommand):
"""
Main Solo yell command.
"""
NAME = "version"
ALIASES = ["--version"]
ALLOW_UNPRIVILEGED = True
INTRODUCTION = """\
Show Equo version.
"""
SEE_ALSO = "equo-help(1)"
def man(self):
"""
Overridden from SoloCommand.
"""
return self._man()
def parse(self):
"""
Parse command
"""
return self._show_version, []
def _show_version(self, *args):
# do not use entropy_client here
# it is slow and might interfere with
# other Client inits.
release = read_client_release()
text = TextInterface()
text.output(release, level="generic")
return 0
SoloCommandDescriptor.register(
SoloCommandDescriptor(
SoloVersion,
SoloVersion.NAME,
_("show equo version"))
)