App-chot
view release on metacpan or search on metacpan
Use [nup](https://metacpan.org/pod/App%3A%3Anup) for multi-column display.
If _N_ is specified, it is passed to `nup` as the number of columns.
chot -C greple # multi-column with default layout
chot -C2 greple # 2-column layout
The source files are shown with syntax highlighting and formatted
into multi-column pages, equivalent to `nup chot greple`.
- **-p**, **--pager** _command_
Specify the pager command to use for displaying files.
Defaults to the `$CHOT_PAGER` environment variable, or `bat` if available,
otherwise `less`.
When multiple files are found, `bat` displays all files continuously
with syntax highlighting. With `less`, use `:n` to navigate to the
next file and `:p` for the previous file.
- **-t**, **--type** _handler\[:handler:...\]_
Specify which file type handlers to use and in what order.
Handlers are specified as colon-separated names (case-insensitive).
Default: `Command:Perl:Python:Ruby:Node`
Available handlers:
Command Search for executable commands in $PATH
Perl Search for Perl modules in @INC
Python Search for Python libraries using inspect module
Ruby Search for Ruby libraries using $LOADED_FEATURES
Node Search for Node.js modules using require.resolve
Examples:
chot --type Perl Getopt::Long # Only search Perl modules
chot --type python json # Only search Python modules
chot --type ruby yaml # Only search Ruby libraries
chot --type node express # Only search Node.js modules
- **--py**
Shortcut for `--type Python`. Search only Python modules.
- **--pl**
Shortcut for `--type Perl`. Search only Perl modules.
- **--rb**
Shortcut for `--type Ruby`. Search only Ruby libraries.
- **--nd**
Shortcut for `--type Node`. Search only Node.js modules.
- **--bat-theme** _mode_=_theme_
Specify the default bat theme for light or dark terminal backgrounds.
Can be used multiple times.
--bat-theme light=GitHub --bat-theme dark=Monokai
If `bat` is used as the pager and `BAT_THEME` is not set, the
terminal background luminance is detected and the appropriate theme
is applied. Built-in defaults are `Coldark-Cold` for light and
`Coldark-Dark` for dark backgrounds.
- **--suffix** _extension_
Specify file suffix/extension to search for (mainly for Perl modules).
Default: `.pm`
- **--skip** _pattern_
Specify directory patterns to skip during search.
Can be used multiple times to specify multiple patterns.
Default: none (optex symlinks are resolved automatically)
# HANDLER MODULES
The program uses a plugin architecture where different file type handlers
are dynamically loaded based on the `--type` option. Each handler must
implement a `get_path($app, $name)` method.
- **App::chot::Command**
Handler for executable commands. Searches through `$PATH` environment
variable to find executable files.
For [optex](https://metacpan.org/pod/App%3A%3Aoptex) symlinks (commands that are symlinks pointing
to the `optex` binary), the handler resolves them to the actual
command by searching `$PATH` (skipping other optex symlinks). If the
command has an alias defined in `~/.optex.d/config.toml`, the alias
target is used for resolution. When a `~/.optex.d/NAME.rc`
configuration file exists, it is included in the results.
- **App::chot::Perl**
Handler for Perl modules. Searches through `@INC` paths to find
Perl module files (.pm and .pl files).
- **App::chot::Python**
Handler for Python libraries. Executes Python's `inspect.getsourcefile()`
function to locate Python module files. When the default `python3`
cannot find a module, falls back to interpreters discovered from
shebang lines of previously found paths (e.g., Homebrew venv Python).
- **App::chot::Ruby**
Handler for Ruby libraries. Loads the specified library with `require`
and inspects `$LOADED_FEATURES` to find the actual file path.
Documentation is displayed using `ri`.
- **App::chot::Node**
Handler for Node.js modules. Uses `require.resolve` with global paths
to locate module entry points.
Documentation is opened via `npm docs`.
# EXAMPLES
# Display a script command (brew is a shell script)
chot brew
( run in 1.707 second using v1.01-cache-2.11-cpan-f56aa216473 )