ipt

授权协议 MIT License
开发语言 SHELL
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 程仲卿
操作系统 跨平台
开源组织
适用人群 未知
 软件概览






iPipeTo

Interactive Pipe To: The Node.js cli interactive workflow


Table of Contents


About

ipt (pronounced iPipeTo) introduces the missing cli interactive workflow. It takes any kind of list as an input and uses that list to build an interactive interface to let you select an element from it.

Stop manually dragging your mouse around to copy output data from a terminal, using the ipt workflow you can pipe data from a command and select what to copy to clipboard from a convenient visual menu.

Selected data is also output to stdout allowing for easily composing various workflows - Just create your custom alias!



demo animation


�� News

  • v3.2.0:
    • Added -i option for arbitrary input prompts
  • v3.1.0:
    • Added -o option for ordered multiple choice selection
  • v2.1.0:
    • Added -D option for defining a pre-selected item in the list
  • v2.0.0:
    • Added -p option for extracting path out of selected items
    • Added -M option for customizing interface message
    • Added -0 option for better null char compatibility
    • Added -S option for setting number of lines to be displayed
    • Added a proper programmatic API
  • v1.1.0: Added autocomplete (or fuzzy finder) mode ipt -a

�� Features

Reads from standard input, prints to standard output

iPipeTo is inspired by the Unix Pipeline and is composable with any command line utility you already use and love.

Select multiple items

The -m or --multiple flag allows you to select many items out of the interactive list instead of the standard "pick one" behavior.

Fuzzysearch (autocomplete mode)

Using -a or --autocomplete option switchs the behavior of the interactive list to that of a fuzzysearch (or autocomplete) where options are narrowed as you type.

Extract path from result

A convenient option that helps extract file system path values out of the selected item, very useful when manipulating verbose output. Use -p or --extract-path options.

Input prompt

Use the -i or --input option in order to use ipt as a simple input prompt, default values can be set using standard input or the --default argument.

Copy to clipboard

The -c or --copy option allows you to copy the selected item value to clipboard. Makes for useful workflows where you may need that value somewhere else such as out of the terminal or in a manual command to type later.

Customization

Customize your workflow by defining the separator to be used to generate the list (-s or --separator options), a custom message to display on the interactive interface (-M or --message) and much more. Make sure to take a look at the Help section to learn about all the available options.

Default selected items

Use the -D or --default option to determine which item(s) should be selected by default on the interactive list. The -P or --default-separator also allows for a custom char to be used to split these items (similar to -s option).

Node.js based

All you need in order to run ipt is the Node.js runtime and npm, if you have those you're already all set!


�� Examples

The default behavior of ipt is to allow for the selection of one item from the interactive list, once selected this item will be output to stdout, you can also use -c option to copy the result to your clipboard.

Using Unix pipes to send selected value to next command

Here we get a simple list of branchs git branch -a, pipe into ipt and pipe the selected item value to git checkout to checkout into the selected branch. xargs is needed to get the data from standard input and read it as an argument.




Using the multiple choices option

In the following example we list all the files from the folder ls and pipe that list into ipt only that this time we use the "multiple" flag -m that allows for selecting multiple items from a list. The selected items get piped to trash that deletes them.




NOTE: An ordered multiple choice menu is available when using the -o OR --ordered option

Using file as input data

You can also read a file as source of input data instead of reading from the standard input, here we read from a TODO file and redirect the selected items to be written in a DONE file.




⬇️ Install

Available on npm:

npm install -g ipt

Keep in mind that you'll need the latest Node.js LTS installed!


�� Awesome workflows

Showcases some useful predefined workflow scripts for using iPipeTo:

  • ntl: Interactive cli menu to list/run npm tasks
  • itrash: Selects files to delete from current folder
  • git-iadd: Interactive staging of selected changed files
  • git-ishow: Choose one git stash item to show
  • npmlist: Fuzzy list everything with npm module

Found an awesome workflow idea? Send us a PR to add it here!


Help

Usage:
  ipt [options] [<path>]

Options:
  -0, --null               Uses a null character as separator          [boolean]
  -a, --autocomplete       Starts in autocomplete mode                 [boolean]
  -c, --copy               Copy selected item(s) to clipboard          [boolean]
  -d, --debug              Prints to stderr any internal error         [boolean]
  -D, --default            Select a default choices by their name       [string]
  -P, --default-separator  Separator element for default items          [string]
  -e, --file-encoding      Encoding for file <path>, defaults to utf8   [string]
  -h, --help               Shows this help message                     [boolean]
  -i, --input              Open an interactive input prompt            [boolean]
  -m, --multiple           Allows the selection of multiple items      [boolean]
  -o, --ordered            Selects multiple items in order             [boolean]
  -M, --message            Replaces interface message                   [string]
  -p, --extract-path       Returns only a valid path for each item     [boolean]
  -s, --separator          Separator to to split input into items       [string]
  -S, --size               Amount of lines to display at once           [number]
  -t, --no-trim            Prevents trimming of the result strings     [boolean]
  -u, --unquoted           Force the output to be unquoted             [boolean]
  -v, --version            Show version number                         [boolean]

Supported OS Terminals

iPipeTo should run just fine in any of the Inquirer.js supported terminals:

  • Mac OS:
    • Terminal.app
    • iTerm
  • Linux (Ubuntu, openSUSE, Arch Linux, etc):
    • gnome-terminal (Terminal GNOME)
    • konsole
  • Windows*:
    • cmd.exe
    • Powershell
    • Cygwin

Contributing

Bug fixes / code changes: Please provide tests covering your changes, update docs accordingly and keep your changes to a single commit.


Alternatives

As in any cool idea, iPipeTo is not the only available choice, here are some other cool similar tools found in the wild:


Roadmap

Are you wondering what can you do or how would you start contributing to iPipeTo's future? Take a look at our Roadmap document to find out about what's planned ahead and what currently needs help.


Credits

  • The iPipeTo logo is a kind contribution from Bruno Magal

License

MIT © 2021 Ruy Adorno

  • 一、使用结构体 struct ipt_ip((include/uapi/linux/netfilter_ipv4/ip_tables.h))。 68 /* Yes, Virginia, you have to zero the padding. */ 69 struct ipt_ip { 70 /* Source and destination IP addr */ 71

 相关资料
  • 本文向大家介绍Shell脚本实现监控iptables运行状态,包括了Shell脚本实现监控iptables运行状态的使用技巧和注意事项,需要的朋友参考一下 最近在调试服务器的iptables,自己做了个定时关iptables,但晚上回家很少开电脑,所以就没法去启动iptables,当然你可能会说,为什么不取消定时关闭iptables,我只能说个人的环境不一样,需求也就不一样. 脚本内容: vi i

  • 本文向大家介绍iptables配置(/etc/sysconfig/iptables)操作方法,包括了iptables配置(/etc/sysconfig/iptables)操作方法的使用技巧和注意事项,需要的朋友参考一下 如下所示: iptables -A INPUT -p tcp --dport 22 -j ACCEPT iptables -A INPUT -p tcp --dport 22 -j

  • 本文向大家介绍阿里云linux服务器上使用iptables设置安全策略的方法,包括了阿里云linux服务器上使用iptables设置安全策略的方法的使用技巧和注意事项,需要的朋友参考一下 公司的产品一直运行在云服务器上,从而有幸接触过aws的ec2,盛大的云服务器,最近准备有使用阿里云的弹性计算(云服务器)。前两种云服务器在安全策略这块做的比较好,提供简单明了的配置界面,而且给了默认的安全策略,反

  • 问题内容: 我分别在端口8006和8007上托管特殊的HTTP和HTTPS服务。我使用iptables来“激活”服务器;即路由传入的HTTP和HTTPS端口: 这就像一个魅力。但是,我想创建另一个脚本来再次禁用服务器。也就是说,将iptables恢复到运行上述行之前的状态。但是我很难弄清楚删除这些规则的语法。似乎唯一起作用的是完全冲洗: 但这也会删除其他不希望的iptables规则。 问题答案:

  • linux中如何只停掉iptables而不关闭防火墙的情况下关闭nf_conntrack,并且不会被iptables自动拉起。之前试过网上的帖子,关闭后启动iptables,nf_conntrack又被自动拉起

  • iptables 命令 防火墙分为硬件防火墙和软件防火墙 防火墙策略一般分为两种:开放和屏蔽 iptables 是 Linux 上常用的防火墙软件 iptables 一共有四张表和五条链 iptables (选项)[表名] (选项)[链名规则] (选项)[动作] 表: Raw 负责连接跟踪 Mangle 负责包处理 Nat 负责地址转换 Filter 负责包过滤 链名规则: PREROUTING

  • 本文向大家介绍linux vps服务器常用服务iptables策略,包括了linux vps服务器常用服务iptables策略的使用技巧和注意事项,需要的朋友参考一下 vps服务器裸奔在公网上,总感觉有点不安全,没办法总得整点措施来加固下服务器呀,安全第一。linux系统自带防火墙必须要好好利用起来,可是我有一年多没写过防火墙策略了,该忘的都忘了,不该忘的也都忘得差不多了,看笔记,找找感觉。 目前

  • 本文向大家介绍一键配置CentOS iptables防火墙的Shell脚本分享,包括了一键配置CentOS iptables防火墙的Shell脚本分享的使用技巧和注意事项,需要的朋友参考一下 手里几台VPS配置iptables太繁琐,看到了朱哥的LNMP脚本里有一个自动配置iptables防火墙的脚本,借来改了一下,给需要的人用; 只提供常用端口的设置,如果你有特殊需求只需自行添加或减少相应的端口