This project provides:
- A powerlevel10k-like prompt for
tcls REPL
tclshand tk's REPLwish.
- A wakatime plugin to statistics how much time you write tcl in REPL.
Besides tcl's tclsh and tk's wish, there are many programs written in tcl
which provide their REPLs. This project provides some wrapper scripts to use
this plugin for them:
- tclreadline: Provide a function
::tclreadline::prompt1. Every read-eval-print-loop the function will be called and it's result will be used as prompt string. - tcllib: Provide some functions and variables about ANSI colors.
paru -S tcl-prompt-gitnix-env -iA nixos.nur.repos.wakatime.tcl-prompt~/.tclshrc:
package require prompt
::tclreadline::LoopYou can redefined ::tclreadline::prompt1. This project provides a function
::prompt::get_ps1 to generate prompt string.
stris last string, such as>,$.formatcan be%sto add padding white spacessepseparate every section of prompt string.text_or_functioncan be a text or function. Such as:::prompt::wakatime: statistic time. Output nothing. Ignorefg_colorandbg_color.::prompt::get_icon: output OS icon.::prompt::icon: OS icon.::prompt::get_version: output tcl version.::prompt::version: tcl version.::prompt::get_cwd: output current working directory. Use~to replace$HOME.::prompt::get_time: output current time.
# ::prompt::get_ps1 [str] [[format] {fg_color bg_color text_or_function} [sep]] ...
proc ::tclreadline::prompt1 {} {
return [::prompt::get_ps1 ...]
}If you just want to statistic time for wakatime and don't want to customize
your prompt string. Just call ::prompt::wakatime in ::tclreadline::prompt1:
proc ::tclreadline::prompt1 {} {
::prompt::wakatime
return {$}
# or other simple prompt string
}By default, It uses the base name of current working directory as your project name.
You can remove --project=%s from ::prompt::wakatime_cmd to disable it.
If there is a git repository, the project name can be achieved by git. Else
use the base name of current working directory.
set ::prompt::wakatime_cmd {exec wakatime-cli --write --plugin=repl-tcl-wakatime --entity-type=app --entity=tcl --alternate-language=tcl --project=%s &}




