Skip to content

essentialkaos/fmtc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

GoReportCard Codacy GitHub Actions CI Status GitHub Actions CodeQL Status

InstallationUsageCI StatusContributingLicense


fmtc is a simple utility for rendering fmtc formatted data. You can use it instead of the echo command to print colored messages.

fmtc preview

# Simple formatted message
fmtc "{*}Done!{!} File {#87}$file{!} successfully uploaded to {g_}$host{!}"

# Use option -E/--error to print message to stderr
fmtc -E "{r*}There is no user bob{!}"

# You can use stdin as a source of data
echo "{*}Done!{!} File {#87}$file{!} successfully uploaded to {g_}$host{!}" | fmtc
# or
fmtc <<< "{*}Done!{!} File {#87}$file{!} successfully uploaded to {g_}$host{!}"

# You can print message without colors using -nc/--no-color option
fmtc -nc "{*}Done!{!} File {#87}$file{!} successfully uploaded to {g_}$host{!}"

# Also, fmtc supports the NO_COLOR environment variable (https://no-color.org)
NO_COLOR=1 fmtc "{*}Done!{!} File {#87}$file{!} successfully uploaded to {g_}$host{!}"

# You can combine the use of fmtc with HEREDOC to reduce the number of fmtc calls
fmtc << EOF

{*}Usage:{!} rpmbuilder-farm {y}{command}{!} {s}arg…{!}

{*}Basic commands{!}

  {y}${CMD_INSTALL}{!} restart-delay{!}  Install farm on the system
  {y}${CMD_UNINSTALL}{!}              Uninstall farm from the system
  {y}${CMD_UPDATE}{!}                 Update all images
  {y}${CMD_USER_ADD}{!} {s}user{!}          Add new user
  {y}${CMD_USER_DEL}{!} {s}user{!}          Remove user and it containers
  {y}${CMD_USER_MOD}{!} {s}user{!}          Modify user public key

{*}Containers commands{!}

  {y}${CMD_START}{!} {s}user{!} {s-}image-name{!}    Start containers for given user
  {y}${CMD_RESTART}{!} {s}user{!} {s-}image-name{!}  Restart containers for given user
  {y}${CMD_STOP}{!} {s}user{!} {s-}image-name{!}     Stop containers for given user
  {y}${CMD_START_ALL}{!}                Start containers for all users
  {y}${CMD_RESTART_ALL}{!}              Restart containers for all users
  {y}${CMD_STOP_ALL}{!}                 Stop containers for all users

{*}Options{!}

  {g}--help{!}, {g}-h{!}     Show this help message
  {g}--version{!}, {g}-v{!}  Show information about version

EOF

Tip

If you are using SublimeText 4 (4075+), we strongly recommend that you install extended Bash syntax highlighting with support for fmtc tags.

Installation

From source

To build the fmtc from scratch, make sure you have a working Go 1.23+ workspace (instructions), then:

go install github.com/essentialkaos/fmtc@latest
sudo dnf install -y https://pkgs.kaos.st/kaos-repo-latest.el$(grep 'CPE_NAME' /etc/os-release | tr -d '"' | cut -d':' -f5).noarch.rpm
sudo dnf install fmtc

Prebuilt binaries

You can download prebuilt binaries for Linux and macOS from EK Apps Repository:

bash <(curl -fsSL https://apps.kaos.st/get) fmtc

Upgrading

Since version 1.1.0 you can update fmtc to the latest release using self-update feature:

fmtc --update

This command will runs a self-update in interactive mode. If you want to run a quiet update (no output), use the following command:

fmtc --update=quiet

Note

Please note that the self-update feature only works with binaries that are downloaded from the EK Apps Repository. Binaries from packages do not have a self-update feature and must be upgraded via the package manager.

Command-line completion

You can generate completion for bash, zsh or fish shell.

Bash:

sudo fmtc --completion=bash 1> /etc/bash_completion.d/fmtc

ZSH:

sudo fmtc --completion=zsh 1> /usr/share/zsh/site-functions/fmtc

Fish:

sudo fmtc --completion=fish 1> /usr/share/fish/vendor_completions.d/fmtc.fish

Man documentation

You can generate man page using next command:

fmtc --generate-man | sudo gzip > /usr/share/man/man1/fmtc.1.gz

Usage

CI Status

Branch Status
master CI
develop CI

Contributing

Before contributing to this project please read our Contributing Guidelines.

License

Apache License, Version 2.0

About

Simple utility for rendering fmtc formatted data

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors 2

  •  
  •