Skip to content

rossijonas/wc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wc (Word Counter)

A Simple Word Counter for the CLI.

About

wc reads STDIN and counts words, lines, or bytes.

Status:

Actions Status Actions Status

Features:

  • Cross platform: Linux / Macos / Windows.

  • Counts words, lines or bytes from an input in STDIN.

Installation

Requirements:

  • Go version 1.18.6 (or above)

How to install:

  • Run:

    $ go install github.com/rossijonas/wc@latest
    

Usage

Options:

$ wc -h
Usage of wc:
  -b    Count bytes
  -l    Count lines

Examples:

Pipe text to wc command, it returns the number of words by default.

Count words:

$ echo "two words" | ./wc
2 # result

Count lines using -l flag:

$ cat main.go | ./wc -l
32 # result

Count bytes using -b flag:

$ echo "lala" | ./wc -b
5 # result

Backlog

  • Add cover image to README file.

  • Support accepting multiple files.

Credits

This is an exercise from the book "Powerful Command-Line Applications in Go", but it may differ from the original exercise.

About

A Simple Word Counter for the CLI.

Topics

Resources

Stars

Watchers

Forks

Languages