Coder Social home page Coder Social logo

wc's Introduction

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

wc's People

Contributors

dwrik avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.