GitXplorerGitXplorer
g

tol

public
2 stars
0 forks
2 issues

Commits

List of commits on branch master.
Unverified
877516d73c9e7a7bc709d3846b32971351767db2

Add an example for the -a switch

ggahr committed 5 years ago
Unverified
6636a46daf6a5adeb31867d755c5253b72a51136

Reformat source code

ggahr committed 5 years ago
Unverified
3a6cb6612a0e3b61910530f7d6a2ecc3b2079a70

Update copyright years

ggahr committed 5 years ago
Unverified
6bf1eb04a0754ca7b2d3ac7f8f1295b42b7d0a1b

Implement command accumulation

ggahr committed 5 years ago
Unverified
d98e5fae962373dbf198f15f90b46923d515c7a1

Require Tcl, not Tk

ggahr committed 6 years ago
Unverified
40a6a772ebb215a457035df47f318b00b23b6f59

Style fixes

ggahr committed 11 years ago

README

The README file for this repository.

Tcl One-Liner is a simple tool that allows to execute simple Tcl one-liners on the console.

$ ./tol 'puts Hello'
Hello

The -p switches makes tol print the result of the following expression.

$ ./tol -p 'expr {1+2}'
3

State is maintained from the evaluation of an argument to the next one...

$ ./tol 'set a 2' 'puts $a'
2

... unless the -r switch is used. This effectively resets the interpreter.

$ ./tol 'set a 2' -r 'puts $a'
can't read "a": no such variable
    while executing
"puts $a"

Errors in an arguments can be ignored with the -i switch.

$ ./tol 'puts before' 'set a 2' -r -i 'puts $a' 'puts after'
before
after

The -s var val can be used to set $var to the value val inside the interpreter.

$ ./tol -s home $HOME 'puts "we are living in $home"'
we are living in /Users/pietrocerutti

The -c switch can be used to avoid prematurely evaluating incomplete commands.

$ ./tol -c 'set vars [dict create' \
    -c editor -c $EDITOR \
    -c pager -c $PAGER ']' \
    'foreach {k v} $vars {puts "$k => $v"}'
editor => vim
pager => less

The -a switch can be use to accumulate arguments into full commands.

$ ./tol -a puts [clock format 1234567890]\; puts hello
Fri Feb 13 23:31:30 UTC 2009
hello