Skip to content

Tcl plugin for powerlevel10k style prompt and WakaTime time tracking

License

Notifications You must be signed in to change notification settings

wakatime/tcl-prompt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tcl-prompt

pre-commit.ci status

github/downloads github/downloads/latest github/issues github/issues-closed github/issues-pr github/issues-pr-closed github/discussions github/milestones github/forks github/stars github/watchers github/contributors github/commit-activity github/last-commit github/release-date

github/license github/languages github/languages/top github/directory-file-count github/code-size github/repo-size github/v

This project provides:

tclsh

wish

  • A wakatime plugin to statistics how much time you write tcl in REPL.

wakatime

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:

expectp

vivadop

xsctp

Dependencies

  • 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.

Install

paru -S tcl-prompt-git
nix-env -iA nixos.nur.repos.wakatime.tcl-prompt

Usage

~/.tclshrc:

package require prompt

::tclreadline::Loop

Customize

You can redefined ::tclreadline::prompt1. This project provides a function ::prompt::get_ps1 to generate prompt string.

  • str is last string, such as >, $.
  • format can be %s to add padding white spaces
  • sep separate every section of prompt string.
  • text_or_function can be a text or function. Such as:
    • ::prompt::wakatime: statistic time. Output nothing. Ignore fg_color and bg_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 &}

About

Tcl plugin for powerlevel10k style prompt and WakaTime time tracking

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages