subjs
[![Build Status](https://travis-ci.org/achannarasappa/sub.svg?branch=master)](https://travis-ci.org/achannarasappa/sub) [![Coverage Status](https://coveralls.io/repos/github/achannarasappa/sub/badge.svg?branch=master)](https://coveralls.io/github/achannar
Last updated 2 years ago by achannarasappa .
MIT · Original npm · Tarball · package.json
$ cnpm install subjs 
SYNC missed versions from official npm registry.

sub

Build Status Coverage Status

Shell-esque parameter substitution in files from env and stdin replacement sources

Features

  • In-place multi-file edits (like sed's -i option)
  • Substitution count and preview

Demo

asciicast

Installation

Linux

wget -qO- https://api.github.com/repos/achannarasappa/sub/releases/latest \
| grep "/sub-linux" \
| cut -d : -f 2,3 | tr -d \" \
| sudo wget -qi - -O /usr/local/bin/sub
sudo chmod +x /usr/local/bin/sub

Releases for other operating systems and architectures can be downloaded from Github Releases

NPM

npm install -g subjs

Docker

echo "alias sub='docker run -t --rm -v \$PWD:/data achannarasappa/sub:latest \$@'" >> "$HOME/.$(echo $0 | tr -d -)rc"

Note: With docker, file_pattern will be relative to the current directory by default and prefixed by /data (e.g. sub /data/**/*.json rather than sub **/*.json to substitute in all json files). Alter the -v option in the above alias to change behavior.

Usage

sub <file_pattern> [options...]

Options:
  -i, --in-place             Edit files in place                [default: false]
  -d, --dry-run              Make no substitution               [default: false]
  -c, --count-substitutions  Output substitution counts         [default: false]
  -v, --version              Show version number                       [boolean]
  -h, --help                 Show help                                 [boolean]

Examples:
  sub **/*.json                    Write replaced text to stdout
  sub **/*.json -i                 Replace files in place
  sub **/*.json -i=.new            Replace in new file with suffix
  echo "A=1\nB=2" | sub **/*.json  Replace from stdin source

Contributions

PRs welcome :)

Current Tags

  • 1.0.2                                ...           latest (2 years ago)

3 Versions

  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (8)
Dev Dependencies (9)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |