A library containing constants and functions for SHtemplate repository.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
This repository provides constants and functions that are exclusively used within SHtemplate repository such as
- language-specific text snippets like help texts, interactive dialogues, terminal/log messages, and
- functions, e.g. the semi-automatic creation of the script's help.
For better code readability and maintenance the library is divided into multiple files:
/lib/ | / | Description |
---|---|---|
licenses | ||
... | <lic>.txt |
License header files where <lic> is the license's SPDX-License-Identifier . Used by lib_shtpl_about() function. |
shtpl.0.lib.sh |
Contains language-independent strings and all the library's functions | |
shtpl.<ll>.lib.sh |
Contains language-specific strings (translations), e.g. shtpl.en.lib.sh for English strings |
This file contains language-independent strings and all the library's functions.
⚠️ The following table only gives a brief overview. Before using any of these functions please have a look at the comments in the source file.
Function | Description |
---|---|
lib_shtpl_about |
Print about message (project, author, copyright, license, etc.) |
lib_shtpl_arg |
Generate/Format script's help. Only for script parameters (help's SYNOPSIS section), for other help sections see lib_shtpl_genhelp() instead. |
lib_shtpl_arg_action_is_valid |
Check if arg_action (see /src/run.sh ) is valid |
lib_shtpl_arg_error |
Log/Print an error message for a certain argument |
lib_shtpl_arg_is_set |
Check if one or more arguments are set (not empty) |
lib_shtpl_genhelp |
Generate/Format script's help. For all help sections except script parameters (see lib_shtpl_arg() instead). |
lib_shtpl_help |
Print help message using less utility |
lib_shtpl_message |
Log/Print error/info/warning message and optionally exit |
These files contain language-specific strings. For each supported language there is one (separate) file where <ll>
in the filename is the language's ISO 639-1 ID in lowercase letters, e.g. shtpl.en.lib.sh
contains English strings, shtpl.de.lib.sh
German strings, etc.
ℹ️ In case your language is not supported yet: Please have a look below.
In case your language is not supported yet please follow these steps:
-
Just copy the English translation file
/lib/shtpl.en.lib.sh
and rename the copy by replacingen
with your language's ISO 639-1 two-letter code (lowercase), e.g. toshtpl.
es
.lib.sh
for aSpanish
translation file. -
Open the renamed file and use your editor's
Search & Replace
feature to replace each constant'sLIB_SHTPL
_EN_
prefix by your language's ISO 639-1 two-letter code (uppercase), e.g. toLIB_SHTPL
_ES_
forSpanish
. -
After renaming just translate constant by constant into your own language.
-
Finally have a look at SHtemplate's readme for further project-specific instructions.
ℹ️ To contribute your translation to this project, please have a look at the Contributing section.
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the GNU Lesser General Public License v3.0 (or later). See LICENSE
for more information.
Project Link: https://github.com/fkemser/SHtemplateLIB