txtar

command
v0.0.0-...-fe59bbe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

The txtar command writes or extracts a text-based file archive in the format provided by the golang.org/x/tools/txtar package.

The default behavior is to read a comment from stdin and write the archive file containing the recursive contents of the named files and directories, including hidden files, to stdout. Any non-flag arguments to the command name the files and/or directories to include, with the contents of directories included recursively. An empty argument list is equivalent to ".".

The --extract (or -x) flag instructs txtar to instead read the archive file from stdin and extract all of its files to corresponding locations relative to the current, writing the archive's comment to stdout.

The --list flag instructs txtar to instead read the archive file from stdin and list all of its files to stdout. Note that shell variables in paths are not expanded in this mode.

Archive files are by default extracted only to the current directory or its subdirectories. To allow extracting outside the current directory, use the --unsafe flag.

When extracting, shell variables in paths are expanded (using os.Expand) if the corresponding variable is set in the process environment. When writing an archive, the variables (before expansion) are preserved in the archived paths.

Example usage:

txtar *.go <README >testdata/example.txt

txtar --extract <playground_example.txt >main.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL