419 sao GitHub và vẫn tăng — gliderlabs/sigil là dự án Go mà TopGit đang theo dõi trên nền tảng. Standalone string interpolator and template processor
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Standalone string interpolator and template processor
echo '${name} is{{ range seq ${count:-3} }} cool{{ end }}!' | sigil -p name=Sigil
Sigil is cool cool cool!
Sigil is a command line tool for template processing and POSIX-compliant
variable expansion. It was created for configuration templating, but can be used
for any text processing.
Other releases can be downloaded from Github Releases.
Using Sigil
Template text can be provided via STDIN or from a file if provided with the -f
flag. Any other arguments are key-values in the form <key>=<value>. They are
used as variables.
There are two forms of variable syntax in Sigil. The first is POSIX style, which
among other features allows default values or enforces required values:
$variable - normal POSIX style
${variable:-"default"} - expansion with default value
${variable:?} - fails when not set
Environment variables are also available as POSIX style variables. This makes
Sigil great for quick and simple string interpolation.
Template style
The other syntax to use variables is consistent with the rest of the templating
syntax. It uses {{ and }} to define template expressions. Variable expansion
in this form is simply used as:
{{ $variable }}
You can do much more with this syntax, such as modifier pipelines. All of which
is explained below.
Custom Delimiters
Sometimes you want to use sigil to generate text, which uses golang templating itself.
For example if you want to generate packer configuration
your template might contain a lot of {{ and }}.
Instead of replacing all {{ with {{“{{”}}, you can change the delimiters,
by setting the SIGIL_DELIMS environment variable. It is the left and right
delimiter strings, separated by a coma.
Use the --in-place flag with -f to write the rendered output back to the
template file, similar to sed -i:
sigil --in-place -f config.tmpl var1=foo var2=bar
This safely replaces the file using an atomic write (temp file + rename), so the
original file is preserved if template processing fails. File permissions are
retained.
Note: --in-place requires the -f flag. It cannot be used with -i (inline)
or stdin input.
Variables from files
Use the --vars-file (or -V) flag to load variables from a file instead of
passing them all as command-line arguments. The flag can be specified multiple
times; files are merged in order, and CLI key=value arguments override any
file-sourced variables.
The file format is auto-detected by extension:
.json - parsed as a JSON object
.yaml / .yml - parsed as a YAML mapping
.env or any other extension - parsed as key=value lines
There are a number of builtin functions that can be used as modifiers,
conditional tests, expansion data sources, and more. There are two references
for functions available:
Sigil builtins
Go template builtins
Here are a few examples:
{{ $variable | capitalize }}
{{ $variable | default "fallback" }} - use fallback when variable is not provided or empty
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/gliderlabs/sigil là nguồn chính thức.
gliderlabs/sigil có bao nhiêu sao?
gliderlabs/sigil có 419 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/gliderlabs/sigil. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
gliderlabs/sigil có phải mã nguồn mở không?
Có — gliderlabs/sigil phát hành theo license BSD-3-Clause, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/gliderlabs/sigil.
gliderlabs/sigil còn đang phát triển không?
Commit gần nhất trên gliderlabs/sigil là 3 ngày trước (theo timestamp GitHub). Repo có 45 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
gliderlabs/sigil là gì?
gliderlabs/sigil (gliderlabs/sigil) là dự án Go trên GitHub. Theo mô tả gốc: Standalone string interpolator and template processor
Đọc đầy đủ README ở tab phía trên.
Muốn nghe thêm một ý kiến về sigil?
Hỏi một AI đọc được trang này — một cú bấm là có ngay nhận định về sigil.