ttm

module
v1.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2024 License: AGPL-3.0

README

ttm - a time To Matrix Matrix Buy me a Coffee coverage report Go Report Card Go Reference

A time-like command that will send end of an arbitrary command output and some other info (like exit status) to matrix room.

Consider this project a "bash-oneliner" to do some stuff fast. It's not supposed to be beautiful and shiny, it just must work.

Features

  • Run any arbitrary command with colors, tty window size and other fancy stuff
  • Collect time information (real/user/sys, like time command)
  • Send that info to the matrix room
  • Project functionality considered final, so no breaking changes are possible, only fixes, tests and minor updates (like new options)
How it looks like
you run command in terminal...
$ ttm ansible-playbook --with args
# ... scroll-scroll-scroll
PLAY RECAP *****************************************************************************************************************************
gitlab.com                    : ok=33   changed=0    unreachable=0    failed=0    skipped=147  rescued=0    ignored=0


real	15.166239745s
user	10.330419s
sys		2.213327s
...and get fancy html-formated message in matrix

ttm report

ansible-playbook --with args
# end of log (if configured)
PLAY RECAP *****************************************************************************************************************************
gitlab.com                    : ok=33   changed=0    unreachable=0    failed=0    skipped=147  rescued=0    ignored=0
real	15.166239745s
user	10.330419s
sys		2.213327s

Exit code: 0

How to get

  • Arch Linux AUR
  • or Releases for freebsd, linux and MacOS
  • or go install gitlab.com/etke.cc/ttm@latest
  • or from source code

Quick start

# get the ttm app first, from the "How to get" section

# ttm configuration, check the "Configuration" section below to get the full (pretty impressive) list of available options
export TTM_HOMESERVER="https://matrix.example.com"
export TTM_TOKEN="matrix_access_token"
export TTM_ROOM="!XODRhTLplrymaFicdK:etke.cc"

# synax: ttm <any-command> [with any args]
ttm echo "that command will be sent to matrix, alongside with time stats, exit code and neat html formatting"

Configuration

All ttm config options are env vars

mandatory
  • TTM_HOMESERVER - the real address of your matrix HS, not a delegated url, eg: https://matrix.example.com
  • TTM_ROOM - matrix room id or alias, eg: !XODRhTLplrymaFicdK:etke.cc or #ttm:etke.cc

auth can be done with access token or login/password, that's up to you

login/password if you want to login with matrix user login and password

  • TTM_LOGIN - matrix login (localpart), eg: ttm, not @ttm:example.com
  • TTM_PASSWORD - matrix password, eg: superSecurePassword

access token if you want to login with existing session

  • TTM_TOKEN - matrix session access token
optional options
  • TTM_LOG - send full log information to matrix, allowed values: 0, 1; default: 0
  • TTM_MSGTYPE - message type, allowed values: m.text, m.notice; default: m.text
  • TTM_NOHTML - do not send html-formatted message, only plaintext (increases allowed log size x2), allowed values: 0, 1; default: 0
  • TTM_NOTEXT - do not send plaintext message, only html (increases allowed log size x2), allowed values: 0, 1; default: 0
  • TTM_NOTICEFAIL - send message with TTM_MSGTYPE="m.notice" if exit code is not 0, allowed values: 0, 1; default: 0
  • TTM_NOTIME - do not send time information to matrix, allowed values: 0, 1; default: 0
deprecated

following env vars still available and work, but were replaced:

  • TTM_ROOMID (use TTM_ROOM instead) - matrix room id or alias (eg: !fsafaFSAsf:example.com or #ttm:etke.cc)

Additional info

ttm developed by etke.cc, say hello in #ttm:etke.cc matrix room (or ask questions, if you have any)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL