NAME

treesh - Navigate and manipulate in-memory tree objects using a CLI shell

VERSION

version 0.001

SYNOPSIS

% treesh --help
% treesh [opts]

treesh> _

Load a tree object (from an Org document):

treesh> load --as animals --driver org --source /home/budi/animals.org
treesh> load animals org /home/budi/animals.org

Load another tree object:

treesh> load plants org ~/plants.org

See loaded objects:

treesh> objects
+-----------+--------+---------------------------+-----+
| name      | driver | source                    | cwd |
+-----------+--------+---------------------------+-----+
| animals   | org    | /home/budi/animals.json   | /   |
| plants    | org    | /home/budi/plants.org     | /   |
+-----------+--------+---------------------------+-----+

Dump a loaded object:

treesh> dumpobj animals
...

Browse top-level children of a tree object:

treesh> setcurobj plants
treesh> ls -l
...

or:

treesh> ls -l --obj plants
...

Change "directory" to view another part of the tree (from hereon, please remember that you can set the object you want to work with with setcurobj command first, or specify the name of the object using --object option):

treesh> cd /dog
treesh> ls -l

Removing nodes of a tree object:

treesh> rm poo*

[NOT YET IMPLEMENTED] Reload an object from file (reverting all modifications):

treesh> reloadobj animals

[NOT YET IMPLEMENTED] Save a loaded object to file:

treesh> saveobj animals

[NOT YET IMPLEMENTED] Save a loaded object to another file:

treesh> saveobj animals /home/budi/animals-new.org

DESCRIPTION

This utility lets you navigate and manipulate in-memory tree objects. Currently supported tree objects:

  • Org (parsed using Org::Parser::Tiny)

  • JSON [NOT YET IMPLEMETED]

  • YAML [NOT YET IMPLEMETED]

  • HTML [NOT YET IMPLEMETED]

  • PPI [NOT YET IMPLEMETED]

You can then browse the tree as if it were a filesystem, using command like cd and ls. You can prune nodes, add/modify nodes, as well as move/copy nodes around. You can save the changes back to file.

OPTIONS

  • --help-, -h, -?

    Show short help message and exit.

  • --version, -v

    Show version and exit.

COMMANDS

For now, use help command, or command --help.

SETTINGS

Settings are configuration and regulate how the shell behaves.

output_format => str (default: text)

Set output format for command results. The same formatting is used by Perinci::CmdLine. See that module or Perinci::Result::Format for more details.

debug_completion => bool (default: 0)

Whether to show debugging information when doing tab completion.

debug_time_command => bool (default: 0)

Whether to show how long a command takes.

FAQ

The prompt looks rather garbled (e.g. extra " m >" character)!

It looks to be an issue with Term::ReadLine::Perl. Try installing Term::ReadLine::Gnu instead.

How do I redirect output of command to files?

treesh is meant to be a simple shell, not a full-blown Unix shell. So this feature is currently not implemented.

What about variables, aliases, looping, or $other_Unix_shell_feature?

Again, treesh is meant to be a simple shell, not a full-blown Unix shell. So those features are currently not implemented.

ENVIRONMENT

TREESH_HISTFILE => str (default: ~/.treesh_history)

Specify location of command history file. Like in shells, can be set to empty string to disable history loading/saving.

TREESHRC => str (default: ~/.treeshrc)

Specify location of settings file.

FILES

~/.treesh_history

Command history file.

~/.treeshrc

Settings file (IOD format).

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.