NAME

tptree - a very humble imitation of ttree from TT2

VERSION

Ask the version number to the script itself, calling:

shell$ tptree --version

USAGE

tptree [--usage] [--help] [--man] [--version]

tptree [--source|--src|-s directory] [--dest|--dst|-d directory]
   [--process|-p regex] [--verbose|-v] [--variables|-V]
   [--define|-D item] [--edefine|--eval-define|-E item]
   [--hdefine|--hex-define|-H|-X item] 
   [--sdefine|--storable-define|-S item]
   [--sstdin|--storable-stdin|-i]

EXAMPLES

shell$ tptree

shell$ tptree --src source --dst /path/to/dst --define ciao='a tutti'

DESCRIPTION

This simple script tries to capture what I've personally found to be 90% of the useful functionality in TT2: recursing into a given file tree, apply the transformations with the templating system, and put the result into a directory tree analogous to the starting one, but where I desire.

As a minimum, you have to provide a source directory and a destination. Every output directory that's not already there will be created, so the destination directory needs not to be previously created.

During processing, you can decide which files should be included by providing a selection regular expression through --process|-p.

One aspect where tptree goes quite on its own way is variable passing. While TT2's ttree is bound to simple variable=value paradigm, tptree offers a wide variety for both escaping/encoding the variables, or get them via standard input (<--sstdin|--storable-stdin|-i>).

OPTIONS

Parameter passing options are discussed in a section by themselves, to be found later in this document.

--dest | --dst | -d directory

set the destination directory root.

--help

print a somewhat more verbose help, showing usage, this description of the options and some examples from the synopsis.

--man

print out the full documentation for the script.

--process | -p regex

set the given regex as a regular expression to be matched on each filename found in the hierarchy. If matches, the file is "executed", otherwise.

--source | --src | -s directory

set the source directory for directory root.

--usage

print a concise usage line and exit.

--variables | -V

print a dump of the configured variables.

--verbose | -v

output some debug messages during execution.

--version

print the version of the script.

Variable Passing

There are three variables-setting facilities that can be used on the command line:

--define | -D name=value

set name as value

--edefine | --eval-define | -E name=expression

evaluate expression and set name to the result. So, for example you can say:

name='[qw(ciao a tutti)]'

and get name set to an anonymous array containing three elements (guess which?)

--hdefine | --hex-define | -H | -X name=hexvalue

convert hexvalue back to unencoded form, using pack's template 'H*', then set as the value of variable name.

--sdefine | --storable-define | -S name=storable-hex

convert storable-hex back into binary data (using 'H*'), then retrieve a value using Storable.

Last, but not least, a set of variables embedded into a hash ref encoded with Storable can be read from the standard input:

--sstdin | --storable-stdin | -i!

get configuration from standard input, decoding it using Storable.

CONFIGURATION AND ENVIRONMENT

tptree requires no configuration files or environment variables.

DEPENDENCIES

None, apart Template::Perlish. Unless it has been embedded in this very file.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests through http://rt.cpan.org/

AUTHOR

Flavio Poletti polettix@cpan.org

LICENSE AND COPYRIGHT

Copyright (c) 2008-2015 by Flavio Poletti polettix@cpan.org.

This program is free software. You can redistribute it and/or modify it under the terms of the Artistic License 2.0.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.