ztcl::code files
Gives the files of the tree.
ztcl::code files ?PATH ...? ?-glob G? ?-n MAX?
Description
The files and -glob are those of grep. At most MAX files (200) show, and a last line gives the count of the rest.
Returns
One path on each line.
Examples
Each example of this page runs after
package require ztcl::code
# A folder with three files, outside a git tree.
set dir /tmp/ztcl-ref-code-[pid]
file delete -force $dir
file mkdir $dir
cd $dir
proc put {path text} {
set ch [open $path w]
puts -nonewline $ch $text
close $ch
}
put a.zig "const std = @import(\"std\");\n\npub const Point = struct {\n x: i32,\n\n pub fn len(p: Point) i32 {\n return p.x;\n }\n};\n"
put b.txt "one\ntwo\ntwo\n"
put c.md "# Title\n\n## Part\n\ntext\n"
# The tests use no model.
set ::ztcl::code::backend {http ""}
set ::ztcl::code::llm_url http://127.0.0.1:9/v1/chat/completions
.
% ztcl::code files . -glob *.zig,*.md
a.zig
c.md
Errors
% ztcl::code files nope
no file or folder nope
-errorcode ZTCL CODE NOFILE
Facts
- Capability
file. A new interpreter does not have it until the host turns it on.- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztcl 1.0.0-beta.2