Discover Packages
github.com/txominpelu/fnd
command
module
Version:
v0.0.0-...-07cce8e
Opens a new window with list of versions in this module.
Published: Apr 1, 2022
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
README
¶
FND
fnd is heavily inspired by fzf but it parses lines as json documents. This allows to search entries by field, output the value of a given field and many other field specific manipulations.
Basic usage
Quickly search through a list of entries parsed from stdin.
Get a list of things.
Search through them, filter them, pick one.
Do something with it
See Full Example
Features
Contains parsers to convert your input into documents. line_format
.
curl https://api.exchangerate-api.com/v4/latest/EUR | \
jq -c '.rates | to_entries[] | {"Currency": .key, "Rate": .value }' | \
fnd --line_format json
ps aux | fnd --line_format tabular
Customized command output:
Choose wich column to output: --output_column
# Kill the selected process
kill -9 $(ps aux | fnd --line_format tabular --output_column 'PID')
# fnd will output the PID column
Choose output format with golang templates: --output_template
echo $(ps aux | fnd --line_format tabular --output_template '{{.PID}}-{{.USER}}')
# fnd will output PID-USER values
Sort by column (column value is considered as a string):
ps aux | fnd --line_format tabular --output_column 'PID' --sorter bycolumn --sortby_column PID
Examples
Examples:
Open file with vi:
vi $(fnd-fdfind)
Pass tabular format (pass a table with a header and separated by spaces )
ps | fnd --line_format tabular
You can choose which column will be the output of the command. E.g this is how to kill the process that is chosen in fnd.
ps | kill -9 $(fnd --line_format tabular --output_column PID)
See other examples at commands/ :
Troubleshooting
My command fails, how can I figure out what's happening ?
Error logs are by default logged to stderr. To get the detailed error message you can redirect stderr to a log file or pass --log_file. E.g:
$ fnd 2> out.log
Full Example
Get a list of running processes.
ps aux
Pass them to fnd to allow searching through them.
ps aux | fnd
Parse input to obtain processes' fields
ps aux | fnd --line_format tabular
Do something with the output (E.g print the PID)
echo $(ps aux | fnd --line_format tabular --output_column)
The MIT License (MIT)
Copyright (c) 2019 Íñigo Mediavilla Saiz
Expand ▾
Collapse ▴
Documentation
¶
There is no documentation for this package.
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.