@nrademacher/file-ops-cli

Basic Node CLI file operations

Usage no npm install needed!

<script type="module">
  import nrademacherFileOpsCli from 'https://cdn.skypack.dev/@nrademacher/file-ops-cli';
</script>

README

File Ops CLI

A basic Node.js CLI app for common file operations.

Included so far:

  • Find and replace
  • Prepending
  • Appending

Installation

Project-specific usage

npm install @nrademacher/file-ops-cli

Global usage

npm install -g @nrademacher/file-ops-cli

Usage

file-ops op=<op> <args> <file>

Note: Globbed file specifications (e.g. *.js or src/**/*.js) must be in quotes to prevent automatic glob expansion.

Find and replace

file-ops fnr '<old>' '<new>' <flags> '<file>'
  • --silent, -s
    • Will not log individual processed files to console

Prepend

file-ops prepend '<text>' <flags> '<file>'

Flags

  • --silent, -s
    • Will not log individual processed files to console
  • --unique, -u
    • Will skip file if file already includes input string

Append

file-ops append '<text>' <flags> '<file>'

Flags

  • --silent, -s
    • Will not log individual processed files to console
  • --unique, -u
    • Will skip file if file already includes input string

TODO

  • Add better and prettier logging
  • Add quality-of-life CLI features
    • --help flag
  • Add more operations
  • Write tests