Skip to content
/ wc Public

Java based implementation of the Unix core tool wc.

License

Notifications You must be signed in to change notification settings

dwrik/wc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wc

This is a java implementation of the Unix core tool wc.

wc command line execution

The cli is built using picocli and the native executable is generated using GraalVM. The executable is an arm64 binary compiled on an M1 Macbook Air 2020.

The binary generated is standalone i.e. everything required to run it, is packaged into it. Java installation of any kind (JRE, JDK, JVM etc.) is not required thanks to GraalVM native-image.

The binary can be executed just like any other command line application by simply invoking it on the command line:

>> ./wc test.txt
    7145   58164  342190 test.txt

Features

  • line count
  • word count
  • byte count
  • char count
  • input from file
  • input from stdin (compatible with pipes)

Building the binary

  1. Clone the repo.
  2. Install dependencies and plugins.
>> mvn dependency:resolve
>> mvn dependency:resolve-plugins
  1. Compile and run tests.
>> mvn test
  1. Generate the jar file.
>> mvn package
  1. Install graalvm and make sure the native-image utility is on your path.
  2. Generate the binary.
>> native-image -jar /path/to/jar

Todo

  • input from multiple files

Releases

No releases published

Packages

No packages published

Languages