1.0.0 • Published 6 months ago

text-count-cli v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

text-count-cli

cli tool to count the number of words,characters,sentences,line from a text or a file.

Installation:

    npm install text-count-cli

Usage:

Counting Text Input

To count based on text input, use the following commands:

  • To count characters:
    count char "your text here"
  • To count words:
    count word "text"
  • To count lines:
    count line "text"
  • To count sentences:
    count sen "text"

Example:

    count char "hi buddy how are you?"  //output-21

    count word "hi buddy how are you?" //output-5

    count sen "hi buddy how are you?"  //output-1

    count line "hi buddy how are you?"  //output-1

Counting Text from a File

To count based on a file, use the -f flag followed by the count type and the file path: When specifying file paths, if the file is in the root directory of your project, you can simply use the file name without the full path.

  • To count words in a file:
    count -f word path/to/your/file.txt
  • To count characters in a file:
    count -f char path/to/your/file.txt
  • To count lines in a file:
    count -f line path/to/your/file.txt
  • To count sentences in a file:
    count -f sen path/to/your/file.txt

Example:

    count -f char suraj.txt  //output-32

    count -f word suraj.txt //output-6

    count -f sen suraj.txt //output-1

    count -f line suraj.txt  //output-1