"""
TCSH shell
"""
from rez.utils.platform_ import platform_
from rezplugins.shell.csh import CSH
from rez import module_root_path
from rez.rex import EscapedString
import os.path
import pipes
[docs]class TCSH(CSH):
[docs] @classmethod
def name(cls):
return 'tcsh'
[docs] def escape_string(self, value):
value = EscapedString.promote(value)
value = value.expanduser()
result = ''
for is_literal, txt in value.strings:
if is_literal:
txt = pipes.quote(txt)
if not txt.startswith("'"):
txt = "'%s'" % txt
else:
txt = txt.replace('"', '"\\""')
txt = txt.replace('!', '\\!')
txt = '"%s"' % txt
result += txt
return result
def _bind_interactive_rez(self):
super(TCSH, self)._bind_interactive_rez()
completion = os.path.join(module_root_path, "completion", "complete.csh")
self.source(completion)
[docs]def register_plugin():
if platform_.name != "windows":
return TCSH
# Copyright 2013-2016 Allan Johns.
#
# This library is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation, either
# version 3 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <http://www.gnu.org/licenses/>.