pipe

command module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

README

pipe

A command util package. Download here: Pipe!.

Commands

in & out

examples:

  • read from stdin and output to stdout:
    echo asd | pipe in=out
    
  • read from file and output to file:
    pipe in('file', './test.txt')=out('file', './test1.txt')
    
  • use text as input:
    pipe in('text', 'hello world')=out
    
  • use label parameters:
    echo asd | pipe in=out(type:'file', filename:'./test1.txt')
    
base64

examples:

  • encode:
    echo asd | pipe in=base64.encode=out
    
  • decode:
    echo asd | pipe in=base64.decode=out
    
gzip

examples:

  • compress:
    echo asd | pipe in=gzip.compress=out('file', './test.gzip')
    
  • decompress:
    pipe in(type: 'file', './test.gzip')=gzip.decompress=out
    
json

examples:

  • pretty:
    pipe in('file', './test.json')=json.pretty=out
    
  • get: need one parameter to indicate json path, more details see gjson
    echo "{"name":{"first":[-999]}}" | pipe in=json.get('name.fisrt.0')=out
    

About command paramter

For now, pipe supports three kinds of command parameter:

  • number: including integer and float
  • string: wrapped by '
  • bool: true or false

NOTE: String parameter doesn't accept spacing character!, most terminal will recogonize space as a separator of two arguments and split them into a string array, so space in a string parameter will be removed.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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