The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

pt - command to manipulate pairtrees

SYNOPSIS

pt [-d dir] mktree directory [prefix]
pt [-l] [-d dir] [rmtree | lstree] [directory] ...
pt [-d dir] [mkid | rmid | lsid] id ...
pt [i2p | p2i] name ...

DESCRIPTION

The pt utility introduces commands that can be used to create, delete, modify, and report on a pairtree. When not made explicit via an argument (see the first two forms above), the pairtree in question is assumed to reside in a pairtree_root/ directory descending from the current directory or from a directory specified with -d.

The first form creates a pairtree, recording an optional prefix that will be stripped from an identifier before mapping it to a pairpath and prepended to an identifier generated from a pairpath. The second form deletes or lists an entire tree of nodes. The format of listing output can be specified with the --format option, currently one of "ANVL", "XML", "JSON", or "Plain" (default).

The third form creates, deletes, or tests the existence of tree nodes addressed via the identifier corresponding to each node's filesystem pairpath directory. When mkid is used with a non-existent pairtree, it will attempt first to create a pairtree. After creating a new pairpath, mkid will create a bud directory to encapsulate the new tree leaf (that will not otherwise be supplied by pt).

By default, the bud directory name will be taken from the full form of the identifier. While a pairpath may have any length, to properly encapsulate a leaf, there must be one and only one bud, and its name must be more than two characters long. An identifier shorter than that requires padding the bud name on the left with `0' (zero), except for an empty identifier, when the bud name simply becomes "supernode".

If -l is also given for lstree, the total number of octets and files within each leaf is listed after its identifier.

The fourth form permits access to the purely lexical lower level conversion between identifiers and pairpaths (no filesystem lookups take place).

This beta-level software has not been extensively tested.

EXAMPLES

   $ pt mkid foo bar zafp
   ./pairtree_root/fo/o/foo
   ./pairtree_root/ba/r/bar
   ./pairtree_root/za/fp/zafp
   $ pt rmid bar
   removed: bar | ./pairtree_root/ba/r/
   $ touch ./pairtree_root/za/fp/zafp/{a,b,c}
   $ pt lstree -l
   zafp   0.3
   foo   0.0
   2 objects
   $ pt mkid ab c ''
   ./pairtree_root/ab/0ab
   ./pairtree_root/c/00c
   ./pairtree_root/supernode

OPTIONS

-d directory

Specify pairtree directory. A "pairtree_root" component will be added on if not already present in directory.

-m format, --format format

Output in the given format, currently one of "ANVL", "XML", "JSON", or "Plain" (default).

-h, --help

Print extended help documentation.

-l, --long

Print more detailed listings.

--man

Print full documentation.

--version

Print the current version number and exit.

-bmfa

Options yet to come, for --bud, --force, --all.

CHANGES SINCE v0.301.0

Bug fixed so that Namaste tag is no longer under pairtree_root, but at the same level.

Subcommand mknode, rmnode, and lsnode renamed mkid, rmid, and lsid.

SEE ALSO

touch(1), nam(1)

AUTHOR

John Kunze jak at ucop dot edu

COPYRIGHT

Copyright 2008-2011 UC Regents. Open source BSD license.