clang-format
Advanced tools
Comparing version
@@ -16,2 +16,13 @@ #!/usr/bin/env node | ||
function getPythonInterpreter() { | ||
const interpreterOptions = ['python3', 'python', 'python2']; | ||
for (const opt of interpreterOptions) { | ||
const result = spawn(opt, ['--version'], {encoding: 'utf-8'}); | ||
if (result.status === 0) { | ||
return opt; | ||
} | ||
} | ||
return null; | ||
} | ||
function checkGitConfig() { | ||
@@ -50,2 +61,8 @@ const spawn_opts = {encoding: 'utf-8', stdio: ['pipe', 'pipe', 'inherit']}; | ||
const interpreter = getPythonInterpreter(); | ||
if (interpreter === null) { | ||
console.error('No python interpreter found'); | ||
return 2; | ||
} | ||
try { | ||
@@ -65,3 +82,3 @@ clangFormatPath = path.dirname(require.resolve('clang-format')); | ||
const gitClangFormatPath = path.join(clangFormatPath, 'bin/git-clang-format'); | ||
const result = spawn('python', [gitClangFormatPath, '--diff'], {encoding: 'utf-8'}); | ||
const result = spawn(interpreter, [gitClangFormatPath, '--diff'], {encoding: 'utf-8'}); | ||
@@ -68,0 +85,0 @@ if (result.error) { |
{ | ||
"name": "clang-format", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"description": "node wrapper around clang-format", | ||
@@ -26,3 +26,3 @@ "repository": { | ||
"dependencies": { | ||
"async": "^1.5.2", | ||
"async": "^3.2.3", | ||
"glob": "^7.0.0", | ||
@@ -29,0 +29,0 @@ "resolve": "^1.1.6" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
8698229
4.65%279
5.68%+ Added
- Removed
Updated