Common command-line utilities
- Shell 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
In a terminal every matching line of a file is a link whose target is file:line, which ../editor opens at that line; the shown text is as it was. On a console or in a pipe plain text as before. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> |
||
| scripts | ||
| .gitignore | ||
| access.talc | ||
| copy.talc | ||
| count.talc | ||
| create.talc | ||
| echo.talc | ||
| find.talc | ||
| first.talc | ||
| last.talc | ||
| link.talc | ||
| list.talc | ||
| move.talc | ||
| owner.talc | ||
| README | ||
| remove.talc | ||
| search.talc | ||
| show.talc | ||
| utility.talc | ||
| VERSION | ||
| where.talc | ||
utilities: the everyday commands of a talc system.
where prints the working directory
list what a directory holds -all -long -time
show prints files, or the input
first the first lines of a file -lines -bytes
last the last lines of a file -lines -bytes
count lines, words and bytes -lines -words -bytes
search lines that match a pattern -ignore-case -literal -tree
-line-numbers -names-only
-count -invert
find paths under a directory -name -pattern -kind
copy files and directories -tree
move files and directories
remove files, links and directories -tree
create directories, or empty files -parents -file
link a symbolic link -to
access who may do what to a file
owner whose a file is -user -group
echo prints its arguments -no-newline
utility.talc what they share: options, complaining, input, trees
scripts/build.sh builds them all into bin/
Each one is a program of its own, <name>.talc here, and prints its usage
with -help. In a terminal (../terminal: TERMINAL_FORMS in the
environment) `list` says which names are directories, drawn strong,
and `find` writes every path it found as a link, which a press puts
into the terminal's line (or opens, in ../editor), and `search` writes
each matching line of a file as a link whose target is file:line, which
../editor opens at that line; on a console or in a pipe all three print
plain text, as (system console)'s console-write-styled and
console-write-link arrange. Changing directory is not here: it is the shell's `go`, since
a program cannot move the shell that started it.
Build:
scripts/build.sh
which needs the installed toolchain (compiler on PATH), and puts the
programs in bin/. Add that directory to PATH to use them.
NAMES. A command is one English word that says what it does, chosen to be
typed many times a day: list, copy, move, remove. An option is one dash
and one word: -all, -tree, -lines 20. There are no one-letter options and
no two-dash ones. The same word means the same thing everywhere it
appears: -tree is always "a directory with everything under it", and a
count is always -lines or -bytes.
An option may come anywhere among the arguments. An argument that begins
with a dash and a letter is an option; a lone dash, or a dash and a digit,
is an ordinary argument. To name a file that begins with a dash, give it a
directory: ./-file.
WHAT THEY HAVE IN COMMON. A utility that reads files takes them as
arguments and reads its input when given none, so it sits in a pipeline
as well as at the end of one. A failure with one argument is complained
about on the error stream, as "name: what went wrong", and the utility
goes on to its next argument; it ends with 1 if anything failed, 2 if the
arguments themselves were wrong (and then prints its usage), and 0
otherwise. search alone ends with 1 to say that nothing matched, and 2
when it could not run.
Users and groups are numbers: this system keeps no file of names. Links
are removed, copied and listed as themselves, not as what they point at,
except that copy follows a link it is given directly. Times are UTC.