From: Layerex Date: Wed, 25 May 2022 15:43:37 +0000 (+0300) Subject: Add clang-format (#65) X-Git-Tag: v0.2.0.0~9 X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/xdg-ninja.git/commitdiff_plain/8be9791d2daa26d5580066e757c5c8320a93d69b Add clang-format (#65) * Add clang-format * clang-format: Set movable to false * clang-format: Add fix for version 14 and higher * clang-format: Add note about file location --- diff --git a/programs/clang-format.json b/programs/clang-format.json new file mode 100644 index 0000000..792ed24 --- /dev/null +++ b/programs/clang-format.json @@ -0,0 +1,10 @@ +{ + "files": [ + { + "path": "$HOME/.clang-format", + "movable": false, + "help": "Providing exact path to file via _--style_ (_-style_) flag is supported since version 14, but some repositories (Arch Linux repositories, for example) still don't have that version.\n\nWith version 14 or higher move file to _\"$XDG_CONFIG_HOME\"/clang-format_ and place this shell script with name \"clang-format\" to some directory in _\"$PATH\"_, preceding _/usr/bin/_ (I suggest _\"$HOME\"/.local/bin/_ or _/usr/local/bin/_):\n```bash\n#!/usr/bin/env sh\n\nCONFIG_FILE_PATH=\"$XDG_CONFIG_HOME\"/clang-format\n\nstyle_arg_set() {\n for arg in \"$@\"\n do\n case \"$arg\" in\n -style*|--style*)\n return 0\n esac\n done\n return 1\n}\n\nif style_arg_set \"$@\"\nthen\n /usr/bin/clang-format \"$@\"\nelse\n /usr/bin/clang-format --style=file:\"$CONFIG_FILE_PATH\" \"$@\"\nfi\n```\n\n_Note: .clang-format file is recognized by clang-format if it is located in any of the parent directories of the source file, not just \"$HOME\". This feature of the program may also be used._" + } + ], + "name": "clang-format" +}