# Copyright (C) 2024, 2026  Luke T. Shumaker <lukeshu@parabola.nu>
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# This file is part of Parabola Libretools.
#
# Libretools is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Libretools 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

root = true

[*]
# Custom (libretools) option for scripting
_mode = unknown
# Standard (editorconfig.org) options
charset = utf-8
end_of_line = lf
indent_style = tab
trim_trailing_whitespace = true
insert_final_newline = true

################################################################################
# Bash                                                                         #
################################################################################

[{*.{sh,bash,conf},{write-atomic,write-ifchanged,embedlib.sh.gen,testenv},{createworkdir,diff-unfree,libreaddiff,libredbdiff,librerelease,librerelease-pbot-notify,librestage,distcc-tool,aur,librechroot,libremakepkg,dagpkg,gitget,libregit,is_built,libreblacklist,librelib,libremessages,librefetch,librefetch-install,pkgbuild-check-nonfree,pkgbuild-summarize-nonfree,repo-diff,toru-info,toru-path,toru-where,PKGBUILD,PKGBUILD-*,PKGBUILD.*,SRCBUILD-*,testpkg.install,}}]
_mode = bash
# shfmt options
shell_variant = bash
binary_next_line = false
switch_case_indent = true
space_redirects = false
keep_padding = false
function_next_line = false
simplify = true

[{PKGBUILD,PKGBUILD-*,PKGBUILD.*,SRCBUILD-*}]
indent_style = space
indent_size = 2

# not-quite-Bash
[{conf.sh,makepkg-librefetch.conf,chcleanup,librexgettext}.in]
_mode = atsubst+bash
# shfmt options
shell_variant = bash
binary_next_line = false
switch_case_indent = true
space_redirects = false
keep_padding = false
function_next_line = false
simplify = true

################################################################################
# Other (significant -- >=10 files)                                            #
################################################################################

[{GNUmakefile,Makefile,*.mk}]
_mode = make

[*.{md,ronn}]
_mode = markdown
indent_style = space
indent_size = 4

[*.bats]
_mode = bats
# shfmt options
shell_variant = bats
binary_next_line = false
switch_case_indent = true
space_redirects = false
keep_padding = false
function_next_line = false
simplify = true

[.gitignore]
_mode = gitignore

################################################################################
# Other (insignificant -- <10 files)                                           #
################################################################################

[{*.{po,pot},header.po.head.in}]
_mode = po
indent_style = space

[COPYING{,-GPLv2,-GPLv3}]
_mode = text
indent_style = space

[{indent,runserver}]
_mode = perl

[{source.sh.gen,makepkg.gen}]
_mode = sed

[.editorconfig]
_mode = ini

[*.el]
_mode = emacs-lisp
indent_style = space

[*.re]
_mode = pcre
