Skip to content

clang-format-git-python

NPM Version  Node Current

Repository | npm

Node wrapper for git-clang-format Python script. This package requires Python3 as a dependency.

The CLI invokes a command named python, so ensure that python --version resolves to Python 3 in your environment.

TIP

This package also supports JSDoc type hints with the following APIs, so you'll see more detailed information directly in your code editor.

Installation

This package already includes clang-format-node as a dependency, so there's no need to install it separately.

sh
# Global
$ npm install -g clang-format-git-python
# Local
$ npm install -D clang-format-git-python
sh
# Global
$ pnpm add -g clang-format-git-python
# Local
$ pnpm add -D clang-format-git-python
sh
# Global
$ yarn global add clang-format-git-python
# Local
$ yarn add --dev clang-format-git-python
sh
# Run without adding to the project
$ yarn dlx clang-format-git-python
# Local
$ yarn add --dev clang-format-git-python
sh
# Global
$ bun add -g clang-format-git-python
# Local
$ bun add -d clang-format-git-python

CLI Commands

You can use the commands below to run git-clang-format.

NOTE

clang-format-git-python is an alias for git-clang-format and works in exactly the same way.

sh
npx git-clang-format
sh
npx clang-format-git-python

Node.js APIs

These APIs depend on the Node.js fs and path modules and the file system, so you cannot use them in browsers.

  • CommonJS

    js
    const {
      gitClangFormatPath,
      clangFormatGitPythonPath,
    } = require('clang-format-git-python');
  • ES Modules

    js
    import {
      gitClangFormatPath,
      clangFormatGitPythonPath,
    } from 'clang-format-git-python';

gitClangFormatPath

Type: string

The ABSOLUTE path to the git-clang-format Python script.


clangFormatGitPythonPath

Type: string

Alias for gitClangFormatPath.