def cmdargs_for_style(self, formatstyle, filename=None):
# type: (Style, Optional[str]) -> List[str]
assert isinstance(formatstyle, Style)
configdata = bytestr(self.styletext(formatstyle))
sha = shahex(configdata)
cfg = os.path.join(tempfile.gettempdir(), 'whatstyle_uncrustify_%s.cfg' % sha)
if not self.tempfile_exists(cfg):
writebinary(cfg, configdata)
self.add_tempfile(cfg)
cmdargs = ['-c', cfg]
# The filename extension might be ambiguous so we choose from the languages
# registered in identify_language.
if self.languages:
lang = self.languages[0]
cmdargs.extend(['-l', lang])
return cmdargs
评论列表
文章目录